blob: 5eb6ff31f85de9ff51fb5ceb7c1be0bd638da5c3 [file] [log] [blame]
James E. King, III07f59972017-03-10 06:18:33 -05001::
2:: Licensed under the Apache License, Version 2.0 (the "License");
3:: you may not use this file except in compliance with the License.
4:: You may obtain a copy of the License at
5::
6:: http://www.apache.org/licenses/LICENSE-2.0
7::
8:: Unless required by applicable law or agreed to in writing, software
9:: distributed under the License is distributed on an "AS IS" BASIS,
10:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11:: See the License for the specific language governing permissions and
12:: limitations under the License.
13::
14
15::
16:: Detect the compiler edition we're building in and then
17:: set the GENERATOR environment variable to one of:
18::
19:: Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
20:: Optional [arch] can be "Win64" or "ARM".
21:: Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
22:: Optional [arch] can be "Win64" or "ARM".
23:: Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
24:: Optional [arch] can be "Win64" or "ARM".
25:: Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
26:: Optional [arch] can be "Win64" or "ARM".
27:: Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
28:: Optional [arch] can be "Win64" or "IA64".
29:: MinGW Makefiles = Generates makefiles for MinGW
30:: MSYS Makefiles = Generates makefiles for MSYS
James E. King III860a5f12018-03-06 14:23:23 -050031:: Unix Makefiles = Generates makefiles for CYGWIN
James E. King, III07f59972017-03-10 06:18:33 -050032::
33:: Honors any existing GENERATOR environment variable
34:: setting instead of overwriting it, to allow it
35:: to be forced if needed.
36::
37:: Sets ERRORLEVEL to 0 if GENERATOR can be determined,
38:: to 1 if it cannot.
39::
40
41IF DEFINED GENERATOR (
42 ECHO [warn ] using existing environment variable GENERATOR
43 EXIT /B 0
44)
45
46
47IF "%PROFILE:~0,4%" == "MING" (
48 SET GENERATOR=MinGW Makefiles
James E. King III860a5f12018-03-06 14:23:23 -050049
50) ELSE IF "%PROFILE:~0,4%" == "CYGW" (
51 SET GENERATOR=Unix Makefiles
52
James E. King, III07f59972017-03-10 06:18:33 -050053) ELSE IF "%PROFILE:~0,4%" == "MSYS" (
54 SET GENERATOR=MSYS Makefiles
55) ELSE (
56 IF /i "%PLATFORM%" == "x64" SET GENARCH= Win64
57 CALL :CHECK 16
58 IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 10 2010!GENARCH!
59 CALL :CHECK 17
60 IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 11 2012!GENARCH!
61 CALL :CHECK 18
62 IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 12 2013!GENARCH!
James E. King III860a5f12018-03-06 14:23:23 -050063 CALL :CHECK 19.0
James E. King, III07f59972017-03-10 06:18:33 -050064 IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 14 2015!GENARCH!
James E. King III860a5f12018-03-06 14:23:23 -050065 CALL :CHECK 19.1
James E. King, III07f59972017-03-10 06:18:33 -050066 IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 15 2017!GENARCH!
67)
68
69IF NOT DEFINED GENERATOR (
70 ECHO [error] unable to determine the CMake generator to use
71 EXIT /B 1
72)
73
74ECHO [info ] using CMake generator %GENERATOR%
75EXIT /B 0
76
77:CHECK
James E. King III860a5f12018-03-06 14:23:23 -050078cl /? 2>&1 | findstr /C:"Version %1%" > nul
James E. King, III07f59972017-03-10 06:18:33 -050079EXIT /B