mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 08:45:22 +00:00
vs-cfg.cmd: support CMake pre-3.0 Visual Studio generator strings.
This commit is contained in:
+20
-5
@@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
:: This script initializes various Visual Studio -related environment variables needed for building
|
:: This script initializes various Visual Studio -related environment variables needed for building
|
||||||
:: This batch file expects CMake generator as %1 and build configuration type as %2.
|
:: This batch file expects CMake generator as %1 and build configuration type as %2.
|
||||||
|
:: NOTE This batch file expects the generator string to be CMake 3.0.0 and newer format, i.e.
|
||||||
|
:: "Visual Studio 10 2010" instead of "Visual Studio 10". However, one can use this batch file
|
||||||
|
:: also with CMake 2 as the generator will be converted into the older format if necessary.
|
||||||
|
|
||||||
:: NOTE: The delayed environment variable expansion needs to be enabled before calling this.
|
:: NOTE: The delayed environment variable expansion needs to be enabled before calling this.
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
@@ -28,14 +32,9 @@ set GENERATOR=%1
|
|||||||
:: TODO IDEA: Take more user-friendly VS generators and convert them to the CMake ones?
|
:: TODO IDEA: Take more user-friendly VS generators and convert them to the CMake ones?
|
||||||
:: F.ex. "vs2013-32" and/or "vc14-64"
|
:: F.ex. "vs2013-32" and/or "vc14-64"
|
||||||
|
|
||||||
:: TODO Print CMake and VS versions. Maybe in build-deps.cmd would be better than here.
|
|
||||||
|
|
||||||
:: Supported Visual Studio versions:
|
:: Supported Visual Studio versions:
|
||||||
set GENERATORS[0]="Visual Studio 14 2015"
|
set GENERATORS[0]="Visual Studio 14 2015"
|
||||||
set GENERATORS[1]="Visual Studio 14 2015 Win64"
|
set GENERATORS[1]="Visual Studio 14 2015 Win64"
|
||||||
:: TODO Check CMake version and convert possible new format (>= 3.0) generator names
|
|
||||||
:: to the old versions if using older CMake for VS <= 2013,
|
|
||||||
:: see http://www.cmake.org/cmake/help/v3.0/release/3.0.0.html#other-changes
|
|
||||||
set GENERATORS[2]="Visual Studio 12 2013"
|
set GENERATORS[2]="Visual Studio 12 2013"
|
||||||
set GENERATORS[3]="Visual Studio 12 2013 Win64"
|
set GENERATORS[3]="Visual Studio 12 2013 Win64"
|
||||||
set GENERATORS[4]="Visual Studio 11 2012"
|
set GENERATORS[4]="Visual Studio 11 2012"
|
||||||
@@ -55,6 +54,10 @@ FOR /l %%i in (0,1,9) DO (
|
|||||||
IF !GENERATOR!==!GENERATORS[%%i]! GOTO :GeneratorValid
|
IF !GENERATOR!==!GENERATORS[%%i]! GOTO :GeneratorValid
|
||||||
)
|
)
|
||||||
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!"
|
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!"
|
||||||
|
echo Supported CMake generator strings:
|
||||||
|
FOR /l %%i in (0,1,9) DO (
|
||||||
|
echo !GENERATORS[%%i]!
|
||||||
|
)
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
:GeneratorValid
|
:GeneratorValid
|
||||||
@@ -82,6 +85,18 @@ FOR %%i IN (%GENERATOR_SPLIT%) DO (
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
:: Check CMake version and convert possible new format (>= 3.0) generator names to the old versions if using older CMake for VS <= 2013,
|
||||||
|
:: see http://www.cmake.org/cmake/help/v3.0/release/3.0.0.html#other-changes
|
||||||
|
FOR /f "delims=" %%i in ('where cmake') DO set CMAKE_PATH=%%i
|
||||||
|
IF NOT "%CMAKE_PATH%"=="" (
|
||||||
|
FOR /f "delims=" %%i in ('cmake --version ^| findstr /C:"cmake version 3"') DO GOTO :CMake3AndNewer
|
||||||
|
)
|
||||||
|
:: CMake older than 3.0.0: convert new format generators to the old format (simple brute force for simplicity)
|
||||||
|
set GENERATOR=%GENERATOR: 2013=%
|
||||||
|
set GENERATOR=%GENERATOR: 2012=%
|
||||||
|
set GENERATOR=%GENERATOR: 2010=%
|
||||||
|
:CMake3AndNewer
|
||||||
|
|
||||||
:: VS project file extension is different on older VS versions
|
:: VS project file extension is different on older VS versions
|
||||||
set VCPROJ_FILE_EXT=vcxproj
|
set VCPROJ_FILE_EXT=vcxproj
|
||||||
IF %VS_VER%==2008 set VCPROJ_FILE_EXT=vcproj
|
IF %VS_VER%==2008 set VCPROJ_FILE_EXT=vcproj
|
||||||
|
|||||||
Reference in New Issue
Block a user