Skip to content

Instantly share code, notes, and snippets.

@marcgpuig
Last active May 16, 2018 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcgpuig/57946f9b684f64e5f08487089c437ea3 to your computer and use it in GitHub Desktop.
Save marcgpuig/57946f9b684f64e5f08487089c437ea3 to your computer and use it in GitHub Desktop.
BAT script that downloads and installs a ready to use protobuf build for CARLA (carla.org).
@echo off
rem BAT script that downloads and installs a ready to use
rem protobuf build for CARLA (carla.org).
rem Just put it in `Util/Build` and run it through a cmd
rem with the x64 Visual C++ Toolset enabled.
set local_path=%~dp0
set PROTO_VERSION=v3.3.2
set PROTO_SRC=protobuf-src
set PROTO_INSTALL=protobuf-install
echo.
if not exist "%local_path%\%PROTO_SRC%" (
echo Cloning Protobuf - version "%PROTO_VERSION%"...
echo.
call git clone --depth=1 -b %PROTO_VERSION% https://github.com/google/protobuf.git %PROTO_SRC%
echo done!
echo.
) else (
echo Not cloning protobuf because already exists a folder called "%PROTO_SRC%".
)
if exist "%local_path%\%PROTO_INSTALL%" (
@rd /s /q %PROTO_INSTALL% 2>nul
)
@mkdir %PROTO_INSTALL% 2>nul
@mkdir %PROTO_SRC%\cmake\build 2>nul
@cd %PROTO_SRC%\cmake\build
@cmake -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-Dprotobuf_BUILD_TESTS=OFF ^
-DCMAKE_CXX_FLAGS_RELEASE=/MD ^
-Dprotobuf_MSVC_STATIC_RUNTIME=OFF ^
-DCMAKE_INSTALL_PREFIX=%local_path%\protobuf-install ^
%local_path%\%PROTO_SRC%\cmake
@nmake
@nmake install
@cd %local_path%
rem Remove the downloaded protobuf source because is no more needed
rem if you want to keep the source just delete the following command.
@rd /s /q %PROTO_SRC% 2>nul
echo.
echo **************
echo * SUCCESS! *
echo **************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment