diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index defe4803..7d160ab5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,78 +10,76 @@ jobs: if: ${{ !contains(github.event.head_commit.message, '[skip build]') }} runs-on: ${{ matrix.os }} # prettier-ignore - name: ${{ matrix.os }}-${{ matrix.node_arch }}-${{ matrix.distro }}-${{ matrix.platform }} + name: ${{ matrix.os }} ${{ matrix.target_arch }} ${{ matrix.distro }} ${{ matrix.platform }} strategy: fail-fast: false matrix: os: - ubuntu-24.04 - windows-2019 + - macos-13 node_arch: - x64 cpp_arch: - x64 + target_arch: + - x64 distro: - "" - native: - - true - include: + # Windows x86 - os: windows-2019 - node_arch: ia32 + node_arch: x64 + target_arch: ia32 cpp_arch: amd64_x86 - native: true - # - os: windows-2022 - # node_arch: x64 - # arch: arm64 - # cpp_arch: amd64_arm64 - - - os: macos-13 + # Windows Arm64 + - os: windows-2022 node_arch: x64 - cpp_arch: x64 - native: true + target_arch: arm64 + cpp_arch: amd64_arm64 + # MacOS Arm64 - os: macos-14 node_arch: arm64 + target_arch: arm64 cpp_arch: amd64_arm64 - native: true - # Ubuntu x64 + # Ubuntu 20.04 x64 - os: ubuntu-24.04 distro: ubuntu platform: linux/amd64 node_arch: x64 + target_arch: x64 cpp_arch: x64 - native: false - # Ubuntu Arm + # Ubuntu 20.04 Arm64 - os: ubuntu-24.04-arm distro: ubuntu platform: linux/arm64 node_arch: arm64 + target_arch: arm64 cpp_arch: arm64 - native: false # Musl Alpine - os: ubuntu-24.04 distro: alpine platform: linux/amd64 node_arch: x64 + target_arch: x64 cpp_arch: x64 - native: false # Musl Alpine Arm - os: ubuntu-24.04-arm distro: alpine platform: linux/arm64 node_arch: arm64 + target_arch: arm64 cpp_arch: arm64 - native: false env: npm_config_arch: ${{ matrix.node_arch }} - npm_config_target_arch: ${{ matrix.node_arch }} + npm_config_target_arch: ${{ matrix.target_arch }} setup_node_arch: ${{ matrix.node_arch }} steps: - uses: actions/checkout@v4 @@ -105,7 +103,7 @@ jobs: shell: bash - name: Setup Cpp - if: ${{ matrix.native }} + if: ${{ ! matrix.distro }} uses: aminya/setup-cpp@v1 with: vcvarsall: ${{ contains(matrix.os, 'windows') }} @@ -121,41 +119,36 @@ jobs: brew install gnutls autoconf automake libtool - uses: pnpm/action-setup@v4 - if: ${{ matrix.native }} + if: ${{ ! matrix.distro }} - name: Install Node 20 - if: ${{ matrix.native }} + if: ${{ ! matrix.distro }} uses: actions/setup-node@v4 with: node-version: 20 architecture: ${{ env.setup_node_arch }} - name: Install and Build Native - if: ${{ matrix.native }} + if: ${{ ! matrix.distro }} run: pnpm install - name: Build JavaScript - if: ${{ matrix.native }} + if: ${{ ! matrix.distro }} run: pnpm run build.js - name: Install Node 12 - if: ${{ matrix.native && matrix.os != 'macos-14' }} + if: ${{ !matrix.distro && matrix.os != 'macos-14' && !(matrix.os == 'windows-2022' && matrix.target_arch == 'arm64') }} uses: actions/setup-node@v4 with: node-version: 12 architecture: ${{ env.setup_node_arch }} - name: Build Native - if: ${{ matrix.native && matrix.node_arch != 'ia32' }} + if: ${{ ! matrix.distro }} run: npm run build.native - - name: Build Native Windows 32 - if: ${{ matrix.os == 'windows-2019' && matrix.node_arch == 'ia32' }} - run: - node --enable-source-maps ./node_modules/cmake-ts/build/main.js build --config win32-ia32-release - - name: Use Node 20 - if: ${{ matrix.native }} + if: ${{ ! matrix.distro }} uses: actions/setup-node@v4 with: node-version: 20 @@ -190,11 +183,11 @@ jobs: overwrite: true - name: Lint - if: "${{ contains(matrix.os, 'ubuntu') && matrix.native }}" + if: "${{ contains(matrix.os, 'ubuntu') && !matrix.distro }}" run: pnpm run lint-test - name: Test - if: ${{ matrix.native }} + if: ${{ ! matrix.distro && !(matrix.os == 'windows-2022' && matrix.target_arch == 'arm64') }} uses: nick-fields/retry@v3 with: timeout_minutes: 5 @@ -205,7 +198,7 @@ jobs: rm -rf ./tmp && mkdir -p ./tmp - name: Test Electron Windows/MacOS - if: "${{ !contains(matrix.os, 'ubuntu') && matrix.native }}" + if: "${{ !contains(matrix.os, 'ubuntu') && !matrix.distro && !(matrix.os == 'windows-2022' && matrix.target_arch == 'arm64') }}" uses: nick-fields/retry@v3 with: timeout_minutes: 5 @@ -215,7 +208,7 @@ jobs: continue-on-error: true - name: Test Electron Linux - if: "${{ contains(matrix.os, 'ubuntu') && matrix.native }}" + if: "${{ contains(matrix.os, 'ubuntu') && !matrix.distro }}" uses: nick-fields/retry@v3 with: timeout_minutes: 5 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ace20f4..69ac357e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,15 +65,26 @@ endif() # target system on Windows (for cross-compiling x86) and static linking runtimes if(WIN32) - if("$ENV{Platform}" STREQUAL "x86") - set(CMAKE_SYSTEM_PROCESSOR "x86") - set(VCPKG_TARGET_TRIPLET "x86-windows-static") - elseif(NOT "$ENV{PROCESSOR_ARCHITEW6432}" STREQUAL "") - set(CMAKE_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}") + if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "") + if("$ENV{Platform}" STREQUAL "x86") + set(CMAKE_SYSTEM_PROCESSOR "x86") + elseif(NOT "$ENV{PROCESSOR_ARCHITEW6432}" STREQUAL "") + set(CMAKE_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}") + else() + set(CMAKE_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}") + endif() + endif() + + string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" CMAKE_SYSTEM_PROCESSOR_LOWER) + + if("${CMAKE_SYSTEM_PROCESSOR_LOWER}" STREQUAL "amd64" OR "${CMAKE_SYSTEM_PROCESSOR_LOWER}" STREQUAL "x64") + set(VCPKG_TARGET_TRIPLET "x64-windows-static") + elseif("${CMAKE_SYSTEM_PROCESSOR_LOWER}" STREQUAL "arm64" OR "${CMAKE_SYSTEM_PROCESSOR_LOWER}" STREQUAL "aarch64") + set(VCPKG_TARGET_TRIPLET "arm64-windows-static") + elseif("${CMAKE_SYSTEM_PROCESSOR_LOWER}" STREQUAL "x86") set(VCPKG_TARGET_TRIPLET "x86-windows-static") else() - set(CMAKE_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}") - set(VCPKG_TARGET_TRIPLET "x64-windows-static") + message(STATUS "Not setting VCPKG_TARGET_TRIPLET for ${CMAKE_SYSTEM_PROCESSOR}") endif() # Avoid loading of project_optinos/WindowsToolchain diff --git a/package.json b/package.json index 9706a777..37f62327 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ }, "homepage": "http://zeromq.github.io/zeromq.js/", "dependencies": { - "cmake-ts": "1.0.0", - "node-addon-api": "^8.3.0" + "cmake-ts": "1.0.2", + "node-addon-api": "^8.3.1" }, "devDependencies": { "@types/benchmark": "~2.1.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8818c87a..e3762b01 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,11 +13,11 @@ importers: .: dependencies: cmake-ts: - specifier: 1.0.0 - version: 1.0.0 + specifier: 1.0.2 + version: 1.0.2 node-addon-api: - specifier: ^8.3.0 - version: 8.3.0 + specifier: ^8.3.1 + version: 8.3.1 devDependencies: '@types/benchmark': specifier: ~2.1.5 @@ -1044,8 +1044,8 @@ packages: clone-response@1.0.3: resolution: {integrity: sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==} - cmake-ts@1.0.0: - resolution: {integrity: sha512-wg7HJHTLmoqNM7/g/D9urT2P8NEghaz1ATlr55dCZTlK19DWN9I1f8st9uV6Cn0FeOUt02Ps1CKphvfbjUPRRQ==} + cmake-ts@1.0.2: + resolution: {integrity: sha512-5l++JHE7MxFuyV/OwJf3ek7ZZN1aGPFPM5oUz6AnK5inQAPe4TFXRMz5sA2qg2FRgByPWdqO+gSfIPo8GzoKNQ==} hasBin: true coffeescript@1.12.7: @@ -2436,8 +2436,8 @@ packages: resolution: {integrity: sha512-7vbj10trelExNjFSBm5kTvZXXa7pZyKWx9RCKIyqe6I9Ev3IzGpQoqBP3a+cOdxY+pWj6VkP28n/2wWysBHD/A==} engines: {node: '>=10'} - node-addon-api@8.3.0: - resolution: {integrity: sha512-8VOpLHFrOQlAH+qA0ZzuGRlALRA6/LVh8QJldbrC4DY0hXoMP0l4Acq8TzFC018HztWiRqyCEj2aTWY2UvnJUg==} + node-addon-api@8.3.1: + resolution: {integrity: sha512-lytcDEdxKjGJPTLEfW4mYMigRezMlyJY8W4wxJK8zE533Jlb8L8dRuObJFWg2P+AuOIxoCgKF+2Oq4d4Zd0OUA==} engines: {node: ^18 || ^20 || >= 21} node-releases@2.0.18: @@ -4576,7 +4576,7 @@ snapshots: dependencies: mimic-response: 1.0.1 - cmake-ts@1.0.0: {} + cmake-ts@1.0.2: {} coffeescript@1.12.7: optional: true @@ -6320,7 +6320,7 @@ snapshots: dependencies: semver: 7.6.3 - node-addon-api@8.3.0: {} + node-addon-api@8.3.1: {} node-releases@2.0.18: {} diff --git a/script/install.js b/script/install.js index 854f2a91..f5f398af 100644 --- a/script/install.js +++ b/script/install.js @@ -15,7 +15,7 @@ function cmakeTs() { ) } - cp.execFileSync(process.execPath, [cmakeTsPath, "nativeonly"], { + cp.execFileSync(process.execPath, [cmakeTsPath, "build"], { stdio: "inherit", }) }