build_single_artifact.bat 2.1 KB

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