Skip to content

Commit 669b396

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=Generic ninja -C build install ```
1 parent a280fea commit 669b396

2 files changed

Lines changed: 1145 additions & 1 deletion

File tree

.azure-pipelines.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,24 @@ jobs:
5151
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"
5252
displayName: Install llvm-nm (Windows)
5353
condition: and(succeeded(), eq( variables['Agent.OS'], 'Windows_NT' ))
54-
- script: make -j4
54+
- bash: |
55+
echo "##vso[task.setvariable variable=LLVM_AR]$(which llvm-ar)"
56+
displayName: Find llvm-ar (!Windows)
57+
condition: and(succeeded(), not(eq(variables['Agent.OS'], 'Windows_NT')))
58+
- script: |
59+
echo ##vso[task.setvariable variable=LLVM_AR]%CD%\citools\clang-rust\bin\llvm-ar.exe
60+
displayName: Find llvm-ar (Windows)
61+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
62+
- task: CMake@1
63+
inputs:
64+
workingDirectory: $(Build.BinariesDirectory)
65+
cmakeArgs: -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_SYSTEM_NAME=Generic -DCMAKE_AR=$(LLVM_AR) -DCMAKE_C_COMPILER=clang -S $(Build.SourcesDirectory)
66+
displayName: Configure
67+
- task: CMake@1
68+
inputs:
69+
workingDirectory: $(Build.BinariesDirectory)
70+
cmakeArgs: --build .
5571
displayName: Build
72+
- publish: $(Build.BinariesDirectory)/sysroot
73+
artifact: wasi-libc
74+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))

0 commit comments

Comments
 (0)