Skip to content

Commit

Permalink
Use zig for ARM64 macOS builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamuko committed May 5, 2023
1 parent 9c56b31 commit 31d8c7e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ jobs:
- TARGET: x86_64-apple-darwin
OS: macos-latest
- TARGET: aarch64-apple-darwin
TARGET_CXX: zigcxx
TARGET_AR: ar
OS: macos-latest
- TARGET: x86_64-pc-windows-msvc
OS: windows-latest
Expand All @@ -101,6 +103,7 @@ jobs:
NAME: yurizaki
TARGET: ${{ matrix.TARGET }}
TARGET_CC: ${{ matrix.TARGET_CC }}
TARGET_CXX: ${{ matrix.TARGET_CXX }}
TARGET_AR: ${{ matrix.TARGET_AR }}
OS: ${{ matrix.OS }}
steps:
Expand All @@ -119,8 +122,17 @@ jobs:
sudo apt-get update
sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf
fi
if [[ $TARGET == "aarch64-apple-darwin" ]]; then
brew install zig
mkdir ~/bin
cat >>~/bin/zigcxx <<' EOF'
#!/bin/bash
zig c++ -target aarch64-macos $@
EOF
chmod +x ~/bin/zigcxx
fi
# some additional configuration for cross-compilation on linux
cat >>~/.cargo/config <<EOF
cat >>~/.cargo/config <<-'EOF'
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
[target.aarch64-unknown-linux-musl]
Expand All @@ -129,6 +141,8 @@ jobs:
linker = "arm-linux-gnueabihf-gcc"
[target.arm-unknown-linux-musleabihf]
linker = "arm-linux-gnueabihf-gcc"
[target.aarch64-apple-darwin]
linker = "zigcxx"
EOF
- name: Install rust target
shell: bash
Expand Down

0 comments on commit 31d8c7e

Please sign in to comment.