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