blob: 7ca98530f300475d1eba4b8482f0f2919752abd3 [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
31::
32:: Honors any existing GENERATOR environment variable
33:: setting instead of overwriting it, to allow it
34:: to be forced if needed.
35::
36:: Sets ERRORLEVEL to 0 if GENERATOR can be determined,
37:: to 1 if it cannot.
38::
39
40IF DEFINED GENERATOR (
41 ECHO [warn ] using existing environment variable GENERATOR
42 EXIT /B 0
43)
44
45
46IF "%PROFILE:~0,4%" == "MING" (
47 SET GENERATOR=MinGW Makefiles
48) ELSE IF "%PROFILE:~0,4%" == "MSYS" (
49 SET GENERATOR=MSYS Makefiles
50) ELSE (
51 IF /i "%PLATFORM%" == "x64" SET GENARCH= Win64
52 CALL :CHECK 16
53 IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 10 2010!GENARCH!
54 CALL :CHECK 17
55 IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 11 2012!GENARCH!
56 CALL :CHECK 18
57 IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 12 2013!GENARCH!
58 CALL :CHECK 19.00
59 IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 14 2015!GENARCH!
60 CALL :CHECK 19.10
61 IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 15 2017!GENARCH!
62)
63
64IF NOT DEFINED GENERATOR (
65 ECHO [error] unable to determine the CMake generator to use
66 EXIT /B 1
67)
68
69ECHO [info ] using CMake generator %GENERATOR%
70EXIT /B 0
71
72:CHECK
73cl /? 2>&1 | findstr /C:"Version %1%." > nul
74EXIT /B