Skip to content

Commit

Permalink
Merge pull request #303 from mateusz-lichota/simplify-build
Browse files Browse the repository at this point in the history
Finish the work on Simplify compiling codebase PR
  • Loading branch information
wouter-heerwegh authored Jul 21, 2022
2 parents 96db6e0 + d7cd59a commit 2ab576c
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 96 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[submodule "ros/src/fs_msgs"]
path = ros/src/fs_msgs
url = https://github.com/FS-Driverless/fs_msgs.git
[submodule "AirSim/AirLib/external/rpclib"]
path = AirSim/external/rpclib
url = https://github.com/rpclib/rpclib.git
[submodule "ros2/src/fs_msgs"]
path = ros2/src/fs_msgs
url = https://github.com/FS-Driverless/fs_msgs.git
Expand Down
1 change: 0 additions & 1 deletion AirSim/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ ModelManifest.xml
/cmake/DroneShell/DroneShell
/cmake/DroneServer/DroneServer
cmake/AirLibUnitTests/Makefile
external/
deps/
cmake_build/

Expand Down
2 changes: 1 addition & 1 deletion AirSim/AirLib/src/common/common_utils/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
using namespace common_utils;

// File names are unicode (std::wstring), because users can create folders containing unicode characters on both
// Windows, OSX and Linux.
// Windows and Linux.
std::string FileSystem::createDirectory(const std::string& fullPath) {

#ifdef _WIN32
Expand Down
40 changes: 7 additions & 33 deletions AirSim/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,10 @@ if ERRORLEVEL 1 (
)
)

REM //---------- get rpclib ----------
IF NOT EXIST external\rpclib mkdir external\rpclib
IF NOT EXIST external\rpclib\rpclib-2.2.1 (
REM //leave some blank lines because powershell shows download banner at top of console
ECHO(
ECHO(
ECHO(
ECHO *****************************************************************************************
ECHO Downloading rpclib
ECHO *****************************************************************************************
powershell -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/rpclib/rpclib/archive/v2.2.1.zip -OutFile external\rpclib.zip }"

REM //remove any previous versions
rmdir external\rpclib /q /s

powershell -command "& { Expand-Archive -Path external\rpclib.zip -DestinationPath external\rpclib }"
del external\rpclib.zip /q

REM //Don't fail the build if the high-poly car is unable to be downloaded
REM //Instead, just notify users that the gokart will be used.
IF NOT EXIST external\rpclib\rpclib-2.2.1 (
ECHO Unable to download high-polycount SUV. Your AirSim build will use the default vehicle.
goto :buildfailed
)
)

REM //---------- Build rpclib ------------
ECHO Starting cmake to build rpclib...
IF NOT EXIST external\rpclib\rpclib-2.2.1\build mkdir external\rpclib\rpclib-2.2.1\build
cd external\rpclib\rpclib-2.2.1\build
IF NOT EXIST external\rpclib\build mkdir external\rpclib\build
cd external\rpclib\build
REM cmake -G"Visual Studio 14 2015 Win64" ..
cmake -G"Visual Studio 16 2019" ..

Expand All @@ -95,15 +69,15 @@ set RPCLIB_TARGET_LIB=AirLib\deps\rpclib\lib\x64
if NOT exist %RPCLIB_TARGET_LIB% mkdir %RPCLIB_TARGET_LIB%
set RPCLIB_TARGET_INCLUDE=AirLib\deps\rpclib\include
if NOT exist %RPCLIB_TARGET_INCLUDE% mkdir %RPCLIB_TARGET_INCLUDE%
robocopy /MIR external\rpclib\rpclib-2.2.1\include %RPCLIB_TARGET_INCLUDE%
robocopy /MIR external\rpclib\include %RPCLIB_TARGET_INCLUDE%

if "%buildMode%" == "--Debug" (
robocopy /MIR external\rpclib\rpclib-2.2.1\build\Debug %RPCLIB_TARGET_LIB%\Debug
robocopy /MIR external\rpclib\build\Debug %RPCLIB_TARGET_LIB%\Debug
) else if "%buildMode%" == "--Release" (
robocopy /MIR external\rpclib\rpclib-2.2.1\build\Release %RPCLIB_TARGET_LIB%\Release
robocopy /MIR external\rpclib\build\Release %RPCLIB_TARGET_LIB%\Release
) else (
robocopy /MIR external\rpclib\rpclib-2.2.1\build\Debug %RPCLIB_TARGET_LIB%\Debug
robocopy /MIR external\rpclib\rpclib-2.2.1\build\Release %RPCLIB_TARGET_LIB%\Release
robocopy /MIR external\rpclib\build\Debug %RPCLIB_TARGET_LIB%\Debug
robocopy /MIR external\rpclib\build\Release %RPCLIB_TARGET_LIB%\Release
)

REM //---------- get Eigen library ----------
Expand Down
7 changes: 3 additions & 4 deletions AirSim/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ set -x
function version_less_than_equal_to() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" = "$1"; }

# 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."
if [ ! -d "./external/rpclib/include" ]; then
echo "ERROR: rpclib missing. Please run initialize git submodules."
exit 1
fi

Expand Down Expand Up @@ -76,7 +75,7 @@ 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
rsync -a --delete external/rpclib/rpclib-2.2.1/include AirLib/deps/rpclib
rsync -a --delete external/rpclib/include AirLib/deps/rpclib

../UE4Project/clean.sh
rsync -a --delete AirLib ../UE4Project/Plugins/AirSim/Source
Expand Down
3 changes: 1 addition & 2 deletions AirSim/cmake/cmake-modules/CommonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ macro(CommonSetup)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})

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

Expand Down
2 changes: 1 addition & 1 deletion AirSim/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_VERSION_FOLDER}" "${CMAKE_CURRENT_BINARY_DIR}/rpclib")
add_subdirectory("${AIRSIM_ROOT}/external/rpclib/" "${CMAKE_CURRENT_BINARY_DIR}/rpclib")
1 change: 1 addition & 0 deletions AirSim/external/rpclib
Submodule rpclib added at a663a1
63 changes: 11 additions & 52 deletions AirSim/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,19 @@ case $key in
esac
done

# 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
#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

#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 # osx
if [[ ! -z "${whoami}" ]]; then #this happens when running in travis
sudo dseditgroup -o edit -a `whoami` -t user dialout
fi

brew install wget
brew install coreutils
brew install cmake # should get cmake 3.8

else #linux
if [[ ! -z "${whoami}" ]]; then #this happens when running in travis
sudo /usr/sbin/useradd -G dialout $USER
sudo usermod -a -G dialout $USER
fi

#install additional tools
sudo apt-get install -y build-essential
sudo apt-get install -y unzip
fi
#install additional tools
sudo apt-get install -y build-essential
sudo apt-get install -y unzip

if ! which cmake; then
# CMake not installed
Expand Down Expand Up @@ -87,22 +62,6 @@ else
echo "Already have good version of cmake: $cmake_ver"
fi

# 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

echo "Installing Eigen library..."

if [ ! -d "AirLib/deps/eigen3" ]; then
Expand Down
6 changes: 5 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ On Ubuntu you can skip the visual studio 2019 part, but you still need Unreal En

#### 1. Get the repository

You can either download the repo using the big green download button on the [github page of this project](https://github.com/FS-Driverless/Formula-Student-Driverless-Simulator) or clone the repository. For cloning, checkout the documentation on this further down this page. Make sure you clone the repository in your **home directory**.
You can either download the repo using the big green download button on the [github page of this project](https://github.com/FS-Driverless/Formula-Student-Driverless-Simulator) or clone the repository. For cloning, checkout the documentation on this further down this page. Make sure you clone the repository in your **home directory** and git **submodules** are included:

```
git clone https://github.com/FS-Driverless/Formula-Student-Driverless-Simulator.git --recurse-submodules
```

When downloading or cloning, by default you get the latest, unreleased version. This is probably not the version that you want. Make sure you select the version that you need!

Expand Down
2 changes: 1 addition & 1 deletion ros/src/fsds_ros_bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set(CXX_EXP_LIB "-nostdinc++ -I/usr/include/c++/8 -I/usr/include/x86_64-linux-gn
-lm -lc -lgcc_s -lgcc
-lstdc++fs -fmax-errors=10 -Wnoexcept -Wstrict-null-sentinel")

set(RPC_LIB_INCLUDES " ${AIRSIM_ROOT}/external/rpclib/rpclib-2.2.1/include")
set(RPC_LIB_INCLUDES " ${AIRSIM_ROOT}/external/rpclib/include")
set(RPC_LIB rpc) # name of .a file with lib prefix
message(STATUS "found RPC_LIB_INCLUDES=${RPC_LIB_INCLUDES}")

Expand Down

0 comments on commit 2ab576c

Please sign in to comment.