Skip to content

Commit

Permalink
Enable user defined build options
Browse files Browse the repository at this point in the history
  • Loading branch information
AP-Frank committed Jul 7, 2017
1 parent 82ee7c1 commit 4247c4f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 2.8)
project(MoonGen C CXX)

#Options are defined in libmoon/CMakeLists.txt

set(CMAKE_CXX_FLAGS "-fno-stack-protector -Wall -Wextra -Wno-unused-parameter -g -O3 -std=gnu++11 -march=native -msse4.2")
set(CMAKE_C_FLAGS "-fno-stack-protector -Wall -Wextra -Wno-unused-parameter -g -O3 -std=gnu11 -march=native -msse4.2")
set(CMAKE_EXE_LINKER_FLAGS "-rdynamic")
Expand Down
42 changes: 40 additions & 2 deletions build.sh
@@ -1,5 +1,35 @@
#!/bin/bash

OPTIONS=''
MLX5=false
MLX4=false

while :; do
case $1 in
-h|--help)
echo "Usage: <no option> compile without Mellanox drivers; <-m|--mlx5> compile mlx5; <-n|--mlx4> compile mlx4; <-h|--help> help"
exit
;;
-m|--mlx5)
echo "Build with mlx5 driver selected"
OPTIONS="$OPTIONS""-DUSE_MLX5=ON "
MLX5=true
;;
-n|--mlx4)
echo "Build with mlx4 driver selected"
OPTIONS="$OPTIONS""-DUSE_MLX4=ON "
MLX4=true
;;
-?*)
printf 'WARN: Unknown option (abort): %s\n' "$1" >&2
exit
;;
*)
break
esac
shift
done

(
cd $(dirname "${BASH_SOURCE[0]}")
git submodule update --init --recursive
Expand All @@ -15,12 +45,20 @@ make install DESTDIR=$(pwd)

(
cd libmoon/deps/dpdk
make -j $NUM_CPUS install T=x86_64-native-linuxapp-gcc
#build DPDK with the right configuration
make config T=x86_64-native-linuxapp-gcc O=x86_64-native-linuxapp-gcc
if ${MLX5} ; then
sed -ri 's,(MLX5_PMD=).*,\1y,' x86_64-native-linuxapp-gcc/.config
fi
if ${MLX4} ; then
sed -ri 's,(MLX4_PMD=).*,\1y,' x86_64-native-linuxapp-gcc/.config
fi
make -j $NUM_CPUS O=x86_64-native-linuxapp-gcc
)

(
cd build
cmake ..
cmake ${OPTIONS}..
make -j $NUM_CPUS
)

Expand Down
2 changes: 1 addition & 1 deletion libmoon
Submodule libmoon updated 2 files
+16 −0 CMakeLists.txt
+41 −2 build.sh

0 comments on commit 4247c4f

Please sign in to comment.