Skip to content

Commit bb3dc35

Browse files
committed
Batch file tweaks, fix printing of the used generator
1 parent 90946e0 commit bb3dc35

2 files changed

Lines changed: 24 additions & 27 deletions

File tree

win/build-deps.cmd

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ echo.
2626

2727
set THISDIR=%CD%
2828

29+
set PROJECT_NAME=IfcOpenShell
30+
call utils\cecho.cmd 15 0 "This script fetches and builds all %PROJECT_NAME% dependencies"
31+
echo.
32+
2933
:: Enable the delayed environment variable expansion needed in vs-cfg.cmd.
3034
setlocal EnableDelayedExpansion
3135

@@ -35,11 +39,6 @@ IF "%VSINSTALLDIR%"=="" (
3539
GOTO :ErrorAndPrintUsage
3640
)
3741

38-
set PROJECT_NAME=IfcOpenShell
39-
40-
call utils\cecho.cmd 15 0 "This script fetches and builds all %PROJECT_NAME% dependencies"
41-
echo.
42-
4342
:: Set up variables depending on the used Visual Studio version
4443
call vs-cfg.cmd %1 %2
4544
IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -87,7 +86,7 @@ FOR %%i IN (powershell git cmake) DO (
8786
:: Print build configuration information
8887

8988
call cecho.cmd 0 10 "Script configuration:"
90-
call cecho.cmd 0 13 "* CMake Generator`t= '`"%GENERATOR_DEFAULT%`'`t
89+
call cecho.cmd 0 13 "* CMake Generator`t= '`"%GENERATOR%`'`t
9190
echo - Passed to CMake -G option.
9291
call cecho.cmd 0 13 "* Target Architecture`t= %TARGET_ARCH%"
9392
echo - Whether were doing 32-bit (x86) or 64-bit (x64) build.
@@ -113,13 +112,12 @@ echo - How many MSBuild.exe processes may be run in parallel.
113112
echo Defaults to NUMBER_OF_PROCESSORS.
114113
echo.
115114

116-
:: Print script's usage information
117115
call :PrintUsage
118116

119117
call cecho.cmd 0 14 "Warning: You will need roughly 8 GB of disk space to proceed `(VS 2015 x64 RelWithDebInfo`)."
120118
echo.
121119

122-
echo If you are not ready with the above, press Ctrl-C to abort!
120+
call cecho.cmd black cyan "If you are not ready with the above, press Ctrl-C to abort!"
123121
pause
124122
echo.
125123

win/vs-cfg.cmd

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,33 @@ set GENERATOR=%1
3434
:: TODO Print CMake and VS versions. Maybe in build-deps.cmd would be better than here.
3535

3636
:: Supported Visual Studio versions:
37-
set GENERATOR_VS2015_32="Visual Studio 14 2015"
38-
set GENERATOR_VS2015_64="Visual Studio 14 2015 Win64"
37+
set GENERATORS[0]="Visual Studio 14 2015"
38+
set GENERATORS[1]="Visual Studio 14 2015 Win64"
3939
:: TODO Check CMake version and convert possible new format (>= 3.0) generator names
4040
:: to the old versions if using older CMake for VS <= 2013,
4141
:: see http://www.cmake.org/cmake/help/v3.0/release/3.0.0.html#other-changes
42-
set GENERATOR_VS2013_32="Visual Studio 12"
43-
set GENERATOR_VS2013_64="Visual Studio 12 Win64"
44-
set GENERATOR_VS2012_32="Visual Studio 11"
45-
set GENERATOR_VS2012_64="Visual Studio 11 Win64"
46-
set GENERATOR_VS2010_32="Visual Studio 10"
47-
set GENERATOR_VS2010_64="Visual Studio 10 Win64"
48-
set GENERATOR_VS2008_32="Visual Studio 9 2008"
49-
set GENERATOR_VS2008_64="Visual Studio 9 2008 Win64"
50-
set GENERATOR_DEFAULT=%GENERATOR_VS2015_64%
42+
set GENERATORS[2]="Visual Studio 12"
43+
set GENERATORS[3]="Visual Studio 12 Win64"
44+
set GENERATORS[4]="Visual Studio 11"
45+
set GENERATORS[5]="Visual Studio 11 Win64"
46+
set GENERATORS[6]="Visual Studio 10"
47+
set GENERATORS[7]="Visual Studio 10 Win64"
48+
set GENERATORS[8]="Visual Studio 9 2008"
49+
set GENERATORS[9]="Visual Studio 9 2008 Win64"
50+
set GENERATOR_DEFAULT=%GENERATORS[1]%
5151

5252
IF "!GENERATOR!"=="" (
5353
set GENERATOR=%GENERATOR_DEFAULT%
5454
call utils\cecho.cmd 0 14 "vs-cfg.cmd: Warning: Generator not passed - using the default '`"%GENERATOR_DEFAULT%`'`t
5555
)
5656

57-
IF NOT !GENERATOR!==%GENERATOR_VS2008_32% IF NOT !GENERATOR!==%GENERATOR_VS2008_64% (
58-
IF NOT !GENERATOR!==%GENERATOR_VS2010_32% IF NOT !GENERATOR!==%GENERATOR_VS2010_64% (
59-
IF NOT !GENERATOR!==%GENERATOR_VS2012_32% IF NOT !GENERATOR!==%GENERATOR_VS2012_64% (
60-
IF NOT !GENERATOR!==%GENERATOR_VS2013_32% IF NOT !GENERATOR!==%GENERATOR_VS2013_64% (
61-
IF NOT !GENERATOR!==%GENERATOR_VS2015_32% IF NOT !GENERATOR!==%GENERATOR_VS2015_64% (
62-
call utils\cecho.cmd 0 12 "vs-cfg.cmd: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!"
63-
exit /b 1
64-
)))))
57+
FOR /l %%i in (0,1,9) DO (
58+
IF !GENERATOR!==!GENERATORS[%%i]! GOTO :GeneratorValid
59+
)
60+
call utils\cecho.cmd 0 12 "vs-cfg.cmd: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!"
61+
exit /b 1
6562

63+
:GeneratorValid
6664
:: Figure out the build configuration from the CMake generator string.
6765
:: Are we building 32-bit or 64-bit version.
6866
set ARCH_BITS=32
@@ -71,6 +69,7 @@ set TARGET_ARCH=x86
7169
set VS_PLATFORM=Win32
7270

7371
:: Split the string for closer inspection.
72+
:: TODO A bit clumsy and not dynamic when new VS is released, clean this up.
7473
:: VS_VER and VC_VER are convenience variables used f.ex. for filenames.
7574
set GENERATOR_NO_DOUBLEQUOTES=%GENERATOR:"=%
7675
set GENERATOR_SPLIT=%GENERATOR_NO_DOUBLEQUOTES: =,%

0 commit comments

Comments
 (0)