diff --git a/win/build-deps.cmd b/win/build-deps.cmd index 8e4b6b1133..b31f4517e8 100644 --- a/win/build-deps.cmd +++ b/win/build-deps.cmd @@ -26,6 +26,10 @@ echo. set THISDIR=%CD% +set PROJECT_NAME=IfcOpenShell +call utils\cecho.cmd 15 0 "This script fetches and builds all %PROJECT_NAME% dependencies" +echo. + :: Enable the delayed environment variable expansion needed in vs-cfg.cmd. setlocal EnableDelayedExpansion @@ -35,11 +39,6 @@ IF "%VSINSTALLDIR%"=="" ( GOTO :ErrorAndPrintUsage ) -set PROJECT_NAME=IfcOpenShell - -call utils\cecho.cmd 15 0 "This script fetches and builds all %PROJECT_NAME% dependencies" -echo. - :: Set up variables depending on the used Visual Studio version call vs-cfg.cmd %1 %2 IF NOT %ERRORLEVEL%==0 GOTO :Error @@ -87,7 +86,7 @@ FOR %%i IN (powershell git cmake) DO ( :: Print build configuration information call cecho.cmd 0 10 "Script configuration:" -call cecho.cmd 0 13 "* CMake Generator`t= '`"%GENERATOR_DEFAULT%`'`t +call cecho.cmd 0 13 "* CMake Generator`t= '`"%GENERATOR%`'`t echo - Passed to CMake -G option. call cecho.cmd 0 13 "* Target Architecture`t= %TARGET_ARCH%" 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. echo Defaults to NUMBER_OF_PROCESSORS. echo. -:: Print script's usage information call :PrintUsage call cecho.cmd 0 14 "Warning: You will need roughly 8 GB of disk space to proceed `(VS 2015 x64 RelWithDebInfo`)." echo. -echo If you are not ready with the above, press Ctrl-C to abort! +call cecho.cmd black cyan "If you are not ready with the above, press Ctrl-C to abort!" pause echo. diff --git a/win/vs-cfg.cmd b/win/vs-cfg.cmd index 8f5b93f2a2..2e3f22f73f 100644 --- a/win/vs-cfg.cmd +++ b/win/vs-cfg.cmd @@ -34,35 +34,33 @@ set GENERATOR=%1 :: TODO Print CMake and VS versions. Maybe in build-deps.cmd would be better than here. :: Supported Visual Studio versions: -set GENERATOR_VS2015_32="Visual Studio 14 2015" -set GENERATOR_VS2015_64="Visual Studio 14 2015 Win64" +set GENERATORS[0]="Visual Studio 14 2015" +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 GENERATOR_VS2013_32="Visual Studio 12" -set GENERATOR_VS2013_64="Visual Studio 12 Win64" -set GENERATOR_VS2012_32="Visual Studio 11" -set GENERATOR_VS2012_64="Visual Studio 11 Win64" -set GENERATOR_VS2010_32="Visual Studio 10" -set GENERATOR_VS2010_64="Visual Studio 10 Win64" -set GENERATOR_VS2008_32="Visual Studio 9 2008" -set GENERATOR_VS2008_64="Visual Studio 9 2008 Win64" -set GENERATOR_DEFAULT=%GENERATOR_VS2015_64% +set GENERATORS[2]="Visual Studio 12" +set GENERATORS[3]="Visual Studio 12 Win64" +set GENERATORS[4]="Visual Studio 11" +set GENERATORS[5]="Visual Studio 11 Win64" +set GENERATORS[6]="Visual Studio 10" +set GENERATORS[7]="Visual Studio 10 Win64" +set GENERATORS[8]="Visual Studio 9 2008" +set GENERATORS[9]="Visual Studio 9 2008 Win64" +set GENERATOR_DEFAULT=%GENERATORS[1]% IF "!GENERATOR!"=="" ( set GENERATOR=%GENERATOR_DEFAULT% call utils\cecho.cmd 0 14 "vs-cfg.cmd: Warning: Generator not passed - using the default '`"%GENERATOR_DEFAULT%`'`t ) -IF NOT !GENERATOR!==%GENERATOR_VS2008_32% IF NOT !GENERATOR!==%GENERATOR_VS2008_64% ( -IF NOT !GENERATOR!==%GENERATOR_VS2010_32% IF NOT !GENERATOR!==%GENERATOR_VS2010_64% ( -IF NOT !GENERATOR!==%GENERATOR_VS2012_32% IF NOT !GENERATOR!==%GENERATOR_VS2012_64% ( -IF NOT !GENERATOR!==%GENERATOR_VS2013_32% IF NOT !GENERATOR!==%GENERATOR_VS2013_64% ( -IF NOT !GENERATOR!==%GENERATOR_VS2015_32% IF NOT !GENERATOR!==%GENERATOR_VS2015_64% ( - call utils\cecho.cmd 0 12 "vs-cfg.cmd: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!" - exit /b 1 -))))) +FOR /l %%i in (0,1,9) DO ( + IF !GENERATOR!==!GENERATORS[%%i]! GOTO :GeneratorValid +) +call utils\cecho.cmd 0 12 "vs-cfg.cmd: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!" +exit /b 1 +:GeneratorValid :: Figure out the build configuration from the CMake generator string. :: Are we building 32-bit or 64-bit version. set ARCH_BITS=32 @@ -71,6 +69,7 @@ set TARGET_ARCH=x86 set VS_PLATFORM=Win32 :: Split the string for closer inspection. +:: TODO A bit clumsy and not dynamic when new VS is released, clean this up. :: VS_VER and VC_VER are convenience variables used f.ex. for filenames. set GENERATOR_NO_DOUBLEQUOTES=%GENERATOR:"=% set GENERATOR_SPLIT=%GENERATOR_NO_DOUBLEQUOTES: =,%