Skip to content

Commit 218e11c

Browse files
committed
Optimizes Node.js wrapper builds and CI
Generates `node.lib` from the `.def` file provided by `cmake-js` on MSVC, resolving linking errors for Node.js add-ons on Windows. Excludes Node.js 18 and 20 builds for Windows ARM64 in CI workflows. Official builds are unavailable for these combinations, preventing CI failures and improving efficiency.
1 parent ce43731 commit 218e11c

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

.github/workflows/wrapper-nodejs-publish.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ jobs:
6767
matrix:
6868
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-15-intel, windows-latest, windows-11-arm]
6969
node: ["18", "20", "22"]
70+
exclude:
71+
# Node.js 18 and 20 don't have official Windows ARM64 builds
72+
- os: windows-11-arm
73+
node: "18"
74+
- os: windows-11-arm
75+
node: "20"
7076
defaults:
7177
run:
7278
working-directory: ./wrappers/nodejs

wrappers/nodejs/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ target_include_directories(${PROJECT_NAME} PRIVATE
2525
${CMAKE_JS_INC}
2626
)
2727

28+
# Generate node.lib on Windows (cmake-js provides .def but not .lib)
29+
if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
30+
execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF}
31+
/out:${CMAKE_JS_NODELIB_TARGET}
32+
${CMAKE_STATIC_LINKER_FLAGS})
33+
endif()
34+
2835
target_link_libraries(${PROJECT_NAME} PRIVATE
2936
zxc_lib
3037
${CMAKE_JS_LIB}

0 commit comments

Comments
 (0)