Skip to content

Commit

Permalink
Change rpclib to a fork version which offers patches
Browse files Browse the repository at this point in the history
The original rpclib have bugs that cause Unreal crashes, sometimes the client also crashes as well. It lacks maintenance for two years, but a fork qchateau/rpclib offers patches.
  • Loading branch information
songxiaocheng committed Dec 10, 2019
1 parent 8e40837 commit b4db859
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
21 changes: 11 additions & 10 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ if ERRORLEVEL 1 (
)

REM //---------- get rpclib ----------
set RPC_VERSION=c4fb37acbe67ec99e47e5187acd2a7450bde0cec
IF NOT EXIST external\rpclib mkdir external\rpclib
IF NOT EXIST external\rpclib\rpclib-2.2.1 (
IF NOT EXIST external\rpclib\rpclib-%RPC_VERSION% (
REM //leave some blank lines because powershell shows download banner at top of console
ECHO(
ECHO(
Expand All @@ -56,7 +57,7 @@ IF NOT EXIST external\rpclib\rpclib-2.2.1 (
ECHO Downloading rpclib
ECHO *****************************************************************************************
@echo on
powershell -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/rpclib/rpclib/archive/v2.2.1.zip -OutFile external\rpclib.zip }"
powershell -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/qchateau/rpclib/archive/%RPC_VERSION%.zip -OutFile external\rpclib.zip }"
@echo off

REM //remove any previous versions
Expand All @@ -67,16 +68,16 @@ IF NOT EXIST external\rpclib\rpclib-2.2.1 (

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 (
IF NOT EXIST external\rpclib\rpclib-%RPC_VERSION% (
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\rpclib-%RPC_VERSION%\build mkdir external\rpclib\rpclib-%RPC_VERSION%\build
cd external\rpclib\rpclib-%RPC_VERSION%\build
REM cmake -G"Visual Studio 14 2015 Win64" ..
cmake -G"Visual Studio 15 2017 Win64" ..

Expand All @@ -97,15 +98,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\rpclib-%RPC_VERSION%\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\rpclib-%RPC_VERSION%\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\rpclib-%RPC_VERSION%\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\rpclib-%RPC_VERSION%\build\Debug %RPCLIB_TARGET_LIB%\Debug
robocopy /MIR external\rpclib\rpclib-%RPC_VERSION%\build\Release %RPCLIB_TARGET_LIB%\Release
)

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 @@ -25,7 +25,8 @@ esac
done

# check for rpclib
if [ ! -d "./external/rpclib/rpclib-2.2.1" ]; then
RPC_VERSION=c4fb37acbe67ec99e47e5187acd2a7450bde0cec
if [ ! -d "./external/rpclib/rpclib-${RPC_VERSION}" ]; 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 @@ -133,7 +134,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/rpclib-${RPC_VERSION}/include AirLib/deps/rpclib
rsync -a --delete MavLinkCom/include AirLib/deps/MavLinkCom
rsync -a --delete AirLib Unreal/Plugins/AirSim/Source

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 @@ -41,7 +41,7 @@ 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_VERSION_FOLDER rpclib-2.2.1)
set(RPCLIB_VERSION_FOLDER rpclib-c4fb37acbe67ec99e47e5187acd2a7450bde0cec)
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
9 changes: 5 additions & 4 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,20 @@ else #linux
fi

# Download rpclib
if [ ! -d "external/rpclib/rpclib-2.2.1" ]; then
RPC_VERSION=c4fb37acbe67ec99e47e5187acd2a7450bde0cec
if [ ! -d "external/rpclib/rpclib-${RPC_VERSION}" ]; then
echo "*********************************************************************************************"
echo "Downloading rpclib..."
echo "*********************************************************************************************"

wget https://github.com/rpclib/rpclib/archive/v2.2.1.zip
wget https://github.com/qchateau/rpclib/archive/${RPC_VERSION}.zip -O rpclib.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
unzip rpclib.zip -d external/rpclib
rm rpclib.zip
fi

# Download high-polycount SUV model
Expand Down

0 comments on commit b4db859

Please sign in to comment.