Use ninja generator when using cmake (#42)

Ninja has many advantages.  The motivating one is automatic parallelism
according to number of cores on the machine.
pull/28/head
Sam Clegg 6 years ago committed by Pat Hickey
parent 3d88cae36b
commit c6c0061b79

@ -7,4 +7,5 @@ RUN apt-get update \
cmake \ cmake \
python \ python \
git \ git \
ninja-build \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*

@ -17,7 +17,7 @@ clean:
build/llvm.BUILT: build/llvm.BUILT:
mkdir -p build/llvm mkdir -p build/llvm
cd build/llvm; cmake -G "Unix Makefiles" \ cd build/llvm; cmake -G Ninja \
-DCMAKE_BUILD_TYPE=MinSizeRel \ -DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=$(PREFIX) \ -DCMAKE_INSTALL_PREFIX=$(PREFIX) \
-DLLVM_TARGETS_TO_BUILD=WebAssembly \ -DLLVM_TARGETS_TO_BUILD=WebAssembly \
@ -27,7 +27,7 @@ build/llvm.BUILT:
-DLLVM_ENABLE_PROJECTS="lld;clang" \ -DLLVM_ENABLE_PROJECTS="lld;clang" \
-DDEFAULT_SYSROOT=$(PREFIX)/share/wasi-sysroot \ -DDEFAULT_SYSROOT=$(PREFIX)/share/wasi-sysroot \
$(LLVM_PROJ_DIR)/llvm $(LLVM_PROJ_DIR)/llvm
cd build/llvm; $(MAKE) \ ninja -v -C build/llvm \
install-clang \ install-clang \
install-lld \ install-lld \
install-llc \ install-llc \
@ -48,7 +48,7 @@ build/wasi-libc.BUILT: build/llvm.BUILT
build/compiler-rt.BUILT: build/llvm.BUILT build/compiler-rt.BUILT: build/llvm.BUILT
mkdir -p build/compiler-rt mkdir -p build/compiler-rt
cd build/compiler-rt; cmake -G "Unix Makefiles" \ cd build/compiler-rt; cmake -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_TOOLCHAIN_FILE=$(ROOT_DIR)/wasi-sdk.cmake \ -DCMAKE_TOOLCHAIN_FILE=$(ROOT_DIR)/wasi-sdk.cmake \
-DCOMPILER_RT_BAREMETAL_BUILD=On \ -DCOMPILER_RT_BAREMETAL_BUILD=On \
@ -64,13 +64,13 @@ build/compiler-rt.BUILT: build/llvm.BUILT
-DCMAKE_INSTALL_PREFIX=$(PREFIX)/lib/clang/$(CLANG_VERSION)/ \ -DCMAKE_INSTALL_PREFIX=$(PREFIX)/lib/clang/$(CLANG_VERSION)/ \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
$(LLVM_PROJ_DIR)/compiler-rt/lib/builtins $(LLVM_PROJ_DIR)/compiler-rt/lib/builtins
cd build/compiler-rt; $(MAKE) install ninja -v -C build/compiler-rt install
cp -R $(ROOT_DIR)/build/llvm/lib/clang $(PREFIX)/lib/ cp -R $(ROOT_DIR)/build/llvm/lib/clang $(PREFIX)/lib/
touch build/compiler-rt.BUILT touch build/compiler-rt.BUILT
build/libcxx.BUILT: build/llvm.BUILT build/compiler-rt.BUILT build/wasi-libc.BUILT build/libcxx.BUILT: build/llvm.BUILT build/compiler-rt.BUILT build/wasi-libc.BUILT
mkdir -p build/libcxx mkdir -p build/libcxx
cd build/libcxx; cmake -G "Unix Makefiles" \ cd build/libcxx; cmake -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=$(ROOT_DIR)/wasi-sdk.cmake \ -DCMAKE_TOOLCHAIN_FILE=$(ROOT_DIR)/wasi-sdk.cmake \
-DLLVM_CONFIG_PATH=$(ROOT_DIR)/build/llvm/bin/llvm-config \ -DLLVM_CONFIG_PATH=$(ROOT_DIR)/build/llvm/bin/llvm-config \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
@ -93,14 +93,14 @@ build/libcxx.BUILT: build/llvm.BUILT build/compiler-rt.BUILT build/wasi-libc.BUI
-DCMAKE_CXX_FLAGS="$(DEBUG_PREFIX_MAP)" \ -DCMAKE_CXX_FLAGS="$(DEBUG_PREFIX_MAP)" \
--debug-trycompile \ --debug-trycompile \
$(LLVM_PROJ_DIR)/libcxx $(LLVM_PROJ_DIR)/libcxx
cd build/libcxx; $(MAKE) install ninja -v -C build/libcxx install
# libc++abi.a doesn't do a multiarch install, so fix it up. # libc++abi.a doesn't do a multiarch install, so fix it up.
mv $(PREFIX)/share/wasi-sysroot/lib/libc++.a $(PREFIX)/share/wasi-sysroot/lib/wasm32-wasi/ mv $(PREFIX)/share/wasi-sysroot/lib/libc++.a $(PREFIX)/share/wasi-sysroot/lib/wasm32-wasi/
touch build/libcxx.BUILT touch build/libcxx.BUILT
build/libcxxabi.BUILT: build/libcxx.BUILT build/llvm.BUILT build/libcxxabi.BUILT: build/libcxx.BUILT build/llvm.BUILT
mkdir -p build/libcxxabi mkdir -p build/libcxxabi
cd build/libcxxabi; cmake -G "Unix Makefiles" \ cd build/libcxxabi; cmake -G Ninja \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_CXX_COMPILER_WORKS=ON \ -DCMAKE_CXX_COMPILER_WORKS=ON \
-DCMAKE_C_COMPILER_WORKS=ON \ -DCMAKE_C_COMPILER_WORKS=ON \
@ -126,7 +126,7 @@ build/libcxxabi.BUILT: build/libcxx.BUILT build/llvm.BUILT
-DUNIX:BOOL=ON \ -DUNIX:BOOL=ON \
--debug-trycompile \ --debug-trycompile \
$(LLVM_PROJ_DIR)/libcxxabi $(LLVM_PROJ_DIR)/libcxxabi
cd build/libcxxabi; $(MAKE) install ninja -v -C build/libcxxabi install
# libc++abi.a doesn't do a multiarch install, so fix it up. # libc++abi.a doesn't do a multiarch install, so fix it up.
mv $(PREFIX)/share/wasi-sysroot/lib/libc++abi.a $(PREFIX)/share/wasi-sysroot/lib/wasm32-wasi/ mv $(PREFIX)/share/wasi-sysroot/lib/libc++abi.a $(PREFIX)/share/wasi-sysroot/lib/wasm32-wasi/
touch build/libcxxabi.BUILT touch build/libcxxabi.BUILT

Loading…
Cancel
Save