Created
January 18, 2020 19:19
-
-
Save o0Ignition0o/0f49f17bc9077e42d92d551cfe35d700 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/.gitignore b/.gitignore | |
index 785b5da6..b17d9aac 100644 | |
--- a/.gitignore | |
+++ b/.gitignore | |
@@ -358,11 +358,14 @@ xcuserdata/ | |
!*.xcworkspace/contents.xcworkspacedata | |
/*.gcno | |
+# Unity | |
/Unity/UnityDemo/Library | |
/Unity/UnityDemo/Assembly-CSharp.csproj | |
/Unity/UnityDemo/UnityDemo.sln | |
/Unity/UnityDemo/Logs/ | |
-/Unity/UnityDemo/Assets/Plugins/AirsimWrapper.dll | |
+/Unity/linux-build | |
+/Unity/UnityDemo/Assets/Plugins | |
+/Unity/UnityDemo/Packages | |
# ROS | |
ros/.catkin_tools/ | |
diff --git a/Unity/AirLibWrapper/AirsimWrapper/CMakeLists.txt b/Unity/AirLibWrapper/AirsimWrapper/CMakeLists.txt | |
index 140772d5..5972d2c6 100644 | |
--- a/Unity/AirLibWrapper/AirsimWrapper/CMakeLists.txt | |
+++ b/Unity/AirLibWrapper/AirsimWrapper/CMakeLists.txt | |
@@ -22,12 +22,23 @@ IncludeEigen() | |
project(AirsimWrapper VERSION 0) | |
+find_package(Boost REQUIRED COMPONENTS filesystem) | |
+if(Boost_FOUND) | |
+ MESSAGE("Boost information:") | |
+ MESSAGE(" Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}") | |
+ MESSAGE(" Boost_LIBRARIES: ${Boost_LIBRARIES}") | |
+ MESSAGE(" Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}") | |
+ MESSAGE(" Boost_FILESYSTEM_LIBRARY: ${boost_filesystem_DIR}") | |
+endif() | |
+ | |
+include_directories(${Boost_INCLUDE_DIRS}) | |
+ | |
# RPC includes & source files | |
BuildRpc() | |
# MavLink source files | |
BuildMavLink() | |
#AirLib source files | |
-BuildAirlib() | |
+BuildAirLib() | |
#AirsimWrapper source files | |
BuildAirsimWrapper() | |
@@ -53,8 +64,7 @@ else () | |
) | |
endif () | |
-target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} -lstdc++ -lpthread -lboost_filesystem) | |
- | |
+ target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} -lstdc++ -lpthread ${Boost_LIBRARIES}) | |
##################### Build Options #############################3 | |
diff --git a/Unity/AirLibWrapper/AirsimWrapper/cmake/airlib-setup.cmake b/Unity/AirLibWrapper/AirsimWrapper/cmake/airlib-setup.cmake | |
index d6a11bb9..f6a27c4e 100644 | |
--- a/Unity/AirLibWrapper/AirsimWrapper/cmake/airlib-setup.cmake | |
+++ b/Unity/AirLibWrapper/AirsimWrapper/cmake/airlib-setup.cmake | |
@@ -10,8 +10,7 @@ file(GLOB_RECURSE AIRLIB_LIBRARY_SOURCE_FILES | |
${AIRSIM_ROOT}/AirLib/src/api/*.cpp | |
${AIRSIM_ROOT}/AirLib/src/common/common_utils/*.cpp | |
${AIRSIM_ROOT}/AirLib/src/safety/*.cpp | |
- ${AIRSIM_ROOT}/AirLib/src/vehicles/car/api/*.cpp | |
- ${AIRSIM_ROOT}/AirLib/src/vehicles/multirotor/api/*.cpp | |
+ ${AIRSIM_ROOT}/AirLib/src/vehicles/car/*.cpp | |
${AIRSIM_ROOT}/AirLib/src/vehicles/multirotor/*.cpp | |
) | |
diff --git a/Unity/AirLibWrapper/AirsimWrapper/cmake/rpc-setup.cmake b/Unity/AirLibWrapper/AirsimWrapper/cmake/rpc-setup.cmake | |
index 82b7daf1..0fba5ad4 100644 | |
--- a/Unity/AirLibWrapper/AirsimWrapper/cmake/rpc-setup.cmake | |
+++ b/Unity/AirLibWrapper/AirsimWrapper/cmake/rpc-setup.cmake | |
@@ -275,7 +275,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | |
set(UNUSED_LAMBDA_CAPTURE_WARN_SUPPORTED) | |
check_warning_flag("unused-lambda-capture" UNUSED_LAMBDA_CAPTURE_WARN_SUPPORTED) | |
if(${UNUSED_LAMBDA_CAPTURE_WARN_SUPPORTED}) | |
- list(APPEND RPCLIB_BUILD_FLAGS -Wno-no-unused-lambda-capture) | |
+ list(APPEND RPCLIB_BUILD_FLAGS -Wno-unused-lambda-capture) | |
endif() | |
check_warning_flag("zero-as-null-pointer-constant" ZERO_AS_NULL_POINTER_CONSTANT_WARN_SUPPORTED) | |
diff --git a/Unity/UnityDemo/Assets/Plugins/AirsimWrapper.dll.meta b/Unity/UnityDemo/Assets/Plugins/AirsimWrapper.dll.meta | |
deleted file mode 100644 | |
index 7ea7266f..00000000 | |
--- a/Unity/UnityDemo/Assets/Plugins/AirsimWrapper.dll.meta | |
+++ /dev/null | |
@@ -1,24 +0,0 @@ | |
-fileFormatVersion: 2 | |
-guid: 989e56d442859a04eb455dc6046f3394 | |
-PluginImporter: | |
- externalObjects: {} | |
- serializedVersion: 2 | |
- iconMap: {} | |
- executionOrder: {} | |
- isPreloaded: 0 | |
- isOverridable: 0 | |
- platformData: | |
- - first: | |
- Any: | |
- second: | |
- enabled: 1 | |
- settings: {} | |
- - first: | |
- Editor: Editor | |
- second: | |
- enabled: 0 | |
- settings: | |
- DefaultValueInitialized: true | |
- userData: | |
- assetBundleName: | |
- assetBundleVariant: | |
diff --git a/Unity/build.sh b/Unity/build.sh | |
index 0418d37a..4ac93623 100755 | |
--- a/Unity/build.sh | |
+++ b/Unity/build.sh | |
@@ -1,36 +1,54 @@ | |
+#! /bin/bash | |
+ | |
+set -x | |
+set -e | |
+ | |
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
+pushd "$SCRIPT_DIR" >/dev/null | |
+ | |
+# check for rpclib | |
if [ ! -f ../external/rpclib/rpclib-2.2.1/rpclib.pc.in ]; then | |
- >&2 echo "error, rpc.pc.in not found" | |
+ >&2 echo "error, rpc.pc.in not found, please run setup.sh first and then run build.sh again" | |
fi | |
+ | |
cp ../external/rpclib/rpclib-2.2.1/rpclib.pc.in AirLibWrapper/AirsimWrapper/rpclib.pc.in | |
if [ ! -d "linux-build" ]; then | |
- mkdir linux-build; | |
+ mkdir linux-build | |
fi | |
-cd linux-build; | |
-export CC="clang-5.0" | |
-export CXX="clang++-5.0" | |
+cd linux-build | |
+export LLVM_DIR="llvm-bin" | |
+export CC=${SCRIPT_DIR}/../${LLVM_DIR}/bin/clang | |
+export CXX=${SCRIPT_DIR}/../${LLVM_DIR}/bin/clang++ | |
+#export CC="clang-5.0" | |
+#export CXX="clang++-5.0" | |
-if [ "$(uname)" == "Darwin" ]; then | |
- CMAKE="$(greadlink -f ../../cmake_build/bin/cmake)" | |
+# check for local cmake build created by setup.sh | |
+if [ -d "../../cmake_build" ]; then | |
+ if [ "$(uname)" = "Darwin" ]; then | |
+ CMAKE="$(greadlink -f ../../cmake_build/bin/cmake)" | |
+ else | |
+ CMAKE="$(readlink -f ../../cmake_build/bin/cmake)" | |
+ fi | |
else | |
- CMAKE="$(readlink -f ../../cmake_build/bin/cmake)" | |
+ CMAKE=$(which cmake) | |
fi | |
-"$CMAKE" ../../cmake ../AirLibWrapper/AirsimWrapper; | |
-make -j`nproc`; | |
+"$CMAKE" -DCMAKE_C_COMPILER=${CC} -DCMAKE_CXX_COMPILER=${CXX} ../../cmake ../AirLibWrapper/AirsimWrapper | |
+make -j`nproc` | |
if [ ! -d "../UnityDemo/Assets/Plugins" ]; then | |
- mkdir ../ UnityDemo/Assets/Plugins; | |
+ mkdir ../UnityDemo/Assets/Plugins | |
fi | |
-if [ "$(uname)" == "Darwin" ]; then | |
- cp AirsimWrapper.bundle ../UnityDemo/Assets/Plugins; | |
+if [ "$(uname)" = "Darwin" ]; then | |
+ cp -r AirsimWrapper.bundle ../UnityDemo/Assets/Plugins | |
else | |
- cp libAirsimWrapper.so ../UnityDemo/Assets/Plugins; | |
+ cp libAirsimWrapper.so ../UnityDemo/Assets/Plugins | |
fi | |
cd .. | |
if [ -f AirLibWrapper/AirsimWrapper/rpclib.pc.in ]; then | |
- rm AirLibWrapper/AirsimWrapper/rpclib.pc.in | |
+ rm AirLibWrapper/AirsimWrapper/rpclib.pc.in | |
fi | |
diff --git a/build.sh b/build.sh | |
index 94aa1b3e..4e1c6d43 100755 | |
--- a/build.sh | |
+++ b/build.sh | |
@@ -48,7 +48,7 @@ if $gccBuild; then | |
build_dir=build_gcc_debug | |
# gcc tools | |
gcc_ver=$(gcc -dumpfullversion) | |
- gcc_path=$(which cmake) | |
+ gcc_path=$(which gcc) | |
if [[ "$gcc_path" == "" ]] ; then | |
echo "ERROR: run setup.sh to install a good version of gcc." | |
exit 1 | |
@@ -83,8 +83,14 @@ else | |
# variable for build output | |
build_dir=build_debug | |
if [ "$(uname)" == "Darwin" ]; then | |
- export CC=/usr/local/opt/llvm-5.0/bin/clang-5.0 | |
- export CXX=/usr/local/opt/llvm-5.0/bin/clang++-5.0 | |
+ export LLVM_DIR="llvm-bin" | |
+ if [[ -n $LLVM_DIR ]]; then | |
+ export CC=${LLVM_DIR}/bin/clang | |
+ export CXX=${LLVM_DIR}/bin/clang++ | |
+ else | |
+ export CC=/usr/local/opt/llvm-5.0/bin/clang-5.0 | |
+ export CXX=/usr/local/opt/llvm-5.0/bin/clang++-5.0 | |
+ fi | |
else | |
export CC="clang-5.0" | |
export CXX="clang++-5.0" | |
diff --git a/setup.sh b/setup.sh | |
index 123318a9..5ad604ff 100755 | |
--- a/setup.sh | |
+++ b/setup.sh | |
@@ -58,14 +58,23 @@ if $gccBuild; then | |
else | |
# llvm tools | |
if [ "$(uname)" == "Darwin" ]; then # osx | |
- brew update | |
- | |
- # brew install llvm@3.9 | |
- brew tap llvm-hs/homebrew-llvm | |
- brew install llvm-5.0 | |
- export C_COMPILER=/usr/local/opt/llvm-5.0/bin/clang-5.0 | |
- export COMPILER=/usr/local/opt/llvm-5.0/bin/clang++-5.0 | |
- | |
+ export LLVM_DIR="llvm-bin" | |
+ if [[ -d $LLVM_DIR ]]; then | |
+ echo "llvm directory exists already." | |
+ else | |
+ echo "llvm bin directory not found, downloading and extracting llvm." | |
+ LLVM_PACKAGE="clang+llvm-5.0.2-x86_64-apple-darwin" | |
+ #wget http://releases.llvm.org/5.0.2/${LLVM_PACKAGE}.tar.xz; | |
+ mkdir -p ${LLVM_DIR} | |
+ tar -xf ${LLVM_PACKAGE}.tar.xz -C ${LLVM_DIR} --strip-components=1 | |
+ fi | |
+ # CMAKE requires CC and CXX to be absolute paths | |
+ export C_COMPILER=${SCRIPT_DIR}/${LLVM_DIR}/bin/clang | |
+ export COMPILER=${SCRIPT_DIR}/${LLVM_DIR}/bin/clang++ | |
+ export CMAKE_C_COMPILER=${SCRIPT_DIR}/${LLVM_DIR}/bin/clang | |
+ export CMAKE_CXX_COMPILER=${SCRIPT_DIR}/${LLVM_DIR}/bin/clang++ | |
+ export CC=${SCRIPT_DIR}/${LLVM_DIR}/bin/clang | |
+ export CXX=${SCRIPT_DIR}/${LLVM_DIR}/bin/clang++ | |
else #linux | |
#install clang and build tools | |
@@ -92,6 +101,7 @@ if [ "$(uname)" == "Darwin" ]; then # osx | |
brew install wget | |
brew install coreutils | |
brew install cmake # should get cmake 3.8 | |
+ CMAKE=$(which cmake) | |
else #linux | |
if [[ ! -z "${whoami}" ]]; then #this happens when running in travis |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment