build_single_artifact.bat 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. setlocal
  2. if %PYTHON%==C:\python35_32bit set generator=Visual Studio 14
  3. if %PYTHON%==C:\python35_32bit set vcplatform=Win32
  4. if %PYTHON%==C:\python35 set generator=Visual Studio 14 Win64
  5. if %PYTHON%==C:\python35 set vcplatform=x64
  6. if %PYTHON%==C:\python36_32bit set generator=Visual Studio 14
  7. if %PYTHON%==C:\python36_32bit set vcplatform=Win32
  8. if %PYTHON%==C:\python36 set generator=Visual Studio 14 Win64
  9. if %PYTHON%==C:\python36 set vcplatform=x64
  10. REM Prepend newly installed Python to the PATH of this build (this cannot be
  11. REM done from inside the powershell script as it would require to restart
  12. REM the parent CMD process).
  13. SET PATH=%PYTHON%;%PYTHON%\Scripts;%OLD_PATH%
  14. python -m pip install -U pip
  15. pip install wheel
  16. REM Check that we have the expected version and architecture for Python
  17. python --version
  18. python -c "import struct; print(struct.calcsize('P') * 8)"
  19. rmdir /s/q protobuf
  20. git clone https://github.com/google/protobuf.git
  21. REM Checkout release commit
  22. cd %REPO_DIR%
  23. git checkout %BUILD_COMMIT%
  24. REM ======================
  25. REM Build Protobuf Library
  26. REM ======================
  27. mkdir src\.libs
  28. mkdir vcprojects
  29. pushd vcprojects
  30. cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -Dprotobuf_BUILD_TESTS=OFF ../cmake
  31. msbuild protobuf.sln /p:Platform=%vcplatform% /p:Configuration=Release
  32. dir /s /b
  33. popd
  34. copy vcprojects\Release\libprotobuf.lib src\.libs\libprotobuf.a
  35. copy vcprojects\Release\libprotobuf-lite.lib src\.libs\libprotobuf-lite.a
  36. SET PATH=%cd%\vcprojects\Release;%PATH%
  37. dir vcprojects\Release
  38. REM ======================
  39. REM Build python library
  40. REM ======================
  41. cd python
  42. REM sed -i 's/\ extra_compile_args\ =\ \[\]/\ extra_compile_args\ =\ \[\'\/MT\'\]/g' setup.py
  43. python setup.py bdist_wheel --cpp_implementation --compile_static_extension
  44. dir dist
  45. copy dist\* %ARTIFACT_DIR%
  46. dir %ARTIFACT_DIR%
  47. cd ..\..