build_windows.bat 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. REM
  4. REM Copyright (c) Contributors to the Open 3D Engine Project.
  5. REM For complete copyright and license terms please see the LICENSE at the root of this distribution.
  6. REM
  7. REM SPDX-License-Identifier: Apache-2.0 OR MIT
  8. REM
  9. REM
  10. REM https://doc.qt.io/qtforpython/gettingstarted-windows.html
  11. echo.
  12. echo TEMP_FOLDER=%TEMP_FOLDER%
  13. echo.
  14. SET CURRENT_PATH=%CD%
  15. REM Set these before running the script
  16. if not defined VCVARS_PATH set VCVARS_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
  17. REM TEMP_FOLDER and TARGET_INSTALL_ROOT get set from the pull_and_build_from_git.py script
  18. set CHECKS_FAILED=0
  19. for %%P IN (VCVARS_PATH,TEMP_FOLDER,TARGET_INSTALL_ROOT) do (
  20. if not exist !%%P! (
  21. echo %%P not found at !%%P!
  22. set CHECKS_FAILED=1
  23. )
  24. )
  25. echo Setting up VS2019
  26. call %VCVARS_PATH% amd64
  27. REM Get the python executable from the package dependency
  28. SET LOCAL_PYTHON37_BIN=%TEMP_FOLDER%\\python-3.10.5-rev1-windows\python\python.exe
  29. IF EXIST %LOCAL_PYTHON37_BIN% (
  30. echo Using Python located at %LOCAL_PYTHON37_BIN%
  31. ) ELSE (
  32. echo ERROR: Unable to find Python at %LOCAL_PYTHON37_BIN%
  33. exit /b 1
  34. )
  35. SET LOCAL_3P_QTBUILD_PATH=%TEMP_FOLDER%\qt-5.15.2-rev7-windows\qt
  36. IF EXIST %LOCAL_3P_QTBUILD_PATH% (
  37. echo Using Qt located at %LOCAL_3P_QTBUILD_PATH%
  38. ) ELSE (
  39. echo ERROR: Unable to find Qt at %LOCAL_3P_QTBUILD_PATH%
  40. exit /b 1
  41. )
  42. SET LOCAL_3P_QTBUILD_QMAKE_PATH=%LOCAL_3P_QTBUILD_PATH%\bin\qmake.exe
  43. SET LOCAL_3P_QTBUILD_LIB_PATH=%LOCAL_3P_QTBUILD_PATH%\lib
  44. SET LLVM_INSTALL_DIR=%TEMP_FOLDER%\libclang-release_130-based-windows-vs2019_64\libclang
  45. SET PATH=%LLVM_INSTALL_DIR%\bin;%PATH%
  46. echo Created Python Virtual ENV
  47. cd temp
  48. %LOCAL_PYTHON37_BIN% -m venv testenv
  49. call testenv\Scripts\activate
  50. call testenv\Scripts\pip.exe install -r src\requirements.txt
  51. if %ERRORLEVEL% NEQ 0 (
  52. echo "Failed to create venv"
  53. exit /B 1
  54. )
  55. cd src
  56. echo call ..\testenv\Scripts\activate.bat
  57. call ..\testenv\Scripts\activate.bat
  58. ECHO Building Pyside2 (Debug)
  59. SET PYTHON_LIBRARIES==%TEMP_FOLDER%\python-3.10.5-rev1-windows\python\libs\python39_d.lib
  60. SET PYTHON_DEBUG_LIBRARIES==%TEMP_FOLDER%\python-3.10.5-rev1-windows\python\libs\python39_d.lib
  61. echo call ..\testenv\Scripts\python_d.exe setup.py install --qmake=%LOCAL_3P_QTBUILD_QMAKE_PATH% --build-type=all --debug --limited-api=no --skip-modules=Qml,Quick,QuickWidgets,Positioning,Location,RemoteObjects,Scxml,TextToSpeech,3DCore,3DRender,3DInput,3DLogic,3DAnimation,3DExtras,Multimedia,MultimediaWidgets,AxContainer
  62. call ..\testenv\Scripts\python_d.exe setup.py install --qmake=%LOCAL_3P_QTBUILD_QMAKE_PATH% --build-type=all --debug --limited-api=no --skip-modules=Qml,Quick,QuickWidgets,Positioning,Location,RemoteObjects,Scxml,TextToSpeech,3DCore,3DRender,3DInput,3DLogic,3DAnimation,3DExtras,Multimedia,MultimediaWidgets,AxContainer
  63. if %ERRORLEVEL% NEQ 0 (
  64. echo "Failed to build pyside2 (debug)"
  65. exit /B 1
  66. )
  67. ECHO Building Pyside2 (Release)
  68. echo call ..\testenv\Scripts\python.exe setup.py install --qmake=%LOCAL_3P_QTBUILD_QMAKE_PATH% --build-type=all --limited-api=yes --skip-modules=Qml,Quick,QuickWidgets,Positioning,Location,RemoteObjects,Scxml,TextToSpeech,3DCore,3DRender,3DInput,3DLogic,3DAnimation,3DExtras,Multimedia,MultimediaWidgets,AxContainer
  69. call ..\testenv\Scripts\python.exe setup.py install --qmake=%LOCAL_3P_QTBUILD_QMAKE_PATH% --build-type=all --limited-api=yes --skip-modules=Qml,Quick,QuickWidgets,Positioning,Location,RemoteObjects,Scxml,TextToSpeech,3DCore,3DRender,3DInput,3DLogic,3DAnimation,3DExtras,Multimedia,MultimediaWidgets,AxContainer
  70. if %ERRORLEVEL% NEQ 0 (
  71. echo "Failed to build pyside2 (release)"
  72. exit /B 1
  73. )
  74. echo call ..\testenv\Scripts\deactivate.bat
  75. call ..\testenv\Scripts\deactivate.bat
  76. cd %CURRENT_PATH%
  77. exit /B 0