build_oai: add --build-tool-opt to pass options to build tool

There are command line options that one might pass to ninja/make, but
for which cmake does not provide an interface. For instance, make/ninja
support -k/-kN to "keep going" after errors. Cmake does not provide an
option, but it is still possible to pass this. Make a build_oai option
to allow this, used in the next commit.
This commit is contained in:
Robert Schmidt
2024-11-29 16:15:09 +01:00
parent 03946cd47b
commit a89aab8d84
2 changed files with 17 additions and 11 deletions
+7 -7
View File
@@ -208,20 +208,20 @@ check_errors() {
}
compilations() {
[[ $# -gt 2 ]] || echo_fatal "compilations needs more than three arguments"
[[ $# -eq 4 ]] || echo_fatal "compilations <dir> <logfile> <targets> <build-tool-opt>"
local dir=$1
shift 1
local logfile=$1
shift 1
local targets=$@
local logfile=$2
local targets=$3
local build_tool_opt=$4
local verbose=$([ "$VERBOSE_COMPILE" == "1" ] && echo "-v" || echo "")
echo cd $OPENAIR_DIR/cmake_targets/$dir/build
cd $OPENAIR_DIR/cmake_targets/$dir/build
echo_info "Running \"$CMAKE --build . $verbose --target $targets -- -j$(nproc)\"" $green
cmd="$CMAKE --build . ${verbose} --target ${targets} -- ${build_tool_opt}"
echo_info "Running \"${cmd}\"" $green
echo "Log file for compilation is being written to: $dlog/$logfile"
set +e
{
$CMAKE --build . $verbose --target $targets -- -j$(nproc)
eval ${cmd}
ret=$?
} > $dlog/$logfile 2>&1
# Print the errors and warnings for CI purposes