Skip to content

Commit 1bb6545

Browse files
committed
Enable building only compiler-rt
1 parent 279ed19 commit 1bb6545

3 files changed

Lines changed: 51 additions & 7 deletions

File tree

.github/workflows/main.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525
- artifact: x86_64-linux
2626
os: ubuntu-24.04
2727
env:
28-
WASI_SDK_CI_SKIP_SYSROOT: 1
28+
WASI_SDK_CI_COMPILER_RT_ONLY: 1
2929

3030
- artifact: arm64-linux
3131
os: ubuntu-22.04-arm
3232
env:
33-
WASI_SDK_CI_SKIP_SYSROOT: 1
33+
WASI_SDK_CI_COMPILER_RT_ONLY: 1
3434

3535
- artifact: riscv64-linux
3636
os: ubuntu-24.04
@@ -51,7 +51,7 @@ jobs:
5151
os: macos-14
5252
rust_target: aarch64-apple-darwin
5353
env:
54-
WASI_SDK_CI_SKIP_SYSROOT: 1
54+
WASI_SDK_CI_COMPILER_RT_ONLY: 1
5555
WASI_SDK_CI_TOOLCHAIN_LLVM_CMAKE_ARGS: >-
5656
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.12
5757
-DCMAKE_OSX_ARCHITECTURES=arm64
@@ -60,20 +60,20 @@ jobs:
6060
os: macos-14
6161
rust_target: x86_64-apple-darwin
6262
env:
63-
WASI_SDK_CI_SKIP_SYSROOT: 1
63+
WASI_SDK_CI_COMPILER_RT_ONLY: 1
6464
WASI_SDK_CI_TOOLCHAIN_LLVM_CMAKE_ARGS: >-
6565
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.12
6666
-DCMAKE_OSX_ARCHITECTURES=x86_64
6767
6868
- artifact: x86_64-windows
6969
os: windows-2022
7070
env:
71-
WASI_SDK_CI_SKIP_SYSROOT: 1
71+
WASI_SDK_CI_COMPILER_RT_ONLY: 1
7272

7373
- artifact: arm64-windows
7474
os: windows-11-arm
7575
env:
76-
WASI_SDK_CI_SKIP_SYSROOT: 1
76+
WASI_SDK_CI_COMPILER_RT_ONLY: 1
7777

7878
env: ${{ matrix.env || fromJSON('{}') }}
7979
steps:
@@ -181,6 +181,44 @@ jobs:
181181
path: ${{ runner.tool_cache }}/ccache
182182
key: 0-cache-${{ matrix.artifact }}-${{ github.run_id }}
183183

184+
build-only-sysroot:
185+
name: Build only sysroot - ${{ matrix.name }}
186+
runs-on: ubuntu-24.04
187+
strategy:
188+
matrix:
189+
include:
190+
- name: default
191+
- name: exceptions
192+
defines: -DWASI_SDK_EXCEPTIONS=ON
193+
- name: static
194+
defines: -DWASI_SDK_BUILD_SHARED=OFF
195+
steps:
196+
- uses: actions/checkout@v6
197+
with:
198+
fetch-depth: 0
199+
- uses: ./.github/actions/checkout
200+
- uses: ./.github/actions/install-deps
201+
- run: cargo install wasm-component-ld@0.5.21
202+
- name: Install LLVM 22
203+
run: |
204+
v=22
205+
rel=$(lsb_release -cs)
206+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/keyrings/llvm.asc
207+
echo "deb [signed-by=/etc/apt/keyrings/llvm.asc] http://apt.llvm.org/$rel/ llvm-toolchain-$rel-$v main" | sudo tee /etc/apt/sources.list.d/llvm-$v.list
208+
sudo apt-get update -y && sudo apt-get install -y clang-$v lld-$v
209+
- run: |
210+
cmake -G Ninja -B build -S . \
211+
-DCMAKE_C_COMPILER=/usr/lib/llvm-22/bin/clang \
212+
-DCMAKE_SYSTEM_NAME=WASI \
213+
-DWASI_SDK_INCLUDE_TESTS=ON \
214+
-DWASI_SDK_CPU_CFLAGS="" \
215+
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=OFF \
216+
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=OFF \
217+
${{ matrix.defines }}
218+
- run: ninja -C build
219+
- run: ctest --output-on-failure --parallel 10 --test-dir build/tests
220+
221+
184222
# Once all of the above matrix entries have completed this job will run and
185223
# assemble the final `wasi-sdk-*` artifacts by fusing the toolchain/sysroot
186224
# artifacts.

ci/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ cmake -G Ninja -B $build_dir/sysroot -S . \
3838
-DCMAKE_CXX_COMPILER_WORKS=ON \
3939
-DWASI_SDK_INCLUDE_TESTS=ON \
4040
-DWASI_SDK_EXCEPTIONS=DUAL \
41+
-DWASI_SDK_COMPILER_RT_ONLY=$([ "$WASI_SDK_CI_COMPILER_RT_ONLY" = "1" ] && echo "ON" || echo "OFF") \
4142
"-DCMAKE_INSTALL_PREFIX=$build_dir/install"
4243
ninja -C $build_dir/sysroot install dist -v
4344

cmake/wasi-sdk-sysroot.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ option(WASI_SDK_INCLUDE_TESTS "Whether or not to build tests by default" OFF)
3030
option(WASI_SDK_INSTALL_TO_CLANG_RESOURCE_DIR "Whether or not to modify the compiler's resource directory" OFF)
3131
option(WASI_SDK_LTO "Whether or not to build LTO assets" ON)
3232
option(WASI_SDK_BUILD_SHARED "Whether or not to build shared libraries when supported" ON)
33+
option(WASI_SDK_COMPILER_RT_ONLY "Whether or not to build only compiler-rt" OFF)
3334
set(WASI_SDK_EXCEPTIONS "${EXCEPTIONS_DEFAULT}" CACHE STRING "Whether or not C++ exceptions are enabled")
3435
set(WASI_SDK_CPU_CFLAGS "-mcpu=lime1" CACHE STRING "CFLAGS to specify wasm features to enable")
3536

@@ -440,7 +441,11 @@ endif()
440441
add_custom_target(build ALL)
441442
foreach(target IN LISTS WASI_SDK_TARGETS)
442443
add_custom_target(build-${target})
443-
add_dependencies(build-${target} libcxx-${target} wasi-libc-${target} compiler-rt)
444+
if (WASI_SDK_COMPILER_RT_ONLY)
445+
add_dependencies(build-${target} compiler-rt)
446+
else()
447+
add_dependencies(build-${target} libcxx-${target} wasi-libc-${target} compiler-rt)
448+
endif()
444449
add_dependencies(build build-${target})
445450
endforeach()
446451

0 commit comments

Comments
 (0)