Skip to content

Commit 96dab69

Browse files
committed
build: add cmake based build infrastructure
Rather than rely on make, use CMake to generate the rules in the build system of choice. This allows building with `make` or `ninja`, and enables building the WASI libc on Windows. ``` cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=clang -DCMAKE_SYSTEM_NAME=wasi ninja -C build install ```
1 parent a280fea commit 96dab69

File tree

2 files changed

+1130
-6
lines changed

2 files changed

+1130
-6
lines changed

.azure-pipelines.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ jobs:
3333
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
3434
- bash: |
3535
set -euo pipefail
36-
curl -f http://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz | tar xJf -
37-
export CLANG_DIR=`pwd`/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/bin
38-
echo "##vso[task.prependpath]$CLANG_DIR"
39-
displayName: Install clang (Linux)
36+
sudo apt-get -y install ninja-build
37+
displayName: Install Ninja (Linux)
4038
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
4139
- bash: |
4240
# Windows releases of LLVM don't include the llvm-nm tool, which is needed for building
@@ -51,5 +49,9 @@ jobs:
5149
echo "##vso[task.setvariable variable=WASM_NM;]$(rustc --print sysroot|sed 's|C:|/c|'|sed 's|\\|/|g')/lib/rustlib/x86_64-pc-windows-msvc/bin/llvm-nm.exe"
5250
displayName: Install llvm-nm (Windows)
5351
condition: and(succeeded(), eq( variables['Agent.OS'], 'Windows_NT' ))
54-
- script: make -j4
55-
displayName: Build
52+
- script: |
53+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=clang -S $(Build.SourcesDirectory) -B $(Build.BinariesDirectory)
54+
cmake --build $(Build.BinariesDirectory)
55+
- publish: $(Build.BinariesDirectory)/sysroot
56+
artifact: wasi-libc
57+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))

0 commit comments

Comments
 (0)