Skip to content

Commit

Permalink
Merge pull request microsoft#3642 from rajat2004/update-rpclib
Browse files Browse the repository at this point in the history
Update rpclib to new release
  • Loading branch information
zimmy87 authored May 21, 2021
2 parents 8c17ce4 + 9b4dda8 commit be49904
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Unity/AirLibWrapper/AirsimWrapper/cmake/rpc-setup.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
macro(BuildRpc)


set(RPC_SOURCE_DIR ${AIRSIM_ROOT}/external/rpclib/rpclib-2.2.1)
set(RPC_SOURCE_DIR ${AIRSIM_ROOT}/external/rpclib/rpclib-2.3.0)
include(${RPC_SOURCE_DIR}/cmake/policies.cmake)
include(${RPC_SOURCE_DIR}/cmake/msvc_support.cmake)
include(${RPC_SOURCE_DIR}/cmake/coverage.cmake)
Expand Down
5 changes: 3 additions & 2 deletions Unity/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ set -x
set -e

# check for rpclib
if [ ! -f ../external/rpclib/rpclib-2.2.1/rpclib.pc.in ]; then
RPC_VERSION_FOLDER="rpclib-2.3.0"
if [ ! -f ../external/rpclib/$RPC_VERSION_FOLDER/rpclib.pc.in ]; then
>&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
cp ../external/rpclib/$RPC_VERSION_FOLDER/rpclib.pc.in AirLibWrapper/AirsimWrapper/rpclib.pc.in

if [ ! -d "linux-build" ]; then
mkdir linux-build
Expand Down
27 changes: 14 additions & 13 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ if ERRORLEVEL 1 (

REM //---------- get rpclib ----------
IF NOT EXIST external\rpclib mkdir external\rpclib
IF NOT EXIST external\rpclib\rpclib-2.2.1 (

set RPC_VERSION_FOLDER=rpclib-2.3.0
IF NOT EXIST external\rpclib\%RPC_VERSION_FOLDER% (
REM //leave some blank lines because %powershell% shows download banner at top of console
ECHO(
ECHO(
Expand All @@ -74,9 +76,9 @@ IF NOT EXIST external\rpclib\rpclib-2.2.1 (
ECHO *****************************************************************************************
@echo on
if "%PWSHV7%" == "" (
%powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/madratman/rpclib/archive/v2.2.1.zip -OutFile external\rpclib.zip }"
%powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/rpclib/rpclib/archive/v2.3.0.zip -OutFile external\rpclib.zip }"
) else (
%powershell% -command "iwr https://github.com/madratman/rpclib/archive/v2.2.1.zip -OutFile external\rpclib.zip"
%powershell% -command "iwr https://github.com/rpclib/rpclib/archive/v2.3.0.zip -OutFile external\rpclib.zip"
)
@echo off

Expand All @@ -86,18 +88,17 @@ IF NOT EXIST external\rpclib\rpclib-2.2.1 (
%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.
REM //Fail the build if unable to download rpclib
IF NOT EXIST external\rpclib\%RPC_VERSION_FOLDER% (
ECHO Unable to download rpclib, stopping build
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\%RPC_VERSION_FOLDER%\build mkdir external\rpclib\%RPC_VERSION_FOLDER%\build
cd external\rpclib\%RPC_VERSION_FOLDER%\build
cmake -G"Visual Studio 16 2019" ..

if "%buildMode%" == "" (
Expand All @@ -115,13 +116,13 @@ 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\%RPC_VERSION_FOLDER%\include %RPCLIB_TARGET_INCLUDE%

if "%buildMode%" == "" (
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\%RPC_VERSION_FOLDER%\build\Debug %RPCLIB_TARGET_LIB%\Debug
robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\Release %RPCLIB_TARGET_LIB%\Release
) else (
robocopy /MIR external\rpclib\rpclib-2.2.1\build\%buildMode% %RPCLIB_TARGET_LIB%\%buildMode%
robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\%buildMode% %RPCLIB_TARGET_LIB%\%buildMode%
)

REM //---------- get High PolyCount SUV Car Model ------------
Expand Down
5 changes: 3 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ done
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
RPC_VERSION_FOLDER="rpclib-2.3.0"
if [ ! -d "./external/rpclib/$RPC_VERSION_FOLDER" ]; then
echo "ERROR: new version of AirSim requires newer rpclib."
echo "please run setup.sh first and then run build.sh again."
exit 1
Expand Down Expand Up @@ -108,7 +109,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/$folder_name
rsync -a --delete external/rpclib/rpclib-2.2.1/include AirLib/deps/rpclib
rsync -a --delete external/rpclib/$RPC_VERSION_FOLDER/include AirLib/deps/rpclib
rsync -a --delete MavLinkCom/include AirLib/deps/MavLinkCom
rsync -a --delete AirLib Unreal/Plugins/AirSim/Source
rm -rf Unreal/Plugins/AirSim/Source/AirLib/src
Expand Down
2 changes: 1 addition & 1 deletion cmake/cmake-modules/CommonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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(RPCLIB_VERSION_FOLDER rpclib-2.3.0)
set(RPC_LIB_INCLUDES " ${AIRSIM_ROOT}/external/rpclib/${RPCLIB_VERSION_FOLDER}/include")
#name of .a file with lib prefix
set(RPC_LIB rpc)
Expand Down
2 changes: 1 addition & 1 deletion ros/src/airsim_ros_pkgs/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/rpclib-2.3.0/include")
set(RPC_LIB rpc) # name of .a file with lib prefix
message(STATUS "found RPC_LIB_INCLUDES=${RPC_LIB_INCLUDES}")

Expand Down
8 changes: 4 additions & 4 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,19 @@ fi # End USB setup, CMake install


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

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

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

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

# Download high-polycount SUV model
Expand Down

0 comments on commit be49904

Please sign in to comment.