build_single_artifact.bat 2.6 KB

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