forked from WebAssembly/wasi-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-llvm.sh
executable file
·44 lines (40 loc) · 1.58 KB
/
build-llvm.sh
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
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
set -e
mkdir -p $SCRIPT_DIR/build/install
cd $SCRIPT_DIR/build
export CC="$SCRIPT_DIR/wasi-sdk-new/bin/clang --sysroot=$SCRIPT_DIR/wasi-sdk-new/share/wasi-sysroot -Wl,-z,stack-size=33554432 -Wl,--stack-first"
export CXX="$SCRIPT_DIR/wasi-sdk-new/bin/clang++ --sysroot=$SCRIPT_DIR/wasi-sdk-new/share/wasi-sysroot -Wl,-z,stack-size=33554432 -Wl,--stack-first"
echo
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=$SCRIPT_DIR/build/install \
-DLLVM_TARGETS_TO_BUILD=WebAssembly \
-DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-wasi \
-DLLVM_ENABLE_PROJECTS="lld;clang" \
-DDEFAULT_SYSROOT=$SCRIPT_DIR/build/install/share/wasi-sysroot \
-DCMAKE_CROSSCOMPILING=True \
-DLLVM_TABLEGEN=$SCRIPT_DIR/wasi-sdk-src/build/llvm/bin/llvm-tblgen \
-DCLANG_TABLEGEN=$SCRIPT_DIR/wasi-sdk-src/build/llvm/bin/clang-tblgen \
-DLLVM_TARGET_ARCH=wasm32 \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_BUILD_DOCS=OFF \
-DLLVM_BUILD_INSTRUMENTED_COVERAGE=OFF \
-DLLVM_BUILD_LLVM_DYLIB=OFF \
-DLLVM_BUILD_TESTS=OFF \
-DLLVM_ENABLE_DOXYGEN=OFF \
-DLLVM_ENABLE_EH=OFF \
-DLLVM_ENABLE_MODULES=OFF \
-DLLVM_ENABLE_RTTI=OFF \
-DLLVM_ENABLE_SPHINX=OFF \
-DLLVM_ENABLE_THREADS=OFF \
-DLLVM_ENABLE_UNWIND_TABLES=OFF \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_BUILD_BENCHMARKS=OFF \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_LINK_LLVM_DYLIB=OFF \
-DCMAKE_SKIP_BUILD_RPATH=ON \
$SCRIPT_DIR/wasi-sdk-src/src/llvm-project/llvm
ninja -v install-clang install-lld