3 VPP_DIR=$(dirname ${BASH_SOURCE[0]})/../..
4 VPP_TOOLCHAIN_FILE=$VPP_DIR/extras/scripts/.config/macos.toolchain
5 BUILD_PATCH=$VPP_DIR/extras/scripts/patches/macos_build_externals.patch
11 conf <dir> create the configuration file
12 with the give cross-toolchain directory
13 build run Macos <make build>
14 build-release run Macos <make build-release>
15 compile_commands Generate compile_commands.json
19 function create_toolchain_file () {
21 echo "Please specify the cross toolchain directory"
26 mkdir -p $VPP_DIR/extras/scripts/.config
28 SET(CMAKE_SYSTEM_NAME Linux)
29 SET(CMAKE_SYSTEM_VERSION 1)
31 # specify the cross compiler
32 SET(CMAKE_C_COMPILER $XCHAIN/x86_64-ubuntu16.04-linux-gnu/bin/x86_64-ubuntu16.04-linux-gnu-gcc)
33 SET(CMAKE_CXX_COMPILER $XCHAIN/x86_64-ubuntu16.04-linux-gnu/bin/x86_64-ubuntu16.04-linux-gnu-g++)
35 # where is the target environment
36 SET(CMAKE_FIND_ROOT_PATH $XCHAIN/x86_64-ubuntu16.04-linux-gnu $XCHAIN/x86_64-ubuntu16.04-linux-gnu/x86_64-ubuntu16.04-linux-gnu/sysroot/)
38 SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
39 SET(CMAKE_SYSTEM_PROCESSOR x86_64)
40 # This is needed to build vpp-papi
41 SET(PYTHON_EXECUTABLE /usr/local/bin/python)" | tee $VPP_TOOLCHAIN_FILE > /dev/null
42 echo "Configration file created"
43 echo "please edit $VPP_TOOLCHAIN_FILE"
45 echo "configuration file already exists"
46 echo "please edit $VPP_TOOLCHAIN_FILE"
50 function vpp_make () {
51 cd $VPP_DIR ; git apply $BUILD_PATCH
52 trap "cd $VPP_DIR ; git apply -R $BUILD_PATCH" EXIT
53 export VPP_EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=${VPP_TOOLCHAIN_FILE} -DCMAKE_EXPORT_COMPILE_COMMANDS=${VPP_EXPORT_CC}" ; make -C $VPP_DIR $1
58 create_toolchain_file $2
64 vpp_make build-release
67 VPP_EXPORT_CC=ON vpp_make build
68 echo "compile_commands.json should be generated"
69 echo "check $VPP_DIR/build-root/build-vpp_debug-native/vpp/compile_commands.json"