windows.bat 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. @echo off
  2. set build_dir=build
  3. set source_dir=.
  4. set generator=-G Ninja
  5. set build_type_debug=Debug
  6. set build_type_release=Relase
  7. set build_type=%build_type_debug%
  8. set universal=ON
  9. set qt=ON
  10. set qt5=ON
  11. set qt6=OFF
  12. echo finding vcvars64.bat...
  13. set vcvars=
  14. for %%i in (C: D: E: F: G: H:) do (
  15. if exist %%i (
  16. pushd %%i\
  17. for /r %%j in (*vcvars64.bat) do (
  18. set vcvars=%%j
  19. popd
  20. goto :find_vcvars
  21. )
  22. popd
  23. )
  24. )
  25. :find_vcvars
  26. if not "%vcvars%"=="" (
  27. call "%vcvars%"
  28. echo config MSVC environment...
  29. )else (
  30. echo error: could not find vcvars64.bat MSVC ENV config file.
  31. goto :out
  32. )
  33. echo finding qt msvc path...
  34. set qt_msvc=
  35. for %%i in (D: D: E: F: G: H:) do (
  36. if exist %%i (
  37. pushd %%i\
  38. for /d /r %%j in (*msvc20*) do (
  39. echo %%j
  40. if exist %%j\bin (
  41. if exist %%j\bin\windeployqt.exe (
  42. if exist %%j\bin\Qt5Core.dll (
  43. set qt_msvc=%%j
  44. popd
  45. goto :find_qt_msvc
  46. )
  47. )
  48. )
  49. )
  50. popd
  51. )
  52. )
  53. :find_qt_msvc
  54. if not "%qt_msvc%"=="" (
  55. echo config qt msvc path...
  56. ) else (
  57. echo error: could not find qt msvc path.
  58. goto :out
  59. )
  60. cmake -B%build_dir% CMAKE_BUILD_TYPE=%build_type% %generator% -DUSE_WINDOWS_UNIVERSAL=%universal% -DWINDOWS_DEPLOY_QT=%qt% -DWINDOWS_DEPLOY_QT5=%qt5% -DWINDOWS_DEPLOY_QT6=%qt6% -DCMAKE_PREFIX_PATH=%qt_msvc% %source_dir%
  61. cmake --build %build_dir% --
  62. xcopy %build_dir%\windows-deployqt\Notepad--.app\bin\ %build_dir%\bin\ /e
  63. :out
  64. pause