Skip to content

Commit

Permalink
new build setup with auto bins download and x86 support
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Oct 31, 2024
1 parent 79023ea commit 34f3624
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
if (MSVC_CXX_ARCHITECTURE_ID)
string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
set(TARGET_BUILD_ARCH x86_64)
set(TARGET_BUILD_ARCH x64)
elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
set(TARGET_BUILD_ARCH x86)
else ()
message(FATAL_ERROR "MSVC Arch ID: Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'")
endif ()
else ()
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
set(TARGET_BUILD_ARCH x86_64)
set(TARGET_BUILD_ARCH x64)
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
set(TARGET_BUILD_ARCH x86)
set(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}")
Expand Down
12 changes: 7 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ add_definitions(-DBUILDING_NODE_EXTENSION=1 -DEXTERNAL_NAPI=1)
# Node

if (WIN32)
set(NODE_FILE "libnode.dll")
set(NODE_FILE "libnode.lib")
else ()
set(NODE_FILE "libnode.so.108")
endif ()

if (WIN32)
set(SYS_PATH "win_${TARGET_BUILD_ARCH}")
set(SYS_PATH "win/${TARGET_BUILD_ARCH}")
else ()
set(SYS_PATH "linux_${TARGET_BUILD_ARCH}")
set(SYS_PATH "linux/${TARGET_BUILD_ARCH}")
endif ()

set(NODE_PATH "${PROJECT_SOURCE_DIR}/deps/node/lib/${SYS_PATH}")
Expand All @@ -25,6 +25,8 @@ include_directories(

# Linking

message(INFO ${CMAKE_BUILD_TYPE})

link_directories(${NODE_PATH})

file(GLOB_RECURSE OMPNODE_FILES
Expand All @@ -37,9 +39,9 @@ add_library(${PROJECT_NAME} SHARED ${OMPNODE_FILES})
GroupSourcesByFolder(${PROJECT_NAME})

if (WIN32)
set(LIBRARIES libnode shlwapi dbghelp winmm)
set(LIBRARIES ${NODE_FILE} shlwapi dbghelp winmm)
else ()
target_link_libraries(${PROJECT_NAME} ${NODE_PATH}/libnode.so.93)
target_link_libraries(${PROJECT_NAME} ${NODE_PATH}/${NODE_FILE})

set(LIBRARIES ${node} pthread dl m)
endif ()
Expand Down

0 comments on commit 34f3624

Please sign in to comment.