1*e07d83d3SAndroid Build Coastguard Workerset PROTOBUF_VER=21.7 2*e07d83d3SAndroid Build Coastguard Workerset CMAKE_NAME=cmake-3.3.2-win32-x86 3*e07d83d3SAndroid Build Coastguard Worker 4*e07d83d3SAndroid Build Coastguard Workerif not exist "protobuf-%PROTOBUF_VER%\build\Release\" ( 5*e07d83d3SAndroid Build Coastguard Worker call :installProto || exit /b 1 6*e07d83d3SAndroid Build Coastguard Worker) 7*e07d83d3SAndroid Build Coastguard Worker 8*e07d83d3SAndroid Build Coastguard Workerecho Compile gRPC-Java with something like: 9*e07d83d3SAndroid Build Coastguard Workerecho -PtargetArch=x86_32 -PvcProtobufLibs=%cd%\protobuf-%PROTOBUF_VER%\build\Release -PvcProtobufInclude=%cd%\protobuf-%PROTOBUF_VER%\build\include 10*e07d83d3SAndroid Build Coastguard Workergoto :eof 11*e07d83d3SAndroid Build Coastguard Worker 12*e07d83d3SAndroid Build Coastguard Worker 13*e07d83d3SAndroid Build Coastguard Worker:installProto 14*e07d83d3SAndroid Build Coastguard Worker 15*e07d83d3SAndroid Build Coastguard Workerwhere /q cmake 16*e07d83d3SAndroid Build Coastguard Workerif not ERRORLEVEL 1 goto :hasCmake 17*e07d83d3SAndroid Build Coastguard Workerif not exist "%CMAKE_NAME%" ( 18*e07d83d3SAndroid Build Coastguard Worker call :installCmake || exit /b 1 19*e07d83d3SAndroid Build Coastguard Worker) 20*e07d83d3SAndroid Build Coastguard Workerset PATH=%PATH%;%cd%\%CMAKE_NAME%\bin 21*e07d83d3SAndroid Build Coastguard Worker:hasCmake 22*e07d83d3SAndroid Build Coastguard Worker@rem GitHub requires TLSv1.2, and for whatever reason our powershell doesn't have it enabled 23*e07d83d3SAndroid Build Coastguard Workerpowershell -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 24*e07d83d3SAndroid Build Coastguard Workerpowershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('protobuf.zip', '.') }" || exit /b 1 25*e07d83d3SAndroid Build Coastguard Workerdel protobuf.zip 26*e07d83d3SAndroid Build Coastguard Workermkdir protobuf-%PROTOBUF_VER%\build 27*e07d83d3SAndroid Build Coastguard Workerpushd protobuf-%PROTOBUF_VER%\build 28*e07d83d3SAndroid Build Coastguard Worker 29*e07d83d3SAndroid Build Coastguard Worker@rem Workaround https://github.com/protocolbuffers/protobuf/issues/10174 30*e07d83d3SAndroid Build Coastguard Workerpowershell -command "(Get-Content ..\cmake\extract_includes.bat.in) -replace '\.\.\\', '' | Out-File -encoding ascii ..\cmake\extract_includes.bat.in" 31*e07d83d3SAndroid Build Coastguard Worker@rem cmake does not detect x86_64 from the vcvars64.bat variables. 32*e07d83d3SAndroid Build Coastguard Worker@rem If vcvars64.bat has set PLATFORM to X64, then inform cmake to use the Win64 version of VS 33*e07d83d3SAndroid Build Coastguard Workerif "%PLATFORM%" == "X64" ( 34*e07d83d3SAndroid Build Coastguard Worker @rem Note the space 35*e07d83d3SAndroid Build Coastguard Worker SET CMAKE_VSARCH= Win64 36*e07d83d3SAndroid Build Coastguard Worker) else ( 37*e07d83d3SAndroid Build Coastguard Worker SET CMAKE_VSARCH= 38*e07d83d3SAndroid Build Coastguard Worker) 39*e07d83d3SAndroid Build Coastguard Workercmake -Dprotobuf_BUILD_TESTS=OFF -G "Visual Studio %VisualStudioVersion:~0,2%%CMAKE_VSARCH%" .. || exit /b 1 40*e07d83d3SAndroid Build Coastguard Workermsbuild /maxcpucount /p:Configuration=Release /verbosity:minimal libprotoc.vcxproj || exit /b 1 41*e07d83d3SAndroid Build Coastguard Workercall extract_includes.bat || exit /b 1 42*e07d83d3SAndroid Build Coastguard Workerpopd 43*e07d83d3SAndroid Build Coastguard Workergoto :eof 44*e07d83d3SAndroid Build Coastguard Worker 45*e07d83d3SAndroid Build Coastguard Worker 46*e07d83d3SAndroid Build Coastguard Worker:installCmake 47*e07d83d3SAndroid Build Coastguard Worker 48*e07d83d3SAndroid Build Coastguard Workerpowershell -command "$ErrorActionPreference = 'stop'; & { iwr https://cmake.org/files/v3.3/%CMAKE_NAME%.zip -OutFile cmake.zip }" || exit /b 1 49*e07d83d3SAndroid Build Coastguard Workerpowershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('cmake.zip', '.') }" || exit /b 1 50*e07d83d3SAndroid Build Coastguard Workerdel cmake.zip 51*e07d83d3SAndroid Build Coastguard Workergoto :eof 52