Skip to content

Commit 640900f

Browse files
committed
build: set CMAKE_HOST_SYSTEM_PROCESSOR for windows + vcpkg deps
1 parent 8e94fc2 commit 640900f

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

.github/workflows/CI.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ jobs:
5252
- os: ubuntu-22.04
5353
docker: node:18-alpine
5454
docker_cmd:
55-
apk add --no-cache pkgconfig curl tar python3 make gcc g++ cmake git
56-
musl-dev && npm i -g pnpm && pnpm install && pnpm run build
55+
apk add --no-cache pkgconfig tar python3 build-base cmake ninja
56+
zip unzip curl git musl-dev && npm i -g pnpm && pnpm install &&
57+
pnpm run build
5758
node_version: 18
5859
node_arch: x64
5960
cpp_arch: x64
@@ -94,6 +95,7 @@ jobs:
9495
cmake: true
9596
ninja: true
9697
python: true
98+
vcpkg: true
9799
architecture: ${{ matrix.cpp_arch }}
98100

99101
- uses: pnpm/action-setup@v4

CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
55
cmake_policy(SET CMP0135 NEW)
66
endif()
77

8+
if(WIN32)
9+
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
10+
set(CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}")
11+
else()
12+
set(CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}")
13+
endif()
14+
endif()
15+
816
# Add project_options from https://github.com/aminya/project_options Change the
917
# version in the following URL to update the package (watch the releases of the
1018
# repository for future updates)
@@ -51,7 +59,7 @@ find_package(ZeroMQ CONFIG REQUIRED)
5159
target_link_system_libraries(addon PRIVATE libzmq libzmq-static)
5260

5361
# Node specific
54-
target_include_directories(addon PRIVATE ${CMAKE_JS_INC})
62+
target_include_system_directories(addon PRIVATE ${CMAKE_JS_INC})
5563
target_link_system_libraries(addon ${CMAKE_JS_LIB})
5664

5765
target_compile_definitions(addon PRIVATE V8_COMPRESS_POINTERS)
@@ -60,12 +68,6 @@ target_compile_definitions(addon PRIVATE V8_REVERSE_JSARGS)
6068
target_compile_definitions(addon PRIVATE BUILDING_NODE_EXTENSION)
6169
target_compile_definitions(addon PRIVATE NAPI_CPP_EXCEPTIONS)
6270

63-
# if(WIN32)
64-
# target_compile_definitions(addon PRIVATE "NOMINMAX")
65-
# target_compile_definitions(addon PRIVATE "NOGDI")
66-
# target_compile_definitions(addon PRIVATE "WIN32_LEAN_AND_MEAN")
67-
# endif()
68-
6971
# Use `.node` for the library without any "lib" prefix
7072
set_target_properties(addon PROPERTIES PREFIX "" SUFFIX ".node")
7173

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"deploy.doc": "run-s build.doc && gh-pages --dist \"./docs\"",
9797
"build.native": "cmake-ts nativeonly",
9898
"build.native.debug": "cmake-ts nativeonly",
99-
"build": "run-s build.js build.native",
99+
"build": "run-p build.js build.native",
100100
"build.debug": "run-s build.js build.native.debug",
101101
"test": "run-s clean.temp build && mocha",
102102
"test.skip_gc_tests": "run-s clean.temp build.debug && cross-env SKIP_GC_TESTS=true mocha",

0 commit comments

Comments
 (0)