Commit 4db08dc6 authored by Robert Schmidt's avatar Robert Schmidt

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.
parent b896da85
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment