forked from LuisaGroup/LuisaCompute
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (141 loc) · 5.48 KB
/
build-cmake.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: build-cmake
on: [ push, pull_request ]
jobs:
build-linux:
strategy:
fail-fast: false
matrix:
compiler: [ gcc, clang ]
config: [ Release, Debug ]
include:
- os: ubuntu-24.04
arch: x86_64
- os: ubuntu-24.04-arm
arch: aarch64
name: ${{ matrix.config }} / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Install Dependencies"
run: |
sudo apt-get update
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18 all
sudo apt-get -y install build-essential wget cmake ninja-build uuid-dev libxinerama-dev libxcursor-dev libxi-dev libvulkan-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: "Download CUDA Keyring (ubuntu-24.04)"
if: matrix.os == 'ubuntu-24.04'
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
- name: "Download CUDA Keyring (ubuntu-24.04-arm)"
if: matrix.os == 'ubuntu-24.04-arm'
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/sbsa/cuda-keyring_1.1-1_all.deb
- name: "Setup CUDA"
run: |
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-12.8
sudo apt-get -y clean # save some space
- name: "Setup Vulkan"
uses: johnnynunez/setup-vulkan-sdk@v1
with:
vulkan-query-version: 1.4.304.1
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: "Configure and Build"
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
export LUISA_CC=gcc
export LUISA_CXX=g++
export LUISA_FLAGS=""
else
export LUISA_CC=clang-18
export LUISA_CXX=clang++-18
export LUISA_FLAGS="-stdlib=libc++"
fi
cmake -S . -B build -G Ninja -D LUISA_COMPUTE_ENABLE_RUST=OFF -D LUISA_COMPUTE_ENABLE_REMOTE=OFF -D LUISA_COMPUTE_ENABLE_CPU=OFF -D CMAKE_BUILD_TYPE=${{ matrix.config }} -D CMAKE_C_COMPILER=${LUISA_CC} -D CMAKE_CXX_COMPILER=${LUISA_CXX} -D CMAKE_CXX_FLAGS="${LUISA_FLAGS}"
cmake --build build -j 16
- name: "Install"
run: |
if [ "${{ matrix.config }}" = "Release" ]; then
cmake --install build --prefix dist -v
fi
build-macos:
strategy:
fail-fast: false
matrix:
compiler: [ homebrew-clang, system-clang ]
config: [ Release, Debug ]
name: macOS / ${{ matrix.config }} / ${{ matrix.compiler }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Install Dependencies"
run: |
brew install llvm molten-vk ninja cmake
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: "Configure and Build"
run: |
if [ "${{ matrix.compiler }}" = "homebrew-clang" ]; then
export CC=/opt/homebrew/opt/llvm/bin/clang
export CXX=/opt/homebrew/opt/llvm/bin/clang++
fi
cmake -S . -B build -G Ninja -D LUISA_COMPUTE_ENABLE_RUST=OFF -D LUISA_COMPUTE_ENABLE_REMOTE=OFF -D LUISA_COMPUTE_ENABLE_CPU=OFF -D CMAKE_BUILD_TYPE=${{ matrix.config }} -D LUISA_COMPUTE_ENABLE_UNITY_BUILD=OFF
cmake --build build -v
- name: "Install"
run: |
if [ "${{ matrix.config }}" = "Release" ]; then
cmake --install build --prefix dist -v
fi
build-windows:
strategy:
fail-fast: false
matrix:
config: [ Release, Debug ]
compiler: [ cl, clang, clang-cl ]
name: Windows / ${{ matrix.config }} / ${{ matrix.compiler }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Setup Ninja"
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.11.1
- name: "Setup CUDA"
uses: Jimver/[email protected]
with:
cuda: 12.8.0
- name: "Setup Rust"
uses: actions-rust-lang/[email protected]
- name: "Setup Vulkan"
uses: johnnynunez/setup-vulkan-sdk@v1
with:
vulkan-query-version: 1.4.304.1
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: "Configure and Build"
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake --version
ninja --version
IF "${{ matrix.compiler }}" == "clang" (
set CC=clang
set CXX=clang++
) ELSE (
set CC=${{ matrix.compiler }}
set CXX=${{ matrix.compiler }}
)
cmake -S . -G Ninja -B build -D LUISA_COMPUTE_ENABLE_RUST=OFF -D LUISA_COMPUTE_ENABLE_REMOTE=OFF -D LUISA_COMPUTE_ENABLE_CPU=OFF -D CMAKE_BUILD_TYPE=${{ matrix.config }}
cmake --build build -v
- name: "Install"
run: |
cmake --install build --prefix dist -v