Skip to content

Commit fbf2cb4

Browse files
ci: setup linux build. (#4)
1 parent 1a28a84 commit fbf2cb4

File tree

2 files changed

+73
-11
lines changed

2 files changed

+73
-11
lines changed

.github/workflows/build-linux.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build (Linux)
2+
3+
on:
4+
push:
5+
paths:
6+
- .github/workflows/build-linux.yml
7+
- src/**
8+
- xmake.lua
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
strategy:
14+
matrix:
15+
mode: [debug, release]
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
# - name: Prepare works
22+
# run: |
23+
# mkdir ./.xmake-dest
24+
25+
- name: Restore build cache
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/.xmake
30+
./.xmake-dest
31+
key: xmake-linux-${{ hashFiles('xmake.lua') }}
32+
restore-keys: |
33+
xmake-linux-
34+
35+
- name: Setup XMake
36+
uses: xmake-io/github-action-setup-xmake@v1
37+
with:
38+
xmake-version: '2.9.8'
39+
actions-cache-folder: './.xmake-dest'
40+
41+
- name: Install build dependencies
42+
run: |
43+
sudo apt install -y build-essential llvm-19-dev libclang-19-dev
44+
45+
# workaround to switch llvm version.
46+
sudo mv /usr/include/clang /usr/include/clang-compiler
47+
sudo ln -s /usr/lib/llvm-19/bin/llvm-config /usr/bin/llvm-config
48+
sudo ln -s /usr/include/llvm-19/llvm /usr/include/llvm
49+
sudo ln -s /usr/include/llvm-c-19/llvm-c /usr/include/llvm-c
50+
sudo ln -s /usr/lib/llvm-19/include/clang /usr/include/clang
51+
sudo ln -s /usr/lib/llvm-19/include/clang-c /usr/include/clang-c
52+
53+
54+
- name: Configure
55+
run: |
56+
# c++23 <print> requires gcc 14.
57+
xmake f -a x64 -m ${{ matrix.mode }} -p linux --toolchain=gcc-14 -v -y
58+
59+
- name: Build
60+
run: |
61+
xmake -v -y
62+
63+
- name: Upload Artifact
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: debuginfo-${{ matrix.mode }}-linux-x64-${{ github.sha }}
67+
path: |
68+
build/linux/x64/${{ matrix.mode }}

xmake.lua

+5-11
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ target('libdi')
6363
remove_files('src/tools/**')
6464
set_basename('di')
6565

66+
add_ldflags('$(shell llvm-config --libs)') -- xrepo llvm bug?
67+
6668
add_packages(
67-
'nlohmann_json'
69+
'xxhash',
70+
'nlohmann_json',
71+
'llvm'
6872
)
6973

7074
target('askrva')
@@ -111,27 +115,17 @@ target('extractsym')
111115
set_pcxxheader('src/pch.h')
112116

113117
add_packages(
114-
'llvm',
115118
'nlohmann_json',
116119
'argparse'
117120
)
118121

119-
if is_plat('linux') then -- workaround to fix link problem.
120-
add_links('LLVM')
121-
end
122-
123122
target('makepdb')
124123
set_kind('binary')
125124
add_deps('libdi')
126125
add_files('src/tools/makepdb/**.cpp')
127126
set_pcxxheader('src/pch.h')
128127

129128
add_packages(
130-
'llvm',
131129
'nlohmann_json',
132130
'argparse'
133131
)
134-
135-
if is_plat('linux') then
136-
add_links('LLVM')
137-
end

0 commit comments

Comments
 (0)