Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove GCC build #2572

Merged
merged 2 commits into from Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
50 changes: 7 additions & 43 deletions build.sh
Expand Up @@ -7,23 +7,8 @@ pushd "$SCRIPT_DIR" >/dev/null
set -e
set -x

MIN_GCC_VERSION=6.0.0
gccBuild=false
function version_less_than_equal_to() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" = "$1"; }

# Parse command line arguments
while [[ $# -gt 0 ]]
do
key="$1"

case $key in
--gcc)
gccBuild=true
shift # past argument
;;
esac
done

# check for rpclib
if [ ! -d "./external/rpclib/rpclib-2.2.1" ]; then
echo "ERROR: new version of AirSim requires newer rpclib."
Expand All @@ -42,35 +27,14 @@ else
CMAKE=$(which cmake)
fi

# set up paths of cc and cxx compiler
if $gccBuild; then
# variable for build output
build_dir=build_gcc_debug
# gcc tools
if ! which gcc; then
echo "ERROR: run setup.sh to install a good version of gcc."
exit 1
else
gcc_ver=$(gcc -dumpfullversion)
fi

if version_less_than_equal_to $gcc_ver $MIN_GCC_VERSION; then
export CC="gcc-6"
export CXX="g++-6"
else
export CC="gcc"
export CXX="g++"
fi
# variable for build output
build_dir=build_debug
if [ "$(uname)" == "Darwin" ]; then
export CC=/usr/local/opt/llvm@8/bin/clang
export CXX=/usr/local/opt/llvm@8/bin/clang++
else
# variable for build output
build_dir=build_debug
if [ "$(uname)" == "Darwin" ]; then
export CC=/usr/local/opt/llvm@8/bin/clang
export CXX=/usr/local/opt/llvm@8/bin/clang++
else
export CC="clang-8"
export CXX="clang++-8"
fi
export CC="clang-8"
export CXX="clang++-8"
fi

#install EIGEN library
Expand Down
7 changes: 0 additions & 7 deletions docs/build_linux.md
Expand Up @@ -40,13 +40,6 @@ Please see instructions [here](https://github.com/Microsoft/AirSim/blob/master/d
./build.sh
```

Optionally, if you need GCC binaries for some other reason, you can simply add gcc to the setup and build invocation, like this:

```bash
./setup.sh --gcc
./build.sh --gcc
```

### Build Unreal Environment

Finally, you will need an Unreal project that hosts the environment for your vehicles. AirSim comes with a built-in "Blocks Environment" which you can use, or you can create your own. Please see [setting up Unreal Environment](unreal_proj.md).
Expand Down
57 changes: 14 additions & 43 deletions setup.sh
Expand Up @@ -5,9 +5,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd "$SCRIPT_DIR" >/dev/null

downloadHighPolySuv=true
gccBuild=false
MIN_CMAKE_VERSION=3.10.0
MIN_GCC_VERSION=6.0.0
function version_less_than_equal_to() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" = "$1"; }

# Parse command line arguments
Expand All @@ -20,51 +18,24 @@ case $key in
downloadHighPolySuv=false
shift # past value
;;
--gcc)
gccBuild=true
shift # past argument
;;
esac
done

if $gccBuild; then
# gcc tools
if ! which gcc; then
# GCC not installed
gcc_ver=0
else
gcc_ver=$(gcc -dumpfullversion)
fi

if version_less_than_equal_to $gcc_ver $MIN_GCC_VERSION; then
if [ "$(uname)" == "Darwin" ]; then # osx
brew update
brew install gcc-6 g++-6
else
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get -y update
sudo apt-get install -y gcc-6 g++-6
fi
else
echo "Already have good version of gcc: $gcc_ver"
fi
else
# llvm tools
if [ "$(uname)" == "Darwin" ]; then # osx
brew update
brew tap llvm-hs/homebrew-llvm
brew install llvm@8
else #linux
#install clang and build tools
VERSION=$(lsb_release -rs | cut -d. -f1)
# Since Ubuntu 17 clang is part of the core repository
# See https://packages.ubuntu.com/search?keywords=clang-8
if [ "$VERSION" -lt "17" ]; then
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
fi
sudo apt-get install -y clang-8 clang++-8 libc++-8-dev libc++abi-8-dev
# llvm tools
if [ "$(uname)" == "Darwin" ]; then # osx
brew update
brew tap llvm-hs/homebrew-llvm
brew install llvm@8
else #linux
#install clang and build tools
VERSION=$(lsb_release -rs | cut -d. -f1)
# Since Ubuntu 17 clang is part of the core repository
# See https://packages.ubuntu.com/search?keywords=clang-8
if [ "$VERSION" -lt "17" ]; then
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
fi
sudo apt-get install -y clang-8 clang++-8 libc++-8-dev libc++abi-8-dev
fi

#give user perms to access USB port - this is not needed if not using PX4 HIL
Expand Down