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 21REM Prepend newly installed Python to the PATH of this build (this cannot be 22REM done from inside the powershell script as it would require to restart 23REM the parent CMD process). 24SET PATH=%PYTHON%;%PYTHON%\Scripts;%OLD_PATH% 25python -m pip install -U pip 26pip install wheel 27 28REM Check that we have the expected version and architecture for Python 29python --version 30python -c "import struct; print(struct.calcsize('P') * 8)" 31 32rmdir /s/q %REPO_DIR% 33xcopy /s %REPO_DIR_STAGE% "%REPO_DIR%\" 34 35REM Checkout release commit 36cd %REPO_DIR% 37 38REM ====================== 39REM Build Protobuf Library 40REM ====================== 41 42mkdir src\.libs 43 44mkdir vcprojects 45pushd vcprojects 46cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -Dprotobuf_BUILD_TESTS=OFF ../cmake || goto :error 47msbuild protobuf.sln /p:Platform=%vcplatform% /p:Configuration=Release || goto :error 48dir /s /b 49popd 50copy vcprojects\Release\libprotobuf.lib src\.libs\libprotobuf.a 51copy vcprojects\Release\libprotobuf-lite.lib src\.libs\libprotobuf-lite.a 52SET PATH=%cd%\vcprojects\Release;%PATH% 53dir vcprojects\Release 54 55REM ====================== 56REM Build python library 57REM ====================== 58 59cd python 60 61REM sed -i 's/\ extra_compile_args\ =\ \[\]/\ extra_compile_args\ =\ \[\'\/MT\'\]/g' setup.py 62 63python setup.py bdist_wheel --cpp_implementation --compile_static_extension 64dir dist 65copy dist\* %ARTIFACT_DIR% 66dir %ARTIFACT_DIR% 67cd ..\.. 68 69goto :EOF 70 71:error 72exit /b %errorlevel% 73