build_single_artifact.bat 2.3 KB

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