From 73b6ab047d350b347c66eda7ed4537317aaaed13 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Fri, 18 Oct 2024 20:33:46 +0300 Subject: [PATCH] make /bin/build.sh use clang if it can find it by default --- bin/build.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/build.sh b/bin/build.sh index ff7a922..97d5a51 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -5,8 +5,13 @@ if [ -x "$(command -v ninja)" ]; then generator="-G Ninja" fi -if [ "$1" = "web" ]; then - emcmake cmake $generator -B .build-web "${@:2}" && cmake --build .build-web --parallel -else - cmake $generator -B .build "$@" && cmake --build .build --parallel +# check whether clang is around (it's just better) +if [ -x "$(command -v clang)" ]; then + cc="-DCMAKE_C_COMPILER=clang" +fi + +if [ "$1" = "web" ]; then + emcmake cmake $generator $cc -B .build-web "${@:2}" && cmake --build .build-web --parallel +else + cmake $generator $cc -B .build "$@" && cmake --build .build --parallel fi