Merge remote-tracking branch 'origin/cmake-refactor' into integration_2023_w27

This commit is contained in:
Robert Schmidt
2023-07-08 13:29:55 +02:00
78 changed files with 398 additions and 742 deletions
-3
View File
@@ -102,9 +102,6 @@ find_package(Threads REQUIRED)
set (FIRMWARE_VERSION "No svn information")
add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
add_boolean_option(LINUX True "????")
add_boolean_option(ENB_MODE True "????") # to avoid backtrace
##########################
# NAS LAYER OPTIONS
##########################
+75 -212
View File
@@ -37,29 +37,18 @@ set_openair_env
gen_nvram_path=$OPENAIR_DIR/cmake_targets/ran_build/build
conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
XFORMS="True"
SKIP_SHARED_LIB_FLAG="False"
PRINT_STATS="False"
HW="None"
TP="Ethernet"
EPC=0
HW=""
VERBOSE_CI=0
VERBOSE_COMPILE=0
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"
RU=0
CMAKE_C_FLAGS=()
CMAKE_CXX_FLAGS=()
TARGET_LIST=""
function print_help() {
echo_info "
@@ -85,9 +74,6 @@ Options:
This option will require root password
--install-optional-packages
Install useful but not mandatory packages such as valgrind
-i | --install-system-files
Install OpenAirInterface required files in Linux system
This option will require root password
-g | --run-with-gdb <Release | RelWithDebInfo | MinSizeRel | Debug
specify the build mode used by cmake. defaults to Debug mode if -g is used alone, with no mode parameter
if -g is not specifies, Release mode is used.
@@ -180,8 +166,7 @@ function main() {
do
case "$1" in
--arch-native)
CMAKE_C_FLAGS+=("-march=native")
CMAKE_CXX_FLAGS+=("-march=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;;
-c | --clean)
CLEAN=1
@@ -211,10 +196,6 @@ function main() {
INSTALL_OPTIONAL=1
echo_info "Will install optional packages"
shift;;
-i | --install-system-files)
INSTALL_SYSTEM_FILES=1
echo_info "Will copy OpenAirInterface files in Linux directories"
shift;;
-g | --run-with-gdb)
case "$2" in
"Release")
@@ -250,23 +231,27 @@ function main() {
shift;;
--eNB)
eNB=1
TARGET_LIST="$TARGET_LIST lte-softmodem"
echo_info "Will compile eNB"
shift;;
--gNB)
gNB=1
TARGET_LIST="$TARGET_LIST nr-softmodem nr-cuup"
echo_info "Will compile gNB"
shift;;
--RU)
RU=1
TARGET_LIST="$TARGET_LIST oairu"
echo_info "Will compile RRU"
shift;;
--UE)
UE=1
TARGET_LIST="$TARGET_LIST lte-uesoftmodem"
echo_info "Will compile UE"
shift;;
--nrUE)
nrUE=1
rfsimNas=1
TARGET_LIST="$TARGET_LIST nr-uesoftmodem"
echo_info "Will compile NR UE"
shift;;
--mu)
@@ -280,30 +265,48 @@ function main() {
gen_nvram_path=$(readlink -f "$2")
shift 2;;
--UE-ip)
UE_ip=1
echo_info "Will compile UE"
TARGET_LIST="$TARGET_LIST ue_ip"
shift;;
-w | --hardware)
# Use OAI_USRP as the key word USRP is used inside UHD driver
case "$2" in
"USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "SIMU" | "AW2SORI")
"USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "SIMU")
HW="OAI_"$2
TARGET_LIST="$TARGET_LIST oai_${2,,}devif" # ,, makes lowercase
CMAKE_CMD="$CMAKE_CMD -DOAI_$2=ON"
;;
"AW2SORI")
HW="OAI_"$2
TARGET_LIST="$TARGET_LIST aw2sori_transpro"
CMAKE_CMD="$CMAKE_CMD -DOAI_$2=ON"
;;
"None")
HW="None"
;;
*)
echo_fatal "Unknown HW type $HW: exit..."
echo_fatal "Unknown hardware type $2: exit..."
;;
esac
echo_info "Setting hardware to: $HW"
#CMAKE_CMD="$CMAKE_CMD -DRF_BOARD=\"${HW}\""
CMAKE_CMD="$CMAKE_CMD -DRF_BOARD=${HW}"
shift 2;;
-t | --transport)
TP=$2
case "$2" in
"Ethernet")
TARGET_LIST="$TARGET_LIST oai_eth_transpro"
CMAKE_CMD="$CMAKE_CMD -DOAI_${2^^}=ON" # ^^ makes uppercase
;;
"benetel4g" | "benetel5g")
TARGET_LIST="$TARGET_LIST $2"
CMAKE_CMD="$CMAKE_CMD -DOAI_${2^^}=ON" # ^^ makes uppercase
;;
"None")
;;
*)
echo_fatal "Unknown transport type $2; exit..."
;;
esac
shift 2;;
-P | --phy_simulators)
SIMUS_PHY=1
# TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
TARGET_LIST="$TARGET_LIST dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim"
echo_info "Will compile dlsim, ulsim, ..."
shift;;
-s | --check)
@@ -318,11 +321,8 @@ function main() {
-V | --vcd)
echo_info "Setting gtk-wave output"
CMAKE_CMD="$CMAKE_CMD -DENABLE_VCD_FIFO=True"
EXE_ARGUMENTS="$EXE_ARGUMENTS -V"
shift;;
-x | --xforms)
XFORMS=1
EXE_ARGUMENTS="$EXE_ARGUMENTS -d"
echo_info "Will generate the software oscilloscope features"
shift;;
--verbose-ci)
@@ -338,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"
@@ -367,31 +363,23 @@ function main() {
echo_info "Downloading UHD images in the indicated location"
shift 2;;
--build-eclipse)
BUILD_ECLIPSE=1
CMAKE_CMD="$CMAKE_CMD"' -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -G"Eclipse CDT4 - Unix Makefiles"'
echo_info "Enabling build eclipse project support"
shift 1;;
--build-lib)
BUILD_OPTLIB=""
if [ "$2" == "all" ] ; then
BUILD_OPTLIB="$OPTIONAL_LIBRARIES"
TARGET_LIST="$TARGET_LIST $OPTIONAL_LIBRARIES"
for lib in $OPTIONAL_LIBRARIES; do CMAKE_CMD="$CMAKE_CMD -DENABLE_${lib^^}=ON"; done
echo_info "Enabling build of all optional shared libraries ($OPTIONAL_LIBRARIES)"
else
for alib in $2 ; do
for oklib in $OPTIONAL_LIBRARIES ; do
if [ "$alib" = "$oklib" ] ; then
BUILD_OPTLIB="$BUILD_OPTLIB $alib"
echo_info "Enabling build of lib${alib}.so"
fi
done
for reqlib in $2; do
lib=$(echo $OPTIONAL_LIBRARIES | tr ' ' '\n' | grep -w $reqlib) # search given parameter in list
[[ $? -ne 0 ]] && echo_fatal "Unknown optional library in $reqlib, valid libraries are $OPTIONAL_LIBRARIES"
TARGET_LIST="$TARGET_LIST $lib" # will append the found library
CMAKE_CMD="$CMAKE_CMD -DENABLE_${lib^^}=ON"
echo_info "Enabling build of optional shared library $lib"
done
if [ "${BUILD_OPTLIB## }" != "$2" ] ; then
echo_fatal "Unknown optional library in $2, valid libraries are $OPTIONAL_LIBRARIES"
fi
fi
for oklib in $BUILD_OPTLIB ; do
CMAKE_CMD="$CMAKE_CMD -DENABLE_${oklib^^}=ON"
done
shift 2;;
--noavx512)
CMAKE_CMD="$CMAKE_CMD -DAVX512=OFF"
@@ -401,13 +389,8 @@ function main() {
CMAKE_CMD="$CMAKE_CMD -DAVX2=OFF"
echo_info "Disabling AVX2 instructions"
shift 1;;
-k | --skip-shared-libraries)
SKIP_SHARED_LIB_FLAG="True"
echo_info "Skipping build of shared libraries, rfsimulator and transport protocol libraries"
shift;;
--ninja)
CMAKE_CMD="$CMAKE_CMD -GNinja"
MAKE_CMD=ninja
shift;;
--sanitize)
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True -DSANITIZE_UNDEFINED=True"
@@ -429,48 +412,15 @@ 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
########################################################
# Check validity of HW and TP parameters for eNB / gNB #
########################################################
# to be discussed
if [ "$eNB" = "1" -o "$gNB" = "1" ] ; then
if [ "$HW" = "None" -a "$TP" = "None" ] ; then
echo_info "No local radio head and no transport protocol selected"
fi
if [ "$HW" = "None" ] ; then
echo_info "No radio head has been selected (HW set to $HW)"
fi
if [ "$TP" = "None" ] ; then
echo_info "No transport protocol has been selected (TP set to $TP)"
fi
fi
echo_info "RF HW set to $HW"
# If the user doesn't specify the Linux scheduler to use, we set a value
#######################################################
# Setting and printing OAI envs, we should check here #
#######################################################
cecho "OPENAIR_DIR = $OPENAIR_DIR" $green
echo "OPENAIR_DIR = $OPENAIR_DIR"
if [ "$CLEAN_ALL" = "1" ] ; then
clean_all_files
echo_info "Erased all previously producted files"
echo "Erased all previously producted files"
fi
dlog=$OPENAIR_DIR/cmake_targets/log
@@ -507,134 +457,47 @@ function main() {
check_install_additional_tools
fi
execlist=""
[[ "$eNB" == "1" ]] && execlist="$execlist lte-softmodem"
[[ "$gNB" == "1" ]] && execlist="$execlist nr-softmodem nr-cuup"
[[ "$RU" == "1" ]] && execlist="$execlist oairu"
[[ "$UE" == 1 ]] && execlist="$execlist lte-uesoftmodem"
[[ "$nrUE" == 1 ]] && execlist="$execlist nr-uesoftmodem"
# TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
[[ "$SIMUS_PHY" == "1" ]] && execlist="$execlist dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim"
[[ "$BUILD_OPTLIB" != "" ]] && execlist="$execlist $BUILD_OPTLIB"
[[ "$execlist" != "" ]] && execlist="$execlist params_libconfig coding rfsimulator"
DIR=$OPENAIR_DIR/cmake_targets
[ "$CLEAN" = "1" ] && rm -rf $DIR/$BUILD_DIR/build
mkdir -p $DIR/$BUILD_DIR/build
cd $DIR/$BUILD_DIR/build
if [[ ${#CMAKE_C_FLAGS[@]} > 0 ]]; then CMAKE_CMD="$CMAKE_CMD -DCMAKE_C_FLAGS=\"${CMAKE_C_FLAGS[*]}\""; fi
if [[ ${#CMAKE_CXX_FLAGS[@]} > 0 ]]; then CMAKE_CMD="$CMAKE_CMD -DCMAKE_CXX_FLAGS=\"${CMAKE_CXX_FLAGS[*]}\""; fi
# for historical reasons we build in a subdirectory cmake_targets/XYZ/build,
# e.g., cmake_targets/ran_build/build, hence the ../../..
CMAKE_CMD="$CMAKE_CMD ../../.."
echo_info "running $CMAKE_CMD"
eval $CMAKE_CMD
if [[ "$execlist" != "" ]]; then
echo_info "Compiling $execlist..."
compilations $BUILD_DIR all.txt $execlist
fi
if [ "$UE" = 1 ] ; then
echo_info "Compiling UE specific part"
if [ "$UE_ip" = 1 ]
then
echo_info "Building ue_ip module"
compilations $BUILD_DIR ue_ip.txt ue_ip
else
echo_info "Bypassing ue_ip build"
fi #IS_CONTAINER
# mkdir -p $DIR/at_commands/build
# cd $DIR/at_commands/build
# eval $CMAKE_CMD
# compilations at_commands at_nas_ue
[ "$CLEAN" = "1" ] && rm -rf $DIR/nas_sim_tools/build
mkdir -p $DIR/nas_sim_tools/build
cd $DIR/nas_sim_tools/build
eval $CMAKE_CMD ..
compilations nas_sim_tools usim.txt usim
compilations nas_sim_tools nvram.txt nvram
compilations nas_sim_tools conf2uedata.txt conf2uedata
# generate USIM data
if [ -f conf2uedata ]; then
install_nas_tools $conf_nvram_path $DIR/$BUILD_DIR/build "$DIR/$BUILD_DIR/build/conf2uedata.txt"
else
echo_warning "not generated UE NAS files: binaries not found"
if [[ $TARGET_LIST != "" ]]; then
# add some default libraries that should always be built
# for eNB, gNB, UEs, simulators
if [[ $gNB == 1 || $eNB == 1 || $UE == 1 || $nrUE == 1 || $SIMUS_PHY == 1 || $RU == 1 ]]; then
TARGET_LIST="$TARGET_LIST params_libconfig coding rfsimulator dfts"
fi
fi
####################################################
# Build RF device and transport protocol libraries #
####################################################
if [ "$eNB" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$RU" = "1" -o "$nrUE" = "1" ] ; then
mkdir -p $DIR/$BUILD_DIR/build
cd $DIR/$BUILD_DIR/build
# build RF device libraries
if [ "$HW" != "None" ] ; then
rm -f liboai_device.so
# for historical reasons we build in a subdirectory cmake_targets/XYZ/build,
# e.g., cmake_targets/ran_build/build, hence the ../../..
CMAKE_CMD="$CMAKE_CMD ../../.."
echo_info "Running \"$CMAKE_CMD\""
eval $CMAKE_CMD
compilations $BUILD_DIR all.txt $TARGET_LIST
if [ "$HW" == "OAI_USRP" ] ; then
compilations $BUILD_DIR oai_usrpdevif.txt oai_usrpdevif
if [ "$UE" = 1 ] ; then
ln -sf liboai_usrpdevif.so liboai_device.so
echo_info "liboai_device.so is linked to USRP device library"
elif [ "$HW" == "OAI_BLADERF" ] ; then
if [ -f "/usr/include/libbladeRF.h" ] ; then
compilations $BUILD_DIR oai_bladerfdevif.txt oai_bladerfdevif
fi
echo_info "Compiling UE specific part"
ln -sf liboai_bladerfdevif.so liboai_device.so
echo_info "liboai_device.so is linked to BLADERF device library"
elif [ "$HW" == "OAI_LMSSDR" ] ; then
# if [ -f "/usr/include/libbladeRF.h" ] ; then
compilations $BUILD_DIR oai_lmssdrdevif.txt oai_lmssdrdevif
# fi
[ "$CLEAN" = "1" ] && rm -rf $DIR/nas_sim_tools/build
mkdir -p $DIR/nas_sim_tools/build
cd $DIR/nas_sim_tools/build
ln -sf liboai_lmssdrdevif.so liboai_device.so
echo_info "liboai_device.so is linked to LMSSDR device library"
elif [ "$HW" == "OAI_IRIS" ] ; then
compilations $BUILD_DIR oai_irisdevif.txt oai_irisdevif
eval $CMAKE_CMD ..
compilations nas_sim_tools usim.txt usim
compilations nas_sim_tools nvram.txt nvram
compilations nas_sim_tools conf2uedata.txt conf2uedata
ln -s liboai_irisdevif.so liboai_device.so
echo_info "liboai_device.so is linked to IRIS device library"
elif [ "$HW" == "OAI_AW2SORI" ] ; then
compilations $BUILD_DIR aw2sori_transpro.txt aw2sori_transpro
ln -sf libaw2sori_transpro.so libthirdparty_transpro.so
echo_info "build libthirdparty_transpro.so for AW2SORI fronthaul"
else
echo_info "liboai_device.so is not linked to any device library"
fi
fi
#build transport protocol libraries (currently only ETHERNET is available)
if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then
echo_info "Building transport protocol libraries"
rm -f liboai_transpro.so
if [ "$TP" == "Ethernet" ]; then
compilations $BUILD_DIR oai_eth_transpro.txt oai_eth_transpro
ln -sf liboai_eth_transpro.so liboai_transpro.so
echo_info "liboai_transpro.so is linked to ETHERNET transport"
fi
if [ "$TP" == "benetel4g" ]; then
compilations $BUILD_DIR benetel_4g.txt benetel4g
ln -sf libbenetel_4g.so liboai_transpro.so
echo_info "liboai_transpro.so is linked to BENETEL4G transport"
fi
if [ "$TP" == "benetel5g" ]; then
compilations $BUILD_DIR benetel_5g.txt benetel_5g
ln -sf libbenetel_5g.so liboai_transpro.so
echo_info "liboai_transpro.so is linked to BENETEL4G transport"
fi
# generate USIM data
if [ -f conf2uedata ]; then
install_nas_tools $conf_nvram_path $DIR/$BUILD_DIR/build "$DIR/$BUILD_DIR/build/conf2uedata.txt"
else
echo_warning "not generated UE NAS files: binaries not found"
fi
fi
fi
###################
@@ -646,7 +509,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
+8 -17
View File
@@ -216,35 +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
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