From 4db08dc68a281fa065d266c5e67b5a498108be97 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sun, 18 Jun 2023 04:13:32 +0200 Subject: [PATCH] Simplify compilations build helper Instead of using ninja/make directly, there is a cmake command option to trigger the build using whatever build tool has been configured. Use it; if there is a mismatch, there will also be a clearer cmake error. Remove build_oai's --build-coverity: we don't use it, and it can trivially be added if required (probably, most users would run it by hand anyway). Add an error if the compilations function is not called with the right noumber of arguments. --- cmake_targets/build_oai | 22 +--------------------- cmake_targets/tools/build_helper | 26 ++++++++------------------ 2 files changed, 9 insertions(+), 39 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index b1debfbf7d..8c9dbccda8 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -49,11 +49,9 @@ RUN_GROUP=0 TEST_CASE_GROUP="" BUILD_DIR=ran_build BUILD_DOXYGEN=0 -BUILD_COVERITY_SCAN=0 DISABLE_HARDWARE_DEPENDENCY="False" CMAKE_BUILD_TYPE="RelWithDebInfo" CMAKE_CMD="$CMAKE" -MAKE_CMD=make BUILD_ECLIPSE=0 NR="False" OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope nrqtscope ldpc_cuda ldpc_t1 websrv oai_iqplayer" @@ -340,10 +338,6 @@ function main() { BUILD_DOXYGEN=1 echo_info "Will build doxygen support" shift;; - --build-coverity-scan) - BUILD_COVERITY_SCAN=1 - echo_info "Will build Coverity-Scan objects for upload" - shift;; --disable-T-Tracer) CMAKE_CMD="$CMAKE_CMD -DT_TRACER=False" echo_info "Disabling the T tracer" @@ -409,7 +403,6 @@ function main() { shift;; --ninja) CMAKE_CMD="$CMAKE_CMD -GNinja" - MAKE_CMD=ninja shift;; --sanitize) CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True -DSANITIZE_UNDEFINED=True" @@ -431,19 +424,6 @@ function main() { esac done - ################################### - # Check if cov-build is installed # - ################################### - if [ "$BUILD_COVERITY_SCAN" == "1" ] ; then - echo_info "Checking cov-build is installed" - IS_INSTALLED=`which cov-build | grep -c cov-build || true` - if [ $IS_INSTALLED -eq 1 ] ; then - echo_info "Found cov-build" - else - echo_fatal "Did NOT find cov-build in PATH!" - fi - fi - ####################################################### # Setting and printing OAI envs, we should check here # ####################################################### @@ -612,7 +592,7 @@ function main() { echo_info "Doxygen generation log is located here: $doxygen_log" echo_info "Generating Doxygen files....please wait" ( - $MAKE_CMD doc + cmake --build . --target doc ) >& $doxygen_log fi diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 9d1e03dec4..d12c63486b 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -216,36 +216,26 @@ check_errors() { } compilations() { + [[ $# -gt 2 ]] || echo_fatal "compilations needs more than three arguments" local dir=$1 shift 1 local logfile=$1 shift 1 local targets=$@ + local verbose=$([ "$VERBOSE_COMPILE" == "1" ] && echo "-v" || echo "") + echo cd $OPENAIR_DIR/cmake_targets/$dir/build cd $OPENAIR_DIR/cmake_targets/$dir/build - cecho "Running \"$MAKE_CMD $targets\"" $green - echo_info "Log file for compilation is being written to: $dlog/$logfile" + echo_info "Running \"cmake --build . $verbose --target $targets -- -j$(nproc)\"" $green + echo "Log file for compilation is being written to: $dlog/$logfile" set +e { - if [ "$BUILD_COVERITY_SCAN" == "1" ]; then - COV_SCAN_PREFIX="cov-build --dir cov-int" - else - COV_SCAN_PREFIX="" - fi - if [ "$MAKE_CMD" != "" ]; then - $MAKE_CMD $targets - else - if [ "$VERBOSE_COMPILE" == "1" ]; then - $COV_SCAN_PREFIX make -j`nproc` $targets VERBOSE=$VERBOSE_COMPILE - else - $COV_SCAN_PREFIX make -j`nproc` $targets - fi - fi + cmake --build . $verbose --target $targets -- -j$(nproc) ret=$? } > $dlog/$logfile 2>&1 if [ "$VERBOSE_CI" == "1" ]; then - echo_info "====== Start of log for $logfile ======" + echo "====== Start of log for $logfile ======" cat $dlog/$logfile - echo_info "====== End of log for $logfile ======" + echo "====== End of log for $logfile ======" fi check_warnings "$dlog/$logfile" if [[ $ret -eq 0 ]]; then