8
8
9
9
jobs :
10
10
llvm :
11
- runs-on : ubuntu-22.04
11
+ strategy :
12
+ matrix :
13
+ include :
14
+ - target : aarch64-linux-gnu
15
+ os : ubuntu-latest
16
+ - target : aarch64-apple-darwin
17
+ os : macos-latest
18
+ - target : x86_64-linux-gnu
19
+ os : ubuntu-latest
20
+ - target : x86_64-apple-darwin
21
+ os : macos-latest
22
+ runs-on : ${{ matrix.os }}
12
23
name : llvm
13
24
outputs :
14
25
cache-key : ${{ steps.cache-key.outputs.cache-key }}
30
41
key : ${{ steps.cache-key.outputs.cache-key }}
31
42
lookup-only : true
32
43
33
- - name : Install Tools
34
- if : steps.cache-llvm.outputs.cache-hit != 'true'
44
+ - name : Install Tools (Linux)
45
+ if : steps.cache-llvm.outputs.cache-hit != 'true' && matrix.os == 'ubuntu-latest'
35
46
run : |
36
47
set -euxo pipefail
37
48
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
43
54
sudo apt update
44
55
sudo apt -y install cmake ninja-build clang lld
45
56
57
+ - name : Install Tools (macOS)
58
+ if : steps.cache-llvm.outputs.cache-hit != 'true' && matrix.os == 'macos-latest'
59
+ run : |
60
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
61
+ echo "/usr/local/bin/brew" >> $GITHUB_PATH
62
+ brew install cmake ninja
63
+
46
64
- name : Checkout LLVM Source
47
65
if : steps.cache-llvm.outputs.cache-hit != 'true'
48
66
uses : actions/checkout@v4
@@ -55,22 +73,28 @@ jobs:
55
73
if : steps.cache-llvm.outputs.cache-hit != 'true'
56
74
run : |
57
75
set -euxo pipefail
76
+ LLVM_USE_LINKER_OPTION=""
77
+ if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
78
+ LLVM_USE_LINKER_OPTION="-DLLVM_USE_LINKER=lld"
79
+ fi
58
80
cmake \
59
81
-S llvm-project/llvm \
60
82
-B llvm-build \
61
83
-G Ninja \
62
84
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
63
85
-DCMAKE_C_COMPILER=clang \
64
86
-DCMAKE_CXX_COMPILER=clang++ \
65
- -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/llvm-install" \
87
+ -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/llvm-install/${{ matrix.target }} " \
66
88
-DLLVM_BUILD_LLVM_DYLIB=ON \
89
+ -DLLVM_DEFAULT_TARGET_TRIPLE=${{ matrix.target }} \
67
90
-DLLVM_ENABLE_ASSERTIONS=ON \
68
91
-DLLVM_ENABLE_PROJECTS= \
69
92
-DLLVM_ENABLE_RUNTIMES= \
93
+ -DLLVM_HOST_TRIPLE=${{ matrix.target }} \
70
94
-DLLVM_INSTALL_UTILS=ON \
71
95
-DLLVM_LINK_LLVM_DYLIB=ON \
72
96
-DLLVM_TARGETS_TO_BUILD=BPF \
73
- -DLLVM_USE_LINKER=lld
97
+ $LLVM_USE_LINKER_OPTION
74
98
75
99
- name : Install LLVM
76
100
if : steps.cache-llvm.outputs.cache-hit != 'true'
0 commit comments