Skip to content

Commit

Permalink
fix: fix windows x86 cross-compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Oct 21, 2024
1 parent 9f4463b commit a76e464
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
10 changes: 2 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,16 @@ if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET ${MACOSX_DEPLOYMENT_TARGET})
endif()

# Set the target system on Windows (for cross-compiling x86)
# target system on Windows (for cross-compiling x86) and static linking runtimes
if(WIN32)
if("${PLATFORM}" STREQUAL "x86")
if("$ENV{Platform}" STREQUAL "x86")
set(CMAKE_SYSTEM_PROCESSOR "x86")
set(CMAKE_SYSTEM_HOST_PROCESSOR "x86")
# static linking for vcpkg
set(VCPKG_TARGET_TRIPLET "x86-windows-static")
elseif(NOT "$ENV{PROCESSOR_ARCHITEW6432}" STREQUAL "")
set(CMAKE_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}")
set(CMAKE_SYSTEM_HOST_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}")
# static linking for vcpkg
set(VCPKG_TARGET_TRIPLET "x86-windows-static")
else()
set(CMAKE_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}")
set(CMAKE_SYSTEM_HOST_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}")
# static linking for vcpkg
set(VCPKG_TARGET_TRIPLET "x64-windows-static")
endif()
# Avoid loading of project_optinos/WindowsToolchain
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@
"bump": "pnpx npm-check-updates -u -x typescript,eslint,chai && pnpx typesync && pnpm update"
},
"cmake-ts": {
"globalCMakeOptions": [
{
"name": "CMAKE_EXPORT_COMPILE_COMMANDS",
"value": "1"
}
],
"nodeAPI": "node-addon-api",
"configurations": [
{
Expand Down

0 comments on commit a76e464

Please sign in to comment.