-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·52 lines (42 loc) · 1.56 KB
/
build.sh
File metadata and controls
executable file
·52 lines (42 loc) · 1.56 KB
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
#!/bin/bash
# Build logic executed in CI. This is intentionally kept relatively minimal to
# one day not live in bash to have a bash-less build on Windows. For now though
# this will unconditionally build a toolchain and then optionally build a
# sysroot. Builders which can't actually execute the toolchain they produce
# skip the sysroot step below.
set -ex
# Optionally allow the first argument to this script to be the install
# location.
if [ "$1" = "" ]; then
build_dir=`pwd`/build
else
build_dir="$1"
fi
cmake -G Ninja -B $build_dir/toolchain -S . \
-DWASI_SDK_BUILD_TOOLCHAIN=ON \
-DCMAKE_BUILD_TYPE=MinSizeRel \
"-DCMAKE_INSTALL_PREFIX=$build_dir/install" \
$WASI_SDK_CI_TOOLCHAIN_CMAKE_ARGS \
"-DLLVM_CMAKE_FLAGS=$WASI_SDK_CI_TOOLCHAIN_LLVM_CMAKE_ARGS"
ninja -C $build_dir/toolchain install dist -v
mv $build_dir/toolchain/dist $build_dir/dist
if [ "$WASI_SDK_CI_SKIP_SYSROOT" = "1" ]; then
exit 0
fi
# Use the just-built toolchain and its `CMAKE_TOOLCHAIN_FILE` to build a
# sysroot.
cmake -G Ninja -B $build_dir/sysroot -S . \
"-DCMAKE_TOOLCHAIN_FILE=$build_dir/install/share/cmake/wasi-sdk.cmake" \
-DCMAKE_C_COMPILER_WORKS=ON \
-DCMAKE_CXX_COMPILER_WORKS=ON \
-DWASI_SDK_INCLUDE_TESTS=ON \
-DWASI_SDK_EXCEPTIONS=DUAL \
"-DCMAKE_INSTALL_PREFIX=$build_dir/install"
ninja -C $build_dir/sysroot install dist -v
mv $build_dir/sysroot/dist/* $build_dir/dist
if [ "$WASI_SDK_CI_SKIP_TESTS" = "1" ]; then
exit 0
fi
# Run tests to ensure that the sysroot works.
ctest --output-on-failure --parallel 10 --test-dir $build_dir/sysroot/tests \
--timeout 60