2022-10-05 01:22:52 +08:00
|
|
|
set PROTOBUF_VER=21.7
|
2015-09-25 06:27:26 +08:00
|
|
|
set CMAKE_NAME=cmake-3.3.2-win32-x86
|
|
|
|
|
2022-07-01 02:18:49 +08:00
|
|
|
if not exist "protobuf-%PROTOBUF_VER%\build\Release\" (
|
2018-02-24 02:17:15 +08:00
|
|
|
call :installProto || exit /b 1
|
2015-09-25 06:27:26 +08:00
|
|
|
)
|
2015-10-02 02:38:49 +08:00
|
|
|
|
|
|
|
echo Compile gRPC-Java with something like:
|
2022-07-01 02:18:49 +08:00
|
|
|
echo -PtargetArch=x86_32 -PvcProtobufLibs=%cd%\protobuf-%PROTOBUF_VER%\build\Release -PvcProtobufInclude=%cd%\protobuf-%PROTOBUF_VER%\build\include
|
2015-09-25 06:27:26 +08:00
|
|
|
goto :eof
|
|
|
|
|
|
|
|
|
|
|
|
:installProto
|
|
|
|
|
2018-02-06 03:13:50 +08:00
|
|
|
where /q cmake
|
|
|
|
if not ERRORLEVEL 1 goto :hasCmake
|
2015-09-25 06:27:26 +08:00
|
|
|
if not exist "%CMAKE_NAME%" (
|
2018-02-24 02:17:15 +08:00
|
|
|
call :installCmake || exit /b 1
|
2015-09-25 06:27:26 +08:00
|
|
|
)
|
|
|
|
set PATH=%PATH%;%cd%\%CMAKE_NAME%\bin
|
2018-02-06 03:13:50 +08:00
|
|
|
:hasCmake
|
2018-02-24 05:06:29 +08:00
|
|
|
@rem GitHub requires TLSv1.2, and for whatever reason our powershell doesn't have it enabled
|
2018-02-24 03:30:27 +08:00
|
|
|
powershell -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
|
|
|
|
powershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('protobuf.zip', '.') }" || exit /b 1
|
2015-09-25 06:27:26 +08:00
|
|
|
del protobuf.zip
|
2022-07-01 02:18:49 +08:00
|
|
|
mkdir protobuf-%PROTOBUF_VER%\build
|
|
|
|
pushd protobuf-%PROTOBUF_VER%\build
|
2018-03-23 08:56:59 +08:00
|
|
|
|
2022-07-01 02:18:49 +08:00
|
|
|
@rem Workaround https://github.com/protocolbuffers/protobuf/issues/10174
|
|
|
|
powershell -command "(Get-Content ..\cmake\extract_includes.bat.in) -replace '\.\.\\', '' | Out-File -encoding ascii ..\cmake\extract_includes.bat.in"
|
2018-03-23 08:56:59 +08:00
|
|
|
@rem cmake does not detect x86_64 from the vcvars64.bat variables.
|
|
|
|
@rem If vcvars64.bat has set PLATFORM to X64, then inform cmake to use the Win64 version of VS
|
|
|
|
if "%PLATFORM%" == "X64" (
|
|
|
|
@rem Note the space
|
|
|
|
SET CMAKE_VSARCH= Win64
|
|
|
|
) else (
|
|
|
|
SET CMAKE_VSARCH=
|
|
|
|
)
|
|
|
|
cmake -Dprotobuf_BUILD_TESTS=OFF -G "Visual Studio %VisualStudioVersion:~0,2%%CMAKE_VSARCH%" .. || exit /b 1
|
2018-09-08 06:28:45 +08:00
|
|
|
msbuild /maxcpucount /p:Configuration=Release /verbosity:minimal libprotoc.vcxproj || exit /b 1
|
2018-02-24 02:17:15 +08:00
|
|
|
call extract_includes.bat || exit /b 1
|
2015-09-25 06:27:26 +08:00
|
|
|
popd
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
|
|
|
|
:installCmake
|
|
|
|
|
2018-02-24 03:30:27 +08:00
|
|
|
powershell -command "$ErrorActionPreference = 'stop'; & { iwr https://cmake.org/files/v3.3/%CMAKE_NAME%.zip -OutFile cmake.zip }" || exit /b 1
|
|
|
|
powershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('cmake.zip', '.') }" || exit /b 1
|
2015-09-25 06:27:26 +08:00
|
|
|
del cmake.zip
|
|
|
|
goto :eof
|