Skip to content

Commit

Permalink
chore: use ci to publish macos arm64 build too
Browse files Browse the repository at this point in the history
  • Loading branch information
DjDeveloperr committed Oct 3, 2024
1 parent ac48aed commit 96ac81f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ jobs:
- name: Build Native Library (Unix)
if: runner.os != 'Windows'
run: deno task build

- name: Build Native Library (macOS x86_64)
if: runner.os == 'macos-latest'
env:
TARGET_ARCH: x86_64
run: |
deno task build-skia
cp ./native/build/libnative_canvas{,_aarch64}.dylib
deno task build-macos-x86_64
- name: Build Native Library (Windows)
if: runner.os == 'Windows'
Expand Down Expand Up @@ -102,4 +111,5 @@ jobs:
skia/out/Release/icudtl.dat
native/build/libnative_canvas.so
native/build/libnative_canvas.dylib
native/build/libnative_canvas_aarch64.dylib
native/build/Release/native_canvas.dll
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish
on:
release

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- name: Publish package
run: npx jsr publish
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

"tasks": {
"build": "cd native/build && CC=clang CXX=clang++ cmake .. && cmake --build . --config Release",
"build-macos-x86_64": "cd native/build && CC=clang CXX=clang++ cmake .. -DMACOS_TARGET_ARCH=x86_64 && cmake --build . --config Release",
"build-win": "rm -rf native/build && mkdir native/build && cd native/build && cmake .. -G \"Visual Studio 17 2022\" -T ClangCL && cmake --build . --config Release",
"test": "deno run -A --unstable-ffi ./test/test.ts",
"test-prebuilt": "deno run -A --unstable-ffi --import-map=./test/import_map.json ./test/test.ts",
Expand Down
7 changes: 7 additions & 0 deletions native/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
cmake_minimum_required(VERSION 3.10.0)

set(MACOS_TARGET_ARCH "arm64" CACHE STRING "macOS target architecture (x86_64, arm64)")

project(native_canvas VERSION 0.1.0)

set (CMAKE_CXX_STANDARD 17)
# set (CMAKE_BUILD_TYPE Debug)
set (CMAKE_BUILD_TYPE Release)

if (APPLE)
set(CMAKE_OSX_ARCHITECTURES ${MACOS_TARGET_ARCH})
endif()

include_directories(. ../skia)

add_library(native_canvas SHARED
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_skia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (Deno.env.get("SKIA_FROM_SOURCE") !== "1") {
os = "Linux";
break;
}
if (Deno.build.arch === "aarch64") {
if ((Deno.env.get("TARGET_ARCH") || Deno.build.arch) === "aarch64") {
os += "-aarch64";
}
try {
Expand Down

0 comments on commit 96ac81f

Please sign in to comment.