Skip to content

Commit

Permalink
feat: add x86_64-pc-windows-msvc target
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Nov 19, 2024
1 parent d2c83f9 commit cc76d85
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ jobs:
build: yarn build --target x86_64-pc-windows-msvc
target: 'x86_64-pc-windows-msvc'
downloadTarget: ''
- host: windows-latest
setup: |
choco upgrade llvm
build: yarn build --target aarch64-pc-windows-msvc
target: 'aarch64-pc-windows-msvc'
downloadTarget: 'aarch64-pc-windows-msvc'
- host: ubuntu-latest
target: 'x86_64-unknown-linux-gnu'
downloadTarget: ''
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/skia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,57 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-windows-arm64:
if: "!contains(github.event.head_commit.message, 'skip skia')"

name: stable - windows-arm64 - build skia
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: List llvm dir
run: ls -R "C:\Program Files\LLVM"
shell: bash

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'

- uses: actions/setup-python@v5
with:
python-version: '3.x'
architecture: 'x64'

- name: Set env
run: echo "${PWD}/depot_tools" >> $GITHUB_PATH
shell: bash

- name: Install tools on Windows
run: |
choco install llvm ninja -y
choco upgrade llvm
pip install certifi
- name: Compile skia
shell: powershell
env:
PYTHONHTTPSVERIFY: 0
run: node ./scripts/build-skia.js --target=aarch64-pc-windows-msvc

- name: Install dependencies
run: yarn install --immutable --mode=skip-build

- name: Upload release
run: node ./scripts/release-skia-binary.mjs --upload --target=aarch64-pc-windows-msvc
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-apple-silicon:
if: "!contains(github.event.head_commit.message, 'skip skia')"

Expand Down
3 changes: 3 additions & 0 deletions npm/win32-arm64-msvc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `@napi-rs/canvas-win32-arm64-msvc`

This is the **aarch64-pc-windows-msvc** binary for `@napi-rs/canvas`
40 changes: 40 additions & 0 deletions npm/win32-arm64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "@napi-rs/canvas-win32-arm64-msvc",
"version": "0.1.62",
"os": [
"win32"
],
"cpu": [
"arm64"
],
"main": "skia.win32-arm64-msvc.node",
"files": [
"skia.win32-arm64-msvc.node"
],
"description": "Canvas for Node.js with skia backend",
"keywords": [
"napi-rs",
"NAPI",
"N-API",
"Rust",
"node-addon",
"node-addon-api",
"canvas",
"image",
"pdf",
"svg",
"skia"
],
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Brooooooklyn/canvas.git"
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"additional": [
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-apple-darwin",
Expand Down
3 changes: 3 additions & 0 deletions scripts/build-skia.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ switch (PLATFORM_NAME) {
}

switch (TARGET_TRIPLE) {
case 'aarch64-pc-windows-msvc':
ExtraSkiaBuildFlag += ' target_cpu=\\"arm64\\"'
break
case 'aarch64-unknown-linux-gnu':
ExtraSkiaBuildFlag += ' target_cpu="arm64" target_os="linux"'
ExtraCflags =
Expand Down
3 changes: 3 additions & 0 deletions scripts/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export function libPath(lib, hostPlatform, triple, tag = TAG) {
}
} else {
switch (triple) {
case 'aarch64-pc-windows-msvc':
platformName = `${lib}-win32-x64-msvc.lib`
break
case 'aarch64-unknown-linux-gnu':
platformName = `lib${lib}-linux-aarch64-gnu.a`
break
Expand Down

0 comments on commit cc76d85

Please sign in to comment.