diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index e2aa1384d6..5e1ad1467e 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -48,6 +48,7 @@ CMAKE_BUILD_TYPE="RelWithDebInfo" CMAKE_CMD="$CMAKE" OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope ldpc_cuda ldpc_t2 websrv oai_iqplayer imscope" TARGET_LIST="" +BUILD_TOOL_OPT="-j$(nproc)" function print_help() { echo_info " @@ -56,6 +57,8 @@ for a number of distributions (Ubuntu 22-24, Fedora, RHEL9). Options: --arch-native Passes -march=native to the compiler. +--build-tool-opt + Pass options to build tool (ninja/make), e.g. -k (\"keep going\") -c | --clean Erase all files to make a rebuild from start -C | --clean-all @@ -160,6 +163,9 @@ function main() { --arch-native) echo_fatal "Error: specify --arch-native on the command line to cmake directly: ./build_oai --cmake-opt \"-DCMAKE_C_FLAGS=-march=native -DCMAKE_CXX_FLAGS=-march=native\"" shift;; + --build-tool-opt) + BUILD_TOOL_OPT+=" $2" + shift 2;; -c | --clean) CLEAN=1 shift;; @@ -490,7 +496,7 @@ function main() { CMAKE_CMD="$CMAKE_CMD ../../.." echo_info "Running \"$CMAKE_CMD\"" eval $CMAKE_CMD - compilations $BUILD_DIR all.txt $TARGET_LIST + compilations $BUILD_DIR all.txt "$TARGET_LIST" "${BUILD_TOOL_OPT}" ################### # Doxygen Support # ################### @@ -513,9 +519,9 @@ function main() { cd $DIR/nas_sim_tools/build ${CMAKE_CMD% *} .. - compilations nas_sim_tools usim.txt usim - compilations nas_sim_tools nvram.txt nvram - compilations nas_sim_tools conf2uedata.txt conf2uedata + compilations nas_sim_tools usim.txt "usim" "${BUILD_TOOL_OPT}" + compilations nas_sim_tools nvram.txt "nvram" "${BUILD_TOOL_OPT}" + compilations nas_sim_tools conf2uedata.txt "conf2uedata" "${BUILD_TOOL_OPT}" # generate USIM data if [ -f conf2uedata ]; then diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index dfb0b5a95e..13c8e4efde 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -208,20 +208,20 @@ check_errors() { } compilations() { - [[ $# -gt 2 ]] || echo_fatal "compilations needs more than three arguments" + [[ $# -eq 4 ]] || echo_fatal "compilations " 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