Add a -v option to build.sh

This allows for a verbose build, where the commands being called
are displayed.
This commit is contained in:
Joerg Wunsch
2024-03-12 20:54:21 +01:00
parent f9b959343e
commit d34324ceed

View File

@@ -31,6 +31,7 @@ usage()
echo "Syntax: build.sh -h -f <flags> -j <num>" echo "Syntax: build.sh -h -f <flags> -j <num>"
echo "Options" echo "Options"
echo "-h Display this usage information and exit" echo "-h Display this usage information and exit"
echo "-v Verbose build"
echo "-f <flags> Extra build flags to pass to cmake" echo "-f <flags> Extra build flags to pass to cmake"
echo "-j <num> Run num build jobs in parallel" echo "-j <num> Run num build jobs in parallel"
echo echo
@@ -40,14 +41,19 @@ ostype=$(uname | tr '[A-Z]' '[a-z]')
build_flags="" build_flags=""
cmake_build="cmake --build ." cmake_build="cmake --build ."
verbose=""
jopt=""
while getopts :hf:j: OPT; do while getopts :hf:j:v OPT; do
case "$OPT" in case "$OPT" in
f) f)
build_flags="$OPTARG" build_flags="$OPTARG"
;; ;;
j) j)
cmake_build="cmake --build . -- -j$OPTARG"; jopt="-- -j$OPTARG"
;;
v)
verbose="-v"
;; ;;
h | *) h | *)
usage usage
@@ -57,6 +63,7 @@ while getopts :hf:j: OPT; do
done done
shift $((OPTIND-1)) # remove parsed options and args from $@ list shift $((OPTIND-1)) # remove parsed options and args from $@ list
cmake_build="$cmake_build $verbose $jopt"
build_type=RelWithDebInfo build_type=RelWithDebInfo
# build_type=Release # no debug info # build_type=Release # no debug info