Skip to content

Commit 96ac81f

Browse files
committed
chore: use ci to publish macos arm64 build too
1 parent ac48aed commit 96ac81f

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ jobs:
7272
- name: Build Native Library (Unix)
7373
if: runner.os != 'Windows'
7474
run: deno task build
75+
76+
- name: Build Native Library (macOS x86_64)
77+
if: runner.os == 'macos-latest'
78+
env:
79+
TARGET_ARCH: x86_64
80+
run: |
81+
deno task build-skia
82+
cp ./native/build/libnative_canvas{,_aarch64}.dylib
83+
deno task build-macos-x86_64
7584
7685
- name: Build Native Library (Windows)
7786
if: runner.os == 'Windows'
@@ -102,4 +111,5 @@ jobs:
102111
skia/out/Release/icudtl.dat
103112
native/build/libnative_canvas.so
104113
native/build/libnative_canvas.dylib
114+
native/build/libnative_canvas_aarch64.dylib
105115
native/build/Release/native_canvas.dll

.github/workflows/publish.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Publish
2+
on:
3+
release
4+
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
9+
permissions:
10+
contents: read
11+
id-token: write
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Publish package
17+
run: npx jsr publish

deno.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
"tasks": {
1010
"build": "cd native/build && CC=clang CXX=clang++ cmake .. && cmake --build . --config Release",
11+
"build-macos-x86_64": "cd native/build && CC=clang CXX=clang++ cmake .. -DMACOS_TARGET_ARCH=x86_64 && cmake --build . --config Release",
1112
"build-win": "rm -rf native/build && mkdir native/build && cd native/build && cmake .. -G \"Visual Studio 17 2022\" -T ClangCL && cmake --build . --config Release",
1213
"test": "deno run -A --unstable-ffi ./test/test.ts",
1314
"test-prebuilt": "deno run -A --unstable-ffi --import-map=./test/import_map.json ./test/test.ts",

native/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
cmake_minimum_required(VERSION 3.10.0)
2+
3+
set(MACOS_TARGET_ARCH "arm64" CACHE STRING "macOS target architecture (x86_64, arm64)")
4+
25
project(native_canvas VERSION 0.1.0)
36

47
set (CMAKE_CXX_STANDARD 17)
58
# set (CMAKE_BUILD_TYPE Debug)
69
set (CMAKE_BUILD_TYPE Release)
710

11+
if (APPLE)
12+
set(CMAKE_OSX_ARCHITECTURES ${MACOS_TARGET_ARCH})
13+
endif()
14+
815
include_directories(. ../skia)
916

1017
add_library(native_canvas SHARED

scripts/build_skia.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (Deno.env.get("SKIA_FROM_SOURCE") !== "1") {
3131
os = "Linux";
3232
break;
3333
}
34-
if (Deno.build.arch === "aarch64") {
34+
if ((Deno.env.get("TARGET_ARCH") || Deno.build.arch) === "aarch64") {
3535
os += "-aarch64";
3636
}
3737
try {

0 commit comments

Comments
 (0)