From 61edf8a8129b0ff373ad3699355095a1e0e4e4fd Mon Sep 17 00:00:00 2001 From: William Yang Date: Thu, 11 Jan 2024 10:41:27 +0100 Subject: [PATCH] build: use ninja if possbile --- .gitignore | 1 + build.sh | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 066f0c22..1105f506 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ erl_crash.dump .concrete/DEV_MODE .DS_Store +.cache # rebar 2.x .rebar diff --git a/build.sh b/build.sh index 69ee0121..3ad9cd88 100755 --- a/build.sh +++ b/build.sh @@ -9,15 +9,23 @@ PKGNAME="$(./pkgname.sh)" build() { # default: 4 concurrent jobs JOBS=4 + # if Ninja is installed, use it + if command -v ninja; then + GENERATOR=Ninja + MakeCmd=ninja + else + GENERATOR="Unix Makefiles" + MakeCmd=make + fi if [ "$(uname -s)" = 'Darwin' ]; then JOBS="$(sysctl -n hw.ncpu)" else JOBS="$(nproc)" fi ./get-msquic.sh "$MSQUIC_VERSION" - cmake -B c_build - make -j "$JOBS" -C c_build - make install -C c_build + cmake -B c_build -G "${GENERATOR}" + $MakeCmd -C c_build -j "$JOBS" + $MakeCmd -C c_build install ## MacOS if [ -f priv/libquicer_nif.dylib ]; then # https://developer.apple.com/forums/thread/696460