From 3fb0b9203e22faa707f92b7c38da16c20d498b80 Mon Sep 17 00:00:00 2001 From: clovett Date: Wed, 14 Jun 2017 18:17:15 -0700 Subject: [PATCH] fix build script --- cmake/build.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmake/build.sh b/cmake/build.sh index 860a8268ca..99cd33014c 100755 --- a/cmake/build.sh +++ b/cmake/build.sh @@ -1,5 +1,5 @@ # This script is for building AirSim with GCC-6 -# You should NOT use this with Unreal. +# You should NOT use this with Unreal. # If you want bits that work in Unreal you need to use ../build.sh # For pre-requisite tools needed to run this script see # https://github.com/Microsoft/AirSim/blob/master/docs/linux_build.md @@ -12,7 +12,7 @@ pushd $SCRIPTPATH # update the rpclib git submodule pushd .. -git submodule update --init --recursive +git submodule update --init --recursive if [[ ! -d "$EIGEN_ROOT" ]]; then if [[ ! -d eigen ]]; then @@ -30,7 +30,7 @@ fi popd if [ -f "CMakeCache.txt" ]; then -rm CMakeCache.txt +rm CMakeCache.txt fi if [ -d "CMakeFiles" ]; then @@ -39,8 +39,10 @@ fi GCCARGS="-D CMAKE_BUILD_TYPE=Debug" -GCCARGS="$GCCARGS -D CMAKE_C_COMPILER=gcc-6 -D CMAKE_CXX_COMPILER=g++-6" - +GCCVERSION=$(gcc -v 2>&1 | sed -n "/^gcc version/p" | sed -e "s/^gcc version \([0-9]\)/\1/g" | cut -d"." -f1) +if [ $GCCVERSION -lt 5 ]; then + GCCARGS="$GCCARGS -D CMAKE_C_COMPILER=gcc-6 -D CMAKE_CXX_COMPILER=g++-6" +fi cmake $GCCARGS CMakeLists.txt make