Skip to content

Commit

Permalink
fix gcc build script
Browse files Browse the repository at this point in the history
  • Loading branch information
lovettchris committed Jun 13, 2017
1 parent ea2f80b commit 5e6faab
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions cmake/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Get the location of this script, it is assumed you already cloned "main" and you are running the
# This script is for building AirSim with GCC-6
# 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

# First get the location of this script, it is assumed you already cloned "main" and you are running the
# script from that repo. It will then put everything else in a ROS workspace at "../catkin_ws"
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
Expand All @@ -7,22 +13,33 @@ pushd $SCRIPTPATH
# update the rpclib git submodule
pushd ..
git submodule update --init --recursive

if [[ ! -d "$EIGEN_ROOT" ]]; then
if [[ ! -d eigen ]]; then
echo "downloading eigen..."
wget http://bitbucket.org/eigen/eigen/get/3.3.2.zip
unzip 3.3.2.zip -d eigen
pushd eigen
mv eigen* eigen3
echo "3.3.2" > version
popd &>/dev/null
rm 3.3.2.zip
fi
export EIGEN_ROOT="$(pwd)/eigen"
fi
popd

if [ -f "CMakeCache.txt" ]; then
rm CMakeCache.txt
fi

if [ -f "CMakeFiles" ]; then
if [ -d "CMakeFiles" ]; then
rm -rf CMakeFiles
fi

GCCARGS="-D CMAKE_BUILD_TYPE=Debug"

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
GCCARGS="$GCCARGS -D CMAKE_C_COMPILER=gcc-6 -D CMAKE_CXX_COMPILER=g++-6"

cmake $GCCARGS CMakeLists.txt

Expand Down

0 comments on commit 5e6faab

Please sign in to comment.