diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6bf500f..d27031e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -22,17 +22,36 @@ jobs: cancel-in-progress: true steps: + - name: Setup llvm + run: | + brew install llvm@20 + + - name: Install lld + run: | + brew install lld@20 + + - name: Setup python + run: | + # avoid compile python + brew install python@3.13 + brew install python-setuptools + - name: Checkout repository uses: actions/checkout@v4 - name: Setup xmake - uses: xmake-io/github-action-setup-xmake@v1 - with: - xmake-version: '2.9.9' - actions-cache-folder: '.xmake-cache' + run: | + brew install xmake + + # - name: Setup xmake + # uses: xmake-io/github-action-setup-xmake@v1 + # with: + # xmake-version: '2.9.9' + # actions-cache-folder: '.xmake-cache' - name: Package run: | + export PATH="/opt/homebrew/opt/llvm@20/bin:/opt/homebrew/opt/lld@20/bin:$PATH" xmake config --yes --verbose --toolchain=clang --mode=${{ matrix.build_type }} --policies=build.optimization.lto:${{ matrix.lto }} - name: Upload artifacts diff --git a/xmake.lua b/xmake.lua index c88a33b..9c853e0 100644 --- a/xmake.lua +++ b/xmake.lua @@ -92,7 +92,7 @@ package("llvm") table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) table.insert(configs, "-DLLVM_ENABLE_LTO=" .. (package:config("lto") and "ON" or "OFF")) if package:config("lto") then - if package:is_plat("linux") then + if package:is_plat("linux", "macosx") then table.insert(configs, "-DLLVM_USE_LINKER=lld") end end @@ -111,6 +111,7 @@ package("llvm") if package:is_plat("macosx") then table.insert(configs, "-DLLVM_TARGETS_TO_BUILD=AArch64") table.insert(configs, "-DCMAKE_OSX_ARCHITECTURES=arm64") + table.insert(configs, "-DCMAKE_LIBTOOL=/opt/homebrew/opt/llvm@20/bin/llvm-libtool-darwin") else table.insert(configs, "-DLLVM_TARGETS_TO_BUILD=X86") end @@ -192,7 +193,7 @@ package("llvm") local archive_dirs if package:is_plat("windows") then archive_dirs = "*" - elseif package:is_plat("linux") or package:is_plat("macosx") then + elseif package:is_plat("linux", "macosx") then -- workaround for tar archive_dirs = {} for _, dir in ipairs(os.dirs(path.join(opt.curdir, "*"))) do