Skip to content

Commit

Permalink
Add CI step that cross-compiles from Linux to macOS/iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Feb 5, 2025
1 parent 9a9c248 commit 353566c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ jobs:
rust: stable
target: x86_64-apple-ios-macabi
no_run: --no-run # FIXME(madsmtm): Fix running tests
- build: cross-macos-aarch64
os: ubuntu-latest
rust: stable
target: aarch64-apple-darwin
no_run: --no-run
- build: cross-ios-aarch64
os: ubuntu-latest
rust: stable
target: aarch64-apple-ios
no_run: --no-run
- build: windows-aarch64
os: windows-latest
rust: stable
Expand Down Expand Up @@ -155,6 +165,31 @@ jobs:
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
- name: Install llvm tools (for llvm-ar)
if: startsWith(matrix.build, 'cross-macos') || startsWith(matrix.build, 'cross-ios')
run: sudo apt-get install llvm
- name: Download macOS SDK
if: startsWith(matrix.build, 'cross-macos')
run: |
wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz
tar -xf MacOSX11.3.sdk.tar.xz
echo "SDKROOT=$(pwd)/MacOSX11.3.sdk" >> $GITHUB_ENV
- name: Download iOS SDK
if: startsWith(matrix.build, 'cross-ios')
run: |
wget https://github.com/xybp888/iOS-SDKs/releases/download/iOS18.1-SDKs/iPhoneOS18.1.sdk.zip
unzip iPhoneOS18.1.sdk.zip
echo "SDKROOT=$(pwd)/iPhoneOS18.1.sdk" >> $GITHUB_ENV
- name: Set up Apple cross-compilation
if: startsWith(matrix.build, 'cross-macos') || startsWith(matrix.build, 'cross-ios')
run: |
# Test with clang/llvm for now, has better cross-compilation support (GCC requires downloading a different toolchain)
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "AR=llvm-ar" >> $GITHUB_ENV
# Link with rust-lld
UPPERCASE_TARGET_NAME=$(echo "${{ matrix.target }}" | tr '[:lower:]-' '[:upper:]_')
echo "CARGO_TARGET_${UPPERCASE_TARGET_NAME}_LINKER=rust-lld" >> $GITHUB_ENV
- name: setup dev environment
uses: ilammy/msvc-dev-cmd@v1
if: startsWith(matrix.build, 'windows-clang')
Expand Down

0 comments on commit 353566c

Please # to comment.