Skip to content

Commit

Permalink
build native macOS arm binaries (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
scareything committed Nov 30, 2022
1 parent 74a76a8 commit 4f7946b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
arch: x86_64
toolchain: default.cmake

- os: macOS-11
name: macOS arm64
arch: arm64
toolchain: macOS-arm64.cmake

- os: windows-latest
name: Windows x86_64
arch: x86_64
Expand Down
23 changes: 23 additions & 0 deletions toolchains/macOS-arm64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# build-macOS-arm64

set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR arm64)

set(ZITI_BUILD_TESTS OFF CACHE BOOL "" FORCE)

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch arm64")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch arm64")

# for libsodium
set(triple arm64-apple-macos11)
execute_process(COMMAND /usr/bin/xcrun -sdk macosx --show-sdk-path
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
OUTPUT_STRIP_TRAILING_WHITESPACE)

set(ENV{CFLAGS} "-arch arm64 -isysroot ${CMAKE_OSX_SYSROOT}")
set(ENV{LDFLAGS} "-arch arm64 -isysroot ${CMAKE_OSX_SYSROOT}")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

0 comments on commit 4f7946b

Please sign in to comment.