mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user