ODULOW CI Support and Information
Added example_odulow_build.txt, build_ci.sh and updated Makefile to illustrate on how
to get the odulow fhi_lib dependencies, setup global variables for shell scripts and
makefiles to build fhi_lib using gcc.
Change-Id: Ib992f45857d9d32ccecb95cc9cee0e2f20b26e93
Signed-off-by: Luis Farias <luis.farias@intel.com>
diff --git a/example_odulow_build.txt b/example_odulow_build.txt
new file mode 100644
index 0000000..8ef4f8d
--- /dev/null
+++ b/example_odulow_build.txt
@@ -0,0 +1,44 @@
+#! /bin/bash
+# This is an example on how the different dependencies of the odulow fhi_lib can be brought into a build server
+# which currently is the only module being built under odulow.
+# In the example illustrated here we use a Centos OS in the server so the user should adopt the proper procedures
+# for their target OS if it is different than Centos
+cd /etc/yum.repos.d/
+mkdir backup;
+mv *.repo backup;
+
+curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
+yum makecache
+
+yum install vim gcc-c++ libhugetlbfs* libstdc++* kernel-devel numa* gcc git mlocate xorg-x11-server-Xorg -y
+cd /home
+mkdir odu_low_test
+cd /home/odu_low_test
+
+wget http://fast.dpdk.org/rel/dpdk-18.08.1.tar.xz
+xz -d dpdk-18.08.1.tar.xz
+tar -xvf dpdk-18.08.1.tar
+mv dpdk-stable-18.08.1 dpdk-18.08
+
+cd dpdk-18.08/usertools/
+
+./dpdk-setup.sh<<EOF
+15
+35
+EOF
+
+# After the dependencies have been brought in we can clone the ORAN repository, this step requires the user to provide credentials
+git clone "https://gerrit.o-ran-sc.org/r/o-du/phy"
+#
+# The next step is to define the global variables used by the continous integration build shell script
+# and the odulow Front Haul Library makefile
+# In this example we are building the fhi_lib using gcc and the testapp is not being built.
+
+export XRAN_DIR=/home/odu_low_test/phy/fhi_lib
+export RTE_SDK=/home/odu_low_test/dpdk-18.08
+export RTE_TARGET=x86_64-native-linuxapp-gcc
+export BUILD_GCC=1
+cd phy/fhi_lib
+chmod 777 build_ci.sh
+./build_ci.sh
+
diff --git a/fhi_lib/lib/Makefile b/fhi_lib/lib/Makefile
index 7b33916..2977afc 100644
--- a/fhi_lib/lib/Makefile
+++ b/fhi_lib/lib/Makefile
@@ -24,11 +24,18 @@
##############################################################
# Tools configuration
##############################################################
+ifeq ($(BUILD_GCC),)
CC := icc
+LD := icc
+else
+CC := gcc
+LD := gcc
+endif
+
CPP := icpc
AS := as
AR := ar
-LD := icc
+
OBJDUMP := objdump
ifeq ($(SHELL),cmd.exe)
@@ -77,8 +84,8 @@
$(SRC_DIR)/xran_app_frag.c \
$(SRC_DIR)/xran_main.c
-CPP_SRC = $(SRC_DIR)/xran_compression.cpp
-
+#CPP_SRC = $(SRC_DIR)/xran_compression.cpp
+ifeq ($(BUILD_GCC),)
CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \
-fdata-sections \
-ffunction-sections \
@@ -91,6 +98,35 @@
-no-prec-div -fp-model fast=2\
-no-prec-sqrt -falign-functions=16 -fast-transcendentals \
-Werror -Wno-unused-variable -std=c++11 -mcmodel=large
+else
+CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations -Wextra \
+ -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
+ -Wold-style-definition -Wpointer-arith -Wcast-align -Wnested-externs \
+ -Wcast-qual -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings \
+ -Wdeprecated -Wunused-parameter -Wunused-variable\
+ -fdata-sections \
+ -ffunction-sections \
+ -g \
+ -Wimplicit-function-declaration \
+ -m64 \
+ -pthread \
+ -march=native \
+ -DRTE_MACHINE_CPUFLAG_SSE \
+ -DRTE_MACHINE_CPUFLAG_SSE2 \
+ -DRTE_MACHINE_CPUFLAG_SSE3 \
+ -DRTE_MACHINE_CPUFLAG_SSSE3 \
+ -DRTE_MACHINE_CPUFLAG_SSE4_1 \
+ -DRTE_MACHINE_CPUFLAG_SSE4_2 \
+ -DRTE_MACHINE_CPUFLAG_AES \
+ -DRTE_MACHINE_CPUFLAG_PCLMULQDQ \
+ -DRTE_MACHINE_CPUFLAG_AVX \
+ -DRTE_MACHINE_CPUFLAG_RDRAND \
+ -DRTE_MACHINE_CPUFLAG_FSGSBASE \
+ -DRTE_MACHINE_CPUFLAG_F16C \
+ -DRTE_MACHINE_CPUFLAG_AVX2 \
+ -I$(API_DIR) -I$(ETH_DIR) -I$(MLOG_DIR)/source -I$(RTE_INC) -g -O3 \
+ -DALLOW_EXPERIMENTAL_API
+endif
INC := -I$(API_DIR) -I$(ETH_DIR) -I$(SRC_DIR) -I$(RTE_INC)
DEF :=
diff --git a/fhi_lib/lib/build_ci.sh b/fhi_lib/lib/build_ci.sh
new file mode 100644
index 0000000..4d49143
--- /dev/null
+++ b/fhi_lib/lib/build_ci.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+#/******************************************************************************
+#*
+#* Copyright (c) 2019 Intel.
+#*
+#* Licensed under the Apache License, Version 2.0 (the "License");
+#* you may not use this file except in compliance with the License.
+#* You may obtain a copy of the License at
+#*
+#* http://www.apache.org/licenses/LICENSE-2.0
+#*
+#* Unless required by applicable law or agreed to in writing, software
+#* distributed under the License is distributed on an "AS IS" BASIS,
+#* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#* See the License for the specific language governing permissions and
+#* limitations under the License.
+#*
+#*******************************************************************************/
+#
+# Please see example_odu_fhi_lib_build.txt to find how to set up the global variables used by this script
+# and the fhi_lib makefile
+
+XRAN_FH_LIB_DIR=$XRAN_DIR/lib
+XRAN_FH_APP_DIR=$XRAN_DIR/app
+XRAN_FH_TEST_DIR=$XRAN_DIR/test/test_xran
+LIBXRANSO=0
+MLOG=0
+COMMAND_LINE=
+
+echo Number of commandline arguments: $#
+while [[ $# -ne 0 ]]
+do
+key="$1"
+
+#echo Parsing: $key
+case $key in
+ LIBXRANSO)
+ LIBXRANSO=1
+ ;;
+ MLOG)
+ MLOG=1
+ ;;
+ xclean)
+ COMMAND_LINE+=$key
+ COMMAND_LINE+=" "
+ ;;
+ *)
+ echo $key is unknown command # unknown option
+ ;;
+esac
+shift # past argument or value
+done
+
+if [ -z "$MLOG_DIR" ]
+then
+ echo 'MLOG folder is not set. Disable MLOG (MLOG_DIR='$MLOG_DIR')'
+ MLOG=0
+else
+ echo 'MLOG folder is set. Enable MLOG (MLOG_DIR='$MLOG_DIR')'
+ MLOG=1
+fi
+
+echo 'Building xRAN Library'
+echo "LIBXRANSO = ${LIBXRANSO}"
+echo "MLOG = ${MLOG}"
+
+cd $XRAN_FH_LIB_DIR
+make $COMMAND_LINE MLOG=${MLOG} LIBXRANSO=${LIBXRANSO} #DEBUG=1 VERBOSE=1
+
+#echo 'Building xRAN Test Application'
+#cd $XRAN_FH_APP_DIR
+#make $COMMAND_LINE MLOG=${MLOG} #DEBUG=1 VERBOSE=1
+
+#if [ -z ${GTEST_ROOT+x} ];
+#then
+# echo "GTEST_ROOT is not set. Unit tests are not compiled";
+#else
+# echo 'Building xRAN Test Application ('$GTEST_ROOT')'
+# cd $XRAN_FH_TEST_DIR
+# make clean;
+# make
+#fi
+