WinBuild.cmd 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. @echo off
  2. @setlocal EnableDelayedExpansion
  3. if NOT DEFINED MSVC_VERSION set MSVC_VERSION=14
  4. if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release
  5. if NOT DEFINED PYTHONHOME set PYTHONHOME=C:/Users/%username%/Anaconda3
  6. if "%MSVC_VERSION%"=="14" (
  7. if "%processor_architecture%" == "AMD64" (
  8. set CMAKE_GENERATOR=Visual Studio 14 2015 Win64
  9. ) else (
  10. set CMAKE_GENERATOR=Visual Studio 14 2015
  11. )
  12. ) else if "%MSVC_VERSION%"=="12" (
  13. if "%processor_architecture%" == "AMD64" (
  14. set CMAKE_GENERATOR=Visual Studio 12 2013 Win64
  15. ) else (
  16. set CMAKE_GENERATOR=Visual Studio 12 2013
  17. )
  18. )
  19. set batch_file=!VS%MSVC_VERSION%0COMNTOOLS!..\..\VC\vcvarsall.bat
  20. call "%batch_file%" %processor_architecture%
  21. pushd ..
  22. pushd examples
  23. if NOT EXIST build mkdir build
  24. pushd build
  25. cmake -G"!CMAKE_GENERATOR!" ^
  26. -DPYTHONHOME:STRING=%PYTHONHOME%^
  27. -DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG% ^
  28. ../../Win/
  29. cmake --build . --config %CMAKE_CONFIG%
  30. pushd %CMAKE_CONFIG%
  31. if not EXIST platforms mkdir platforms
  32. if EXIST %PYTHONHOME%/Library/plugins/platforms/qwindows.dll ^
  33. cp %PYTHONHOME%/Library/plugins/platforms/qwindows.dll ./platforms/
  34. popd
  35. move ./%CMAKE_CONFIG% ../
  36. popd
  37. popd
  38. popd
  39. @endlocal