Skip to content

Commit dbc8a17

Browse files
authored
Use homebrew llvm@20 instead of apple clang (#6)
* Use homebrew llvm@20 instead of apple clang * Use homebrew xmake * fix * Install python3.13 to avoid compile python * Use force homebrew python * Install system package python setuptools * Install python-setuptools by homebrew * Use lld as linker * Use llvm-20 libtool * Change style
1 parent 9a8d105 commit dbc8a17

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

.github/workflows/macos.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,36 @@ jobs:
2222
cancel-in-progress: true
2323

2424
steps:
25+
- name: Setup llvm
26+
run: |
27+
brew install llvm@20
28+
29+
- name: Install lld
30+
run: |
31+
brew install lld@20
32+
33+
- name: Setup python
34+
run: |
35+
# avoid compile python
36+
brew install python@3.13
37+
brew install python-setuptools
38+
2539
- name: Checkout repository
2640
uses: actions/checkout@v4
2741

2842
- name: Setup xmake
29-
uses: xmake-io/github-action-setup-xmake@v1
30-
with:
31-
xmake-version: '2.9.9'
32-
actions-cache-folder: '.xmake-cache'
43+
run: |
44+
brew install xmake
45+
46+
# - name: Setup xmake
47+
# uses: xmake-io/github-action-setup-xmake@v1
48+
# with:
49+
# xmake-version: '2.9.9'
50+
# actions-cache-folder: '.xmake-cache'
3351

3452
- name: Package
3553
run: |
54+
export PATH="/opt/homebrew/opt/llvm@20/bin:/opt/homebrew/opt/lld@20/bin:$PATH"
3655
xmake config --yes --verbose --toolchain=clang --mode=${{ matrix.build_type }} --policies=build.optimization.lto:${{ matrix.lto }}
3756
3857
- name: Upload artifacts

xmake.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ package("llvm")
9292
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
9393
table.insert(configs, "-DLLVM_ENABLE_LTO=" .. (package:config("lto") and "ON" or "OFF"))
9494
if package:config("lto") then
95-
if package:is_plat("linux") then
95+
if package:is_plat("linux", "macosx") then
9696
table.insert(configs, "-DLLVM_USE_LINKER=lld")
9797
end
9898
end
@@ -111,6 +111,7 @@ package("llvm")
111111
if package:is_plat("macosx") then
112112
table.insert(configs, "-DLLVM_TARGETS_TO_BUILD=AArch64")
113113
table.insert(configs, "-DCMAKE_OSX_ARCHITECTURES=arm64")
114+
table.insert(configs, "-DCMAKE_LIBTOOL=/opt/homebrew/opt/llvm@20/bin/llvm-libtool-darwin")
114115
else
115116
table.insert(configs, "-DLLVM_TARGETS_TO_BUILD=X86")
116117
end
@@ -192,7 +193,7 @@ package("llvm")
192193
local archive_dirs
193194
if package:is_plat("windows") then
194195
archive_dirs = "*"
195-
elseif package:is_plat("linux") or package:is_plat("macosx") then
196+
elseif package:is_plat("linux", "macosx") then
196197
-- workaround for tar
197198
archive_dirs = {}
198199
for _, dir in ipairs(os.dirs(path.join(opt.curdir, "*"))) do

0 commit comments

Comments
 (0)