Skip to content

Commit

Permalink
Linux build/setup changes for rpclib upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Jan 20, 2018
1 parent 60a45ab commit a01a79d
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ ModelManifest.xml
cmake/AirLibUnitTests/Makefile
external/
deps/
cmake_build/

# Eclipse Project file
/.project
Expand All @@ -308,6 +309,7 @@ deps/
/cmake/rpclib
/cmake/output/lib/libMavLinkCom.a
/cmake/output/lib/libAirSim-rpclib.a
/cmake/output/lib/librpc.a
/cmake/output/lib/libAirLib.a
/cmake/output/lib
/AirLib/include/controllers/html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class RealMultirotorConnector : public VehicleConnectorBase

virtual void setPose(const Pose& pose, bool ignore_collision) override
{
unused(pose);
unused(ignore_collision);
throw std::logic_error("setPose() call is only supported for simulation");
}

Expand All @@ -63,10 +65,14 @@ class RealMultirotorConnector : public VehicleConnectorBase
virtual bool setSegmentationObjectID(const std::string& mesh_name, int object_id,
bool is_name_regex = false) override
{
unused(mesh_name);
unused(object_id);
unused(is_name_regex);
throw std::logic_error("setSegmentationObjectID() call is only supported for simulation");
}
virtual int getSegmentationObjectID(const std::string& mesh_name) override
{
unused(mesh_name);
throw std::logic_error("getSegmentationObjectID() call is only supported for simulation");
}

Expand Down
2 changes: 1 addition & 1 deletion Unreal/Environments/Blocks/Blocks.uproject
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 3,
"EngineAssociation": "4.16",
"EngineAssociation": "{1D3B760A-2107-0115-0013-02AF1DCEC6C8}",
"Category": "",
"Description": "",
"Modules": [
Expand Down
24 changes: 20 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,31 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd "$SCRIPT_DIR" >/dev/null

set -e
set -x
# set -x

# check for libc++
if [[ !(-d "./llvm-build/output/lib") ]]; then
echo "ERROR: clang++ and libc++ is necessary to compile AirSim and run it in Unreal engine"
echo "please run setup.sh first."
echo "Please run setup.sh first."
exit 1
fi

# check for rpclib
if [ ! -d "./external/rpclib/rpclib-2.2.1" ]; then
echo "ERROR: new version of AirSim requires newer rpclib."
echo "please run setup.sh first and then run build.sh again."
exit 1
fi

# check for cmake build
if [ ! -d "./cmake_build" ]; then
echo "ERROR: cmake build was not found."
echo "please run setup.sh first and then run build.sh again."
exit 1
fi

CMAKE="$(readlink -f cmake_build/bin/cmake)"

# set up paths of clang compiler
if [ "$(uname)" == "Darwin" ]; then
export CC=/usr/local/opt/llvm\@3.9/bin/clang
Expand Down Expand Up @@ -46,7 +62,7 @@ if [[ ! -d $build_dir ]]; then
mkdir -p $build_dir
pushd $build_dir >/dev/null

cmake ../cmake -DCMAKE_BUILD_TYPE=Debug \
"$CMAKE" ../cmake -DCMAKE_BUILD_TYPE=Debug \
|| (popd && rm -r $build_dir && exit 1)
popd >/dev/null
fi
Expand All @@ -64,7 +80,7 @@ mkdir -p AirLib/deps/rpclib/lib
mkdir -p AirLib/deps/MavLinkCom/lib
cp $build_dir/output/lib/libAirLib.a AirLib/lib
cp $build_dir/output/lib/libMavLinkCom.a AirLib/deps/MavLinkCom/lib
cp $build_dir/output/lib/libAirSim-rpclib.a AirLib/deps/rpclib/lib/librpc.a
cp $build_dir/output/lib/librpc.a AirLib/deps/rpclib/lib/librpc.a

# Update AirLib/lib, AirLib/deps, Plugins folders with new binaries
rsync -a --delete $build_dir/output/lib/ AirLib/lib/x64/Debug
Expand Down
4 changes: 0 additions & 4 deletions cmake/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
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..."
Expand Down
7 changes: 4 additions & 3 deletions cmake/cmake-modules/CommonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ macro(CommonSetup)
SET(LIBCXX_LIB_PATH ${AIRSIM_ROOT}/llvm-build/output/lib)

#setup include and lib for rpclib which will be referenced by other projects
set(RPCLIB_NAME_SUFFIX rpclib)
set(RPC_LIB_INCLUDES " ${AIRSIM_ROOT}/external/rpclib/include")
set(RPC_LIB ${CMAKE_PROJECT_NAME}-${RPCLIB_NAME_SUFFIX})
set(RPCLIB_VERSION_FOLDER rpclib-2.2.1)
set(RPC_LIB_INCLUDES " ${AIRSIM_ROOT}/external/rpclib/${RPCLIB_VERSION_FOLDER}/include")
#name of .a file with lib prefix
set(RPC_LIB rpc)

#what is our build type debug or release?
string( TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
Expand Down
2 changes: 1 addition & 1 deletion cmake/rpclib_wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ IF(UNIX)
set(CMAKE_CXX_FLAGS "${RPC_LIB_DEFINES} ${CMAKE_CXX_FLAGS}")
ENDIF()

add_subdirectory("${AIRSIM_ROOT}/external/rpclib/rpclib-2.2.1" "${CMAKE_CURRENT_BINARY_DIR}/rpclib")
add_subdirectory("${AIRSIM_ROOT}/external/rpclib/${RPCLIB_VERSION_FOLDER}" "${CMAKE_CURRENT_BINARY_DIR}/rpclib")
39 changes: 33 additions & 6 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ if [[ $1 == "--no-full-poly-car" ]]; then
downloadHighPolySuv=false
fi

#get sub modules
git submodule update --init --recursive

#give user perms to access USB port - this is not needed if not using PX4 HIL
#TODO: figure out how to do below in travis
if [ "$(uname)" == "Darwin" ]; then
Expand All @@ -27,7 +24,6 @@ if [ "$(uname)" == "Darwin" ]; then
brew install --force-bottle [email protected]

brew install wget
brew install cmake

export C_COMPILER=/usr/local/opt/llvm\@3.9/bin/clang
export COMPILER=/usr/local/opt/llvm\@3.9/bin/clang++
Expand All @@ -39,7 +35,6 @@ else

#install clang and build tools
sudo apt-get install -y build-essential
sudo apt-get install cmake
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get update
sudo apt-get install -y clang-3.9 clang++-3.9
Expand All @@ -48,6 +43,38 @@ else
export COMPILER=clang++-3.9
fi

#download cmake - we need v3.9+ which is not available in Ubuntu 16.04
if [[ ! -d "cmake_build/bin" ]]; then
echo "Downloading cmake..."
wget https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz \
-O cmake.tar.gz
tar -xzf cmake.tar.gz
rm cmake.tar.gz
rm -rf ./cmake_build
mv ./cmake-3.10.2 ./cmake_build
pushd cmake_build
./bootstrap
make
popd
fi
CMAKE="$(readlink -f cmake_build/bin/cmake)"

# Download rpclib
if [ ! -d "external/rpclib/rpclib-2.2.1" ]; then
echo "*********************************************************************************************"
echo "Downloading rpclib..."
echo "*********************************************************************************************"

wget https://github.com/rpclib/rpclib/archive/v2.2.1.zip

# remove previous versions
rm -rf "external/rpclib"

mkdir -p "external/rpclib"
unzip v2.2.1.zip -d external/rpclib
rm v2.2.1.zip
fi

# Download high-polycount SUV model
if [ ! -d "Unreal/Plugins/AirSim/Content/VehicleAdv" ]; then
mkdir -p "Unreal/Plugins/AirSim/Content/VehicleAdv"
Expand Down Expand Up @@ -102,7 +129,7 @@ mkdir -p llvm-build
pushd llvm-build >/dev/null


cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \
"$CMAKE" -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \
-LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF -DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=OFF \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=./output \
../llvm-source-39
Expand Down

0 comments on commit a01a79d

Please sign in to comment.