Skip to content

Commit 3fd855b

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 -DCMAKE_MODULE_PATH=cmake/Modules ninja -C build install ```
1 parent a280fea commit 3fd855b

File tree

3 files changed

+1133
-1
lines changed

3 files changed

+1133
-1
lines changed

.azure-pipelines.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ jobs:
3131
echo "##vso[task.prependpath]$CLANG_DIR"
3232
displayName: Install clang (OSX)
3333
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
34+
- bash: |
35+
set -euo pipefail
36+
curl -Ls https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip -o ninja-mac.zip
37+
unzip ninja-mac.zip
38+
sudo cp -v ninja /usr/local/bin/
39+
displayName: Install Ninja (OSX)
40+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
3441
- bash: |
3542
set -euo pipefail
3643
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 -
@@ -51,5 +58,12 @@ jobs:
5158
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"
5259
displayName: Install llvm-nm (Windows)
5360
condition: and(succeeded(), eq( variables['Agent.OS'], 'Windows_NT' ))
54-
- script: make -j4
61+
- task: CMake@1
62+
inputs:
63+
workingDirectory: $(Build.BinariesDirectory)/wasi-libc
64+
cmakeArgs: cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=clang -DCMAKE_SYSTEM_NAME=wasi -DCMAKE_MODULE_PATH=$(Build.SourcesDirectory)/cmake/Modules $(Build.SourcesDirectory)
65+
displayName: Configure
66+
- task: CMake@1
67+
inputs:
68+
cmakeArgs: cmake --build $(Build.BinariesDirectory)/wasi-libc
5569
displayName: Build

0 commit comments

Comments
 (0)