Skip to content

Commit

Permalink
remove, rpclib as submodule, download from git release, cmake install…
Browse files Browse the repository at this point in the history
… enhancements
  • Loading branch information
sytelus committed Jan 20, 2018
1 parent 065ad2b commit 60a45ab
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 36 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "external/rpclib"]
path = external/rpclib
url = https://github.com/rpclib/rpclib.git
2 changes: 1 addition & 1 deletion DroneServer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int main(int argc, const char* argv[])

}
else {
std::cout << "Could not load settings from " << Settings::singleton().getFileName() << std::endl;
std::cout << "Could not load settings from " << Settings::singleton().getFullFilePath() << std::endl;
return 3;

}
Expand Down
86 changes: 60 additions & 26 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,68 @@ if "%1"=="--no-full-poly-car" set "noFullPolyCar=y"

:noargs

REM //---------- make sure we have got all sub modules ----------
chdir /d %ROOT_DIR%
ECHO Updating submodules...
git submodule update --init --recursive

REM //---------- if cmake doesn't exist then install it ----------
WHERE cmake >nul 2>nul
IF %ERRORLEVEL% NEQ 0 (
call :installcmake
REM //---------- Check cmake version ----------
CALL check_cmake.bat
if ERRORLEVEL 1 (
CALL check_cmake.bat
if ERRORLEVEL 1 (
echo(
echo ERROR: cmake was not installed correctly.
goto :buildfailed
)
)

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 *****************************************************************************************
@echo on
powershell -command "& { iwr https://github.com/rpclib/rpclib/archive/v2.2.1.zip -OutFile external\rpclib.zip }"
@echo off

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
REM cmake -G"Visual Studio 15 2017 Win64" ..
cmake -G"Visual Studio 14 2015 Win64" ..
cmake --build .
cmake --build . --config Release
if ERRORLEVEL 1 goto :buildfailed
chdir /d %ROOT_DIR%


REM //---------- copy rpclib binaries and include folder inside AirLib folder ----------
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\rpclib-2.2.1\build\Debug %RPCLIB_TARGET_LIB%\Debug
robocopy /MIR external\rpclib\rpclib-2.2.1\build\Release %RPCLIB_TARGET_LIB%\Release

REM //---------- get High PolyCount SUV Car Model ------------
IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv mkdir Unreal\Plugins\AirSim\Content\VehicleAdv
IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv\SUV\v1.1.7 (
Expand Down Expand Up @@ -67,24 +118,6 @@ IF NOT EXIST AirLib\deps\eigen3 (
)
IF NOT EXIST AirLib\deps\eigen3 goto :buildfailed

ECHO Starting cmake...
REM //---------- compile rpclib that we got from git submodule ----------
IF NOT EXIST external\rpclib\build mkdir external\rpclib\build
cd external\rpclib\build
REM cmake -G"Visual Studio 15 2017 Win64" ..
cmake -G"Visual Studio 14 2015 Win64" ..
cmake --build .
cmake --build . --config Release
if ERRORLEVEL 1 goto :buildfailed
chdir /d %ROOT_DIR%

REM //---------- copy rpclib binaries and include folder inside AirLib folder ----------
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\include %RPCLIB_TARGET_INCLUDE%
robocopy /MIR external\rpclib\build\output\lib %RPCLIB_TARGET_LIB%

REM //---------- now we have all dependencies to compile AirSim.sln which will also compile MavLinkCom ----------
msbuild /p:Platform=x64 /p:Configuration=Debug AirSim.sln
Expand All @@ -109,7 +142,8 @@ goto :eof

:buildfailed
chdir /d %ROOT_DIR%
echo #### Build failed 1>&2
echo(
echo #### Build failed - see messages above. 1>&2
goto :eof

:installcmake
Expand Down
5 changes: 1 addition & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ pushd "$SCRIPT_DIR" >/dev/null
set -e
set -x

# update any git submodules, currently rpclib
git submodule update --init --recursive

# 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"
Expand Down Expand Up @@ -71,7 +68,7 @@ cp $build_dir/output/lib/libAirSim-rpclib.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/include AirLib/deps/rpclib
rsync -a --delete external/rpclib/rpclib-2.2.1/include AirLib/deps/rpclib
rsync -a --delete MavLinkCom/include AirLib/deps/MavLinkCom
rsync -a --delete AirLib Unreal/Plugins/AirSim/Source

Expand Down
49 changes: 49 additions & 0 deletions check_cmake.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@echo off
REM //---------- set up variable ----------
setlocal
set ROOT_DIR=%~dp0

set cmake_minversion_minmaj=" 3. 9"

set "cmake_version= . "

where /q cmake
if %ERRORLEVEL% EQU 0 (
for /F "tokens=3" %%a in ('cmake --version ^| find "cmake version"') do set cmake_version=%%a
if "%cmake_version%" == "" (
echo Unable to get version of cmake. >&2
exit /b 2
)
) else (
echo cmake was not found in path.
goto :download_install
)

set cmake_ver_major=
set cmake_ver_minor=
for /F "tokens=1,2 delims=." %%a in ("%cmake_version%") do (
set "cmake_ver_major= %%a"
set "cmake_ver_minor= %%b"
)
set cmake_ver_minmaj="%cmake_ver_major:~-4%.%cmake_ver_minor:~-4%"
if %cmake_ver_minmaj% LSS %cmake_minversion_minmaj% (
echo(
echo Newer AirSim requires cmake verion %cmake_minversion_minmaj% but you have %cmake_ver_minmaj% which is older. >&2
goto :download_install
)

echo Found cmake version: %cmake_version%
exit /b 0

:download_install
set /p choice="Press any key to download and install cmake (make sure to add it in path in install options)"

IF NOT EXIST %temp%\cmake-3.10.2-win64-x64.msi (
@echo on
powershell -command "& { iwr https://cmake.org/files/v3.10/cmake-3.10.2-win64-x64.msi -OutFile %temp%\cmake-3.10.2-win64-x64.msi }"
@echo off
)

msiexec.exe /i "%temp%\cmake-3.10.2-win64-x64.msi"

exit /b 1
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" "${CMAKE_CURRENT_BINARY_DIR}/rpclib")
add_subdirectory("${AIRSIM_ROOT}/external/rpclib/rpclib-2.2.1" "${CMAKE_CURRENT_BINARY_DIR}/rpclib")
1 change: 0 additions & 1 deletion external/rpclib
Submodule rpclib deleted from 9885c0

0 comments on commit 60a45ab

Please sign in to comment.