Skip to content

Commit de49d1f

Browse files
authored
Merge pull request #8 from clice-io/21.1.4
Update llvm1 to 21.1.4
2 parents ee743e3 + 47aa93c commit de49d1f

File tree

4 files changed

+77
-60
lines changed

4 files changed

+77
-60
lines changed

.github/workflows/linux.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: linux
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66

77
jobs:
88
build:
@@ -12,10 +12,10 @@ jobs:
1212
include:
1313
- build_type: debug
1414
lto: "n"
15-
- build_type: release
15+
- build_type: releasedbg
1616
lto: "n"
17-
- build_type: release
18-
lto: "y"
17+
# - build_type: releasedbg
18+
# lto: "y"
1919

2020
concurrency:
2121
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-linux-${{ matrix.build_type }}-${{ matrix.lto }}
@@ -37,8 +37,26 @@ jobs:
3737
- name: Setup xmake
3838
uses: xmake-io/github-action-setup-xmake@v1
3939
with:
40-
xmake-version: '2.9.9'
41-
actions-cache-folder: '.xmake-cache'
40+
xmake-version: "2.9.9"
41+
actions-cache-folder: ".xmake-cache"
42+
43+
- name: Increase Swap Space
44+
run: |
45+
echo "===== Initial Status ====="
46+
sudo swapon --show
47+
free -h
48+
49+
echo "===== Creating Swap File ====="
50+
sudo swapoff -a
51+
sudo fallocate -l 16G /mnt/swapfile
52+
sudo chmod 600 /mnt/swapfile
53+
sudo mkswap /mnt/swapfile
54+
sudo swapon /mnt/swapfile
55+
56+
echo "===== Final Status ====="
57+
sudo swapon --show
58+
free -h
59+
df -h
4260
4361
- name: Package
4462
run: |

.github/workflows/macos.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: macos
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66

77
jobs:
88
build:
@@ -12,10 +12,10 @@ jobs:
1212
include:
1313
- build_type: debug
1414
lto: "n"
15-
- build_type: release
15+
- build_type: releasedbg
1616
lto: "n"
17-
- build_type: release
18-
lto: "y"
17+
# - build_type: releasedbg
18+
# lto: "y"
1919

2020
concurrency:
2121
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-macos-${{ matrix.build_type }}-${{ matrix.lto }}
@@ -24,11 +24,7 @@ jobs:
2424
steps:
2525
- name: Setup llvm
2626
run: |
27-
brew install llvm@20
28-
29-
- name: Install lld
30-
run: |
31-
brew install lld@20
27+
brew install llvm@20 lld@20
3228
3329
- name: Setup python
3430
run: |
@@ -43,14 +39,9 @@ jobs:
4339
run: |
4440
brew install xmake
4541
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'
51-
5242
- name: Package
5343
run: |
44+
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
5445
export PATH="/opt/homebrew/opt/llvm@20/bin:/opt/homebrew/opt/lld@20/bin:$PATH"
5546
xmake config --yes --verbose --toolchain=clang --mode=${{ matrix.build_type }} --policies=build.optimization.lto:${{ matrix.lto }}
5647

.github/workflows/windows.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ name: windows
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66

77
jobs:
88
build:
99
runs-on: windows-2025
1010
strategy:
1111
matrix:
1212
include:
13-
- build_type: release
13+
- build_type: releasedbg
1414
runtimes: MD
1515
lto: "n"
16-
- build_type: release
17-
runtimes: MT
18-
lto: "y"
16+
# - build_type: releasedbg
17+
# runtimes: MT
18+
# lto: "y"
1919

2020
concurrency:
2121
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-windows-${{ matrix.build_type }}-${{ matrix.lto }}
@@ -28,12 +28,12 @@ jobs:
2828
- name: Setup xmake
2929
uses: xmake-io/github-action-setup-xmake@v1
3030
with:
31-
xmake-version: '2.9.9'
32-
actions-cache-folder: '.xmake-cache'
31+
xmake-version: "2.9.9"
32+
actions-cache-folder: ".xmake-cache"
3333

3434
- name: Package
3535
run: |
36-
xmake config --yes --verbose --runtimes=${{ matrix.runtimes }} --policies=build.optimization.lto:${{ matrix.lto }}
36+
xmake config --yes --verbose --mode=${{ matrix.build_type }} --runtimes=${{ matrix.runtimes }} --policies=build.optimization.lto:${{ matrix.lto }}
3737
3838
- name: Upload artifacts
3939
uses: actions/upload-artifact@v4

xmake.lua

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set_policy("compatibility.version", "3.0")
33
add_requires("llvm", {
44
system = false,
55
configs = {
6+
mode = get_config("mode"),
67
debug = is_mode("debug"),
78
shared = is_mode("debug") and not is_plat("windows"),
89
},
@@ -14,21 +15,20 @@ local sparse_checkout_list = {
1415
"clang",
1516
"clang-tools-extra",
1617
}
17-
-- Enable asan
18-
if is_mode("debug") then
19-
table.insert(sparse_checkout_list, "runtimes")
20-
table.insert(sparse_checkout_list, "compiler-rt")
21-
end
18+
19+
-- TODO: If we need compiler-rt builtin-headers, then we need to enable them.
20+
-- if is_mode("debug") then
21+
-- table.insert(sparse_checkout_list, "runtimes")
22+
-- table.insert(sparse_checkout_list, "compiler-rt")
23+
-- end
2224

2325
package("llvm")
24-
set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/llvm-project-$(version).src.tar.xz",
25-
"https://github.com/llvm/llvm-project.git", {includes = sparse_checkout_list})
26+
add_urls("https://github.com/llvm/llvm-project.git", {alias = "git", includes = sparse_checkout_list})
2627

27-
add_versions("20.1.5", "a069565cd1c6aee48ee0f36de300635b5781f355d7b3c96a28062d50d575fa3e")
28+
add_versions("git:21.1.4", "llvmorg-21.1.4")
29+
add_versions("git:20.1.5", "llvmorg-20.1.5")
2830

29-
if is_plat("windows") then
30-
add_configs("debug", {description = "Enable debug symbols.", default = false, type = "boolean", readonly = true})
31-
end
31+
add_configs("mode", {description = "Build type", default = "releasedbg", type = "string", values = {"debug", "release", "releasedbg"}})
3232

3333
if is_plat("windows", "mingw") then
3434
add_syslinks("version", "ntdll")
@@ -75,6 +75,7 @@ package("llvm")
7575
"-DLLVM_INCLUDE_BENCHMARKS=OFF",
7676

7777
-- "-DCLANG_BUILD_TOOLS=OFF",
78+
-- "-DLLVM_INCLUDE_TOOLS=OFF",
7879
"-DLLVM_BUILD_TOOLS=OFF",
7980
"-DLLVM_BUILD_UTILS=OFF",
8081
"-DCLANG_ENABLE_CLANGD=OFF",
@@ -86,34 +87,41 @@ package("llvm")
8687
"-DLLVM_LINK_LLVM_DYLIB=OFF",
8788
"-DLLVM_ENABLE_RTTI=OFF",
8889

89-
-- "-DLLVM_ENABLE_PROJECTS=clang",
90+
"-DLLVM_PARALLEL_LINK_JOBS=1",
91+
92+
-- Build job and link job together will oom
93+
"-DCMAKE_JOB_POOL_LINK=console",
94+
95+
"-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra",
96+
97+
-- Only build native target
98+
"-DLLVM_TARGETS_TO_BUILD=Native"
9099
}
91-
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
100+
101+
local build_type = {
102+
["debug"] = "Debug",
103+
["release"] = "Release",
104+
["releasedbg"] = "RelWithDebInfo",
105+
}
106+
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (build_type[package:config("mode")]))
92107
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
93108
table.insert(configs, "-DLLVM_ENABLE_LTO=" .. (package:config("lto") and "ON" or "OFF"))
94-
if package:config("lto") then
95-
if package:is_plat("linux", "macosx") then
96-
table.insert(configs, "-DLLVM_USE_LINKER=lld")
97-
end
109+
110+
if package:config("mode") == "debug" then
111+
table.insert(configs, "-DLLVM_USE_SANITIZER=Address")
98112
end
113+
99114
if package:is_plat("windows") then
100115
table.insert(configs, "-DCMAKE_C_COMPILER=clang-cl")
101116
table.insert(configs, "-DCMAKE_CXX_COMPILER=clang-cl")
102-
end
103-
if package:is_debug() then
104-
table.insert(configs, "-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra")
105-
table.insert(configs, "-DLLVM_ENABLE_RUNTIMES=compiler-rt")
106-
table.insert(configs, "-DLLVM_USE_SANITIZER=Address")
107-
else
108-
table.insert(configs, "-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra")
109-
end
110-
111-
if package:is_plat("macosx") then
112-
table.insert(configs, "-DLLVM_TARGETS_TO_BUILD=AArch64")
117+
elseif package:is_plat("linux") then
118+
table.insert(configs, "-DLLVM_USE_LINKER=lld")
119+
-- table.insert(configs, "-DLLVM_USE_SPLIT_DWARF=ON")
120+
elseif package:is_plat("macosx") then
113121
table.insert(configs, "-DCMAKE_OSX_ARCHITECTURES=arm64")
114122
table.insert(configs, "-DCMAKE_LIBTOOL=/opt/homebrew/opt/llvm@20/bin/llvm-libtool-darwin")
115-
else
116-
table.insert(configs, "-DLLVM_TARGETS_TO_BUILD=X86")
123+
table.insert(configs, "-DLLVM_USE_LINKER=lld")
124+
table.insert(configs, "-DLLVM_ENABLE_LIBCXX=ON")
117125
end
118126

119127
local opt = {}
@@ -176,7 +184,7 @@ package("llvm")
176184
package:arch(),
177185
package:plat(),
178186
abi,
179-
package:is_debug() and "debug" or "release",
187+
package:config("mode"),
180188
}, "-")
181189

182190
if package:config("lto") then

0 commit comments

Comments
 (0)