From c0eba063766385a4529832bec4f57d35cb8f640f Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Fri, 26 Apr 2024 16:06:16 +0000 Subject: [PATCH] Have build.sh deal with cmake --- build.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index 42fb904..cf5dfb8 100755 --- a/build.sh +++ b/build.sh @@ -2,15 +2,21 @@ source compile-config -if [ $CROSS_COMPILE == "yes" ]; then - if [ $CROSS_COMPILER == "gcc" ]; then - CROSS_COMPILE_INSERT=-DCMAKE_TOOLCHAIN_FILE=../src/CMakeToolChainRPiGCC.txt - elif [ $CROSS_COMPILER == "clang" ]; then - CROSS_COMPILE_INSERT=-DCMAKE_TOOLCHAIN_FILE=../src/CMakeToolChainRPiClang.txt +if [ ! -d "build" ]; then + + if [ $CROSS_COMPILE == "yes" ]; then + if [ $CROSS_COMPILER == "gcc" ]; then + CROSS_COMPILE_INSERT=-DCMAKE_TOOLCHAIN_FILE=../src/CMakeToolChainRPiGCC.txt + elif [ $CROSS_COMPILER == "clang" ]; then + CROSS_COMPILE_INSERT=-DCMAKE_TOOLCHAIN_FILE=../src/CMakeToolChainRPiClang.txt + fi fi + + mkdir build + + cmake $CROSS_COMPILE_INSERT -DENABLE_MOLD=${ENABLE_MOLD} -DMOLD_BIN=${MOLD_BIN} \ + -DFORCE_COLOR=${FORCE_COLOR} -DALL_WARNINGS=${ALL_WARNINGS} -S src -B build + fi -mkdir build -cmake $CROSS_COMPILE_INSERT -DENABLE_MOLD=${ENABLE_MOLD} -DMOLD_BIN=${MOLD_BIN} \ - -DFORCE_COLOR=${FORCE_COLOR} -DALL_WARNINGS=${ALL_WARNINGS} \ - -S src -B build && make -C build -j$MAKE_J +make -C build -j$MAKE_J -- 2.39.5