From b099c0ae047cb84ed7f44762a9ee92bb80f23cce Mon Sep 17 00:00:00 2001 From: Julian Waller Date: Thu, 24 Oct 2024 08:55:44 +0100 Subject: [PATCH] fix: build macos with xcode llvm (#905) --- .github/workflows/CI.yaml | 7 +------ .github/workflows/skia.yaml | 6 ++---- scripts/build-skia.js | 10 ++++++++++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index d3de970c..e598d944 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -69,10 +69,9 @@ jobs: settings: - host: macos-latest target: 'x86_64-apple-darwin' - setup: brew install nasm llvm + setup: brew install nasm build: | rustc --print target-cpus - export PATH="/opt/homebrew/opt/llvm/bin:$PATH" clang --version yarn build --target x86_64-apple-darwin downloadTarget: '' @@ -100,11 +99,8 @@ jobs: - host: macos-latest downloadTarget: 'aarch64-apple-darwin' target: 'aarch64-apple-darwin' - setup: | - brew install llvm build: | export MACOSX_DEPLOYMENT_TARGET='11.0' - export PATH="/opt/homebrew/opt/llvm/bin:$PATH" clang --version yarn build --target aarch64-apple-darwin - host: ubuntu-latest @@ -606,7 +602,6 @@ jobs: - name: Test run: | - export PATH="/opt/homebrew/opt/llvm/bin:$PATH" clang --version cargo test -- --nocapture diff --git a/.github/workflows/skia.yaml b/.github/workflows/skia.yaml index 5e585393..548406e8 100644 --- a/.github/workflows/skia.yaml +++ b/.github/workflows/skia.yaml @@ -48,7 +48,7 @@ jobs: shell: bash - name: Install tools on macOS - run: brew install ninja llvm + run: brew install ninja if: matrix.os == 'macos-latest' - name: Install tools on Windows @@ -83,7 +83,6 @@ jobs: env: PYTHONHTTPSVERIFY: 0 run: | - export PATH="/opt/homebrew/opt/llvm/bin:$PATH" clang --version node ./scripts/build-skia.js --target=x86_64-apple-darwin @@ -130,11 +129,10 @@ jobs: shell: bash - name: Install tools on macOS - run: brew install ninja llvm + run: brew install ninja - name: Compile skia run: | - export PATH="/opt/homebrew/opt/llvm/bin:$PATH" clang --version node ./scripts/build-skia.js --target=aarch64-apple-darwin env: diff --git a/scripts/build-skia.js b/scripts/build-skia.js index 0d4b03a8..bbca58b3 100644 --- a/scripts/build-skia.js +++ b/scripts/build-skia.js @@ -220,6 +220,16 @@ switch (TARGET_TRIPLE) { ExtraSkiaBuildFlag += ' target_cpu="x64" target_os="mac"' ExtraCflagsCC += ',"-Wno-psabi"' } + ExtraCflagsCC += ', "-mmacosx-version-min=10.13"' + ExtraLdFlags = ' "-mmacosx-version-min=10.13"' + ExtraAsmFlags = '"-mmacosx-version-min=10.13"' + ExtraCflags = '"-mmacosx-version-min=10.13"' + GN_ARGS.push( + `extra_ldflags=[${ExtraLdFlags}]`, + `extra_asmflags=[${ExtraAsmFlags}]`, + `extra_cflags=[${ExtraCflags}]`, + `extra_cflags_c=[${ExtraCflags}]`, + ) break case '': break