fix mac build (#676)

* fix mac build

* add freetype

* set deployment target

* test

* test

* more

* test

* more

* more

* more

* more

* test

* put back

* link CoreFoundation

* more

* more

* more
This commit is contained in:
Logan McNaughton
2026-03-12 12:49:59 +01:00
committed by GitHub
parent acf5e08b97
commit fcceca5976
3 changed files with 24 additions and 5 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
[target.'cfg(all(target_arch = "aarch64", target_os = "linux"))']
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
[target.'cfg(target_os = "windows")']
[target.'cfg(any(target_os = "windows", target_os = "macos"))']
linker = "rust-lld"
[target.'cfg(target_arch = "x86_64")']
@@ -14,3 +14,5 @@ rustflags = ["-C", "target-cpu=cortex-a76"]
CC = "clang"
CXX = "clang++"
AR = "llvm-ar"
MACOSX_DEPLOYMENT_TARGET = "15.0"
SDKROOT = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
+8 -4
View File
@@ -129,16 +129,14 @@ jobs:
wait-for-completion: false
build-macos:
if: false
runs-on: macos-15
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
arch: mac-x86_64
- target: aarch64-apple-darwin
arch: mac-aarch64
llvm: ARM64
steps:
- uses: actions/checkout@v6
with:
@@ -147,13 +145,19 @@ jobs:
with:
target: ${{ matrix.target }}
rustflags: ""
- name: Set LLVM_VERSION
run: echo "LLVM_VERSION=$(rustc --version --verbose | grep "LLVM version" | cut -d':' -f2 | xargs)" >> $GITHUB_ENV
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: ${{ env.LLVM_VERSION }}
force-url: https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.LLVM_VERSION }}/LLVM-${{ env.LLVM_VERSION }}-macOS-${{ matrix.llvm }}.tar.xz
- name: Build
run: |
cargo build --release -v --target=${{ matrix.target }}
mkdir output
cp target/${{ matrix.target }}/release/gopher64 output/gopher64-${{ matrix.arch }}
env:
AR: ar
NETPLAY_ID: ${{ secrets.NETPLAY_ID }}
- name: Upload file
uses: actions/upload-artifact@v7
+13
View File
@@ -94,6 +94,19 @@ fn main() {
.set_icon("data/icon/icon.ico")
.compile()
.unwrap();
} else if os == "macos" {
println!("cargo:rustc-link-search=native=/opt/homebrew/opt/freetype/lib");
println!("cargo:rustc-link-lib=freetype");
let output = std::process::Command::new("clang")
.args(["--print-runtime-dir"])
.output()
.unwrap();
let runtime_dir = String::from_utf8_lossy(&output.stdout).trim().to_string();
println!("cargo:rustc-link-search=native={}", runtime_dir);
println!("cargo:rustc-link-lib=static=clang_rt.osx");
}
volk_build.flag("-flto=thin");