From fd76ef5187758c1c2f0c848972a373191805197f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20De=20Keersmaeker?= <francois.dekeersmaeker@uclouvain.be> Date: Wed, 2 Oct 2024 08:36:03 +0000 Subject: [PATCH] CMake: updated build --- build.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index 9fc78b1..e549af9 100755 --- a/build.sh +++ b/build.sh @@ -1,14 +1,13 @@ #!/bin/bash # Build the project. -# Usage: build.sh [-C working_directory] [-t cmake_toolchain_file] +# Usage: build.sh [-C working_directory] [-t cmake_toolchain_file] [-d device] # -C working_directory: The directory to build the project in. # -t cmake_toolchain_file: The CMake toolchain file to use. # Default values WORKING_DIRECTORY="" CMAKE_TOOLCHAIN_FILE="" -DEVICE="" # Print usage information usage() { @@ -17,7 +16,7 @@ usage() { } # Parse command line arguments -while getopts "C:t:" opt; +while getopts "C:t:d:" opt; do case "${opt}" in C) @@ -46,13 +45,16 @@ fi # Clean directory rm -rf build bin -# Build project -mkdir build bin -cd build +## Set environmental variables +ENV_VARS="" +# CMake toolchain file if [[ $CMAKE_TOOLCHAIN_FILE ]] then - cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE .. -else - cmake .. + ENV_VARS="$ENV_VARS -DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE" fi + +# Build project +mkdir build bin +cd build +cmake $ENV_VARS .. cmake --build . -- GitLab