blob: 691520eaef9b3ea2ba9c9d49ec9893465a119f77 [file] [log] [blame]
Kun Zhang86d64122018-01-05 16:40:20 -08001set PROTOBUF_VER=3.5.1
Eric Andersond04994f2015-09-24 15:27:26 -07002set CMAKE_NAME=cmake-3.3.2-win32-x86
3
Eric Anderson2467d612015-10-22 18:11:44 -07004if not exist "protobuf-%PROTOBUF_VER%\cmake\build\Release\" (
Eric Anderson4bd4cf42018-02-23 10:17:15 -08005 call :installProto || exit /b 1
Eric Andersond04994f2015-09-24 15:27:26 -07006)
Eric Andersona99e9772015-10-01 11:38:49 -07007
8echo Compile gRPC-Java with something like:
9echo -PtargetArch=x86_32 -PvcProtobufLibs=%cd%\protobuf-%PROTOBUF_VER%\cmake\build\Release -PvcProtobufInclude=%cd%\protobuf-%PROTOBUF_VER%\cmake\build\include
Eric Andersond04994f2015-09-24 15:27:26 -070010goto :eof
11
12
13:installProto
14
Eric Andersonf48a5092018-02-05 11:13:50 -080015where /q cmake
16if not ERRORLEVEL 1 goto :hasCmake
Eric Andersond04994f2015-09-24 15:27:26 -070017if not exist "%CMAKE_NAME%" (
Eric Anderson4bd4cf42018-02-23 10:17:15 -080018 call :installCmake || exit /b 1
Eric Andersond04994f2015-09-24 15:27:26 -070019)
20set PATH=%PATH%;%cd%\%CMAKE_NAME%\bin
Eric Andersonf48a5092018-02-05 11:13:50 -080021:hasCmake
Eric Anderson9f677a92018-02-23 13:06:29 -080022@rem GitHub requires TLSv1.2, and for whatever reason our powershell doesn't have it enabled
Eric Andersonab92ff02018-02-23 11:30:27 -080023powershell -command "$ErrorActionPreference = 'stop'; & { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; iwr https://github.com/google/protobuf/archive/v%PROTOBUF_VER%.zip -OutFile protobuf.zip }" || exit /b 1
24powershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('protobuf.zip', '.') }" || exit /b 1
Eric Andersond04994f2015-09-24 15:27:26 -070025del protobuf.zip
Eric Andersonb1d72e52016-09-27 17:15:12 -070026pushd protobuf-%PROTOBUF_VER%\cmake
Eric Andersond04994f2015-09-24 15:27:26 -070027mkdir build
28cd build
zpencer19a64cc2018-03-22 17:56:59 -070029
30@rem cmake does not detect x86_64 from the vcvars64.bat variables.
31@rem If vcvars64.bat has set PLATFORM to X64, then inform cmake to use the Win64 version of VS
32if "%PLATFORM%" == "X64" (
33 @rem Note the space
34 SET CMAKE_VSARCH= Win64
35) else (
36 SET CMAKE_VSARCH=
37)
38cmake -Dprotobuf_BUILD_TESTS=OFF -G "Visual Studio %VisualStudioVersion:~0,2%%CMAKE_VSARCH%" .. || exit /b 1
Eric Anderson4bd4cf42018-02-23 10:17:15 -080039msbuild /maxcpucount /p:Configuration=Release libprotoc.vcxproj || exit /b 1
40call extract_includes.bat || exit /b 1
Eric Andersond04994f2015-09-24 15:27:26 -070041popd
42goto :eof
43
44
45:installCmake
46
Eric Andersonab92ff02018-02-23 11:30:27 -080047powershell -command "$ErrorActionPreference = 'stop'; & { iwr https://cmake.org/files/v3.3/%CMAKE_NAME%.zip -OutFile cmake.zip }" || exit /b 1
48powershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('cmake.zip', '.') }" || exit /b 1
Eric Andersond04994f2015-09-24 15:27:26 -070049del cmake.zip
50goto :eof