Skip to content

Use homebrew llvm@20 instead of apple clang #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading