1
0

WinBuild.cmd 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. @echo off
  2. @setlocal EnableDelayedExpansion
  3. REM ------Set Your Environment-------------------------------
  4. if NOT DEFINED MSVC_VERSION set MSVC_VERSION=15
  5. if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release
  6. if NOT DEFINED PYTHONHOME set PYTHONHOME=C:/Users/%username%/Anaconda3
  7. REM ---------------------------------------------------------
  8. set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7"
  9. set VALUE_NAME=15.0
  10. if "%MSVC_VERSION%"=="14" (
  11. if "%processor_architecture%" == "AMD64" (
  12. set CMAKE_GENERATOR=Visual Studio 14 2015 Win64
  13. ) else (
  14. set CMAKE_GENERATOR=Visual Studio 14 2015
  15. )
  16. ) else if "%MSVC_VERSION%"=="12" (
  17. if "%processor_architecture%" == "AMD64" (
  18. set CMAKE_GENERATOR=Visual Studio 12 2013 Win64
  19. ) else (
  20. set CMAKE_GENERATOR=Visual Studio 12 2013
  21. )
  22. ) else if "%MSVC_VERSION%"=="15" (
  23. if "%processor_architecture%" == "AMD64" (
  24. set CMAKE_GENERATOR=Visual Studio 15 2017 Win64
  25. ) else (
  26. set CMAKE_GENERATOR=Visual Studio 15 2017
  27. )
  28. )
  29. if "%MSVC_VERSION%"=="15" (
  30. for /F "usebackq tokens=1,2,*" %%A in (`REG QUERY %KEY_NAME% /v %VALUE_NAME%`) do (
  31. set batch_file=%%CVC\Auxiliary\Build\vcvarsall.bat
  32. )
  33. ) else (
  34. set batch_file=!VS%MSVC_VERSION%0COMNTOOLS!..\..\VC\vcvarsall.bat
  35. )
  36. call "%batch_file%" %processor_architecture%
  37. pushd ..
  38. pushd examples
  39. if NOT EXIST build mkdir build
  40. pushd build
  41. cmake -G"!CMAKE_GENERATOR!" ^
  42. -DPYTHONHOME:STRING=%PYTHONHOME%^
  43. -DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG% ^
  44. %~dp0
  45. cmake --build . --config %CMAKE_CONFIG%
  46. pushd %CMAKE_CONFIG%
  47. if not EXIST platforms mkdir platforms
  48. if EXIST %PYTHONHOME%/Library/plugins/platforms/qwindows.dll ^
  49. cp %PYTHONHOME%/Library/plugins/platforms/qwindows.dll ./platforms/
  50. popd
  51. REM move ./%CMAKE_CONFIG% ../
  52. popd
  53. popd
  54. popd
  55. @endlocal