1setlocal 2 3if %PYTHON%==C:\python35_32bit set generator=Visual Studio 14 4if %PYTHON%==C:\python35_32bit set vcplatform=Win32 5 6if %PYTHON%==C:\python35 set generator=Visual Studio 14 Win64 7if %PYTHON%==C:\python35 set vcplatform=x64 8 9if %PYTHON%==C:\python36_32bit set generator=Visual Studio 14 10if %PYTHON%==C:\python36_32bit set vcplatform=Win32 11 12if %PYTHON%==C:\python36 set generator=Visual Studio 14 Win64 13if %PYTHON%==C:\python36 set vcplatform=x64 14 15if %PYTHON%==C:\python37_32bit set generator=Visual Studio 14 16if %PYTHON%==C:\python37_32bit set vcplatform=Win32 17 18if %PYTHON%==C:\python37 set generator=Visual Studio 14 Win64 19if %PYTHON%==C:\python37 set vcplatform=x64 20 21if %PYTHON%==C:\python38_32bit set generator=Visual Studio 14 22if %PYTHON%==C:\python38_32bit set vcplatform=Win32 23 24if %PYTHON%==C:\python38 set generator=Visual Studio 14 Win64 25if %PYTHON%==C:\python38 set vcplatform=x64 26 27REM Prepend newly installed Python to the PATH of this build (this cannot be 28REM done from inside the powershell script as it would require to restart 29REM the parent CMD process). 30SET PATH=%PYTHON%;%PYTHON%\Scripts;%OLD_PATH% 31python -m pip install -U pip 32pip install wheel 33 34REM Check that we have the expected version and architecture for Python 35python --version 36python -c "import struct; print(struct.calcsize('P') * 8)" 37 38rmdir /s/q %REPO_DIR% 39xcopy /s %REPO_DIR_STAGE% "%REPO_DIR%\" 40 41REM Checkout release commit 42cd %REPO_DIR% 43 44REM ====================== 45REM Build Protobuf Library 46REM ====================== 47 48mkdir src\.libs 49 50mkdir vcprojects 51pushd vcprojects 52cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -Dprotobuf_BUILD_TESTS=OFF ../cmake || goto :error 53msbuild protobuf.sln /p:Platform=%vcplatform% /p:Configuration=Release || goto :error 54dir /s /b 55popd 56copy vcprojects\Release\libprotobuf.lib src\.libs\libprotobuf.a 57copy vcprojects\Release\libprotobuf-lite.lib src\.libs\libprotobuf-lite.a 58SET PATH=%cd%\vcprojects\Release;%PATH% 59dir vcprojects\Release 60 61REM ====================== 62REM Build python library 63REM ====================== 64 65cd python 66 67REM sed -i 's/\ extra_compile_args\ =\ \[\]/\ extra_compile_args\ =\ \[\'\/MT\'\]/g' setup.py 68 69python setup.py bdist_wheel --cpp_implementation --compile_static_extension 70dir dist 71copy dist\* %ARTIFACT_DIR% 72dir %ARTIFACT_DIR% 73cd ..\.. 74 75goto :EOF 76 77:error 78exit /b %errorlevel% 79