From 18e451b8747560c48d4c3260f581598e76da04a6 Mon Sep 17 00:00:00 2001 From: Stinkfist0 Date: Tue, 19 Jan 2016 16:43:42 +0200 Subject: [PATCH] Windows build scripts: detect case where user installed Visual Studio but not the C++ toolset. Also detect case where user's CMake version is too old for the desired generator. --- README.md | 11 ++++++----- win/build-deps.cmd | 12 ++++++++++-- win/vs-cfg.cmd | 13 ++++++++++--- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 696cd75be4..304f93a90c 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ Open source (LGPL) software library for working with the IFC file format. Prerequisites ============= -* Git, CMake (2.6 or newer), Visual Studio 2008 or newer (Windows), or GCC (*nix, Clang untested). +* Git, CMake (2.6 or newer), Visual Studio 2008 or newer with C++ toolset (Windows), or GCC (*nix, Clang untested). Dependencies ============ * [Boost](http://www.boost.org/) * Open Cascade *optional*, but required for building IfcGeom - [Official](http://www.opencascade.org/getocc/download/loadocc/) or [community edition](https://github.com/tpaviot/oce) + ([official](http://www.opencascade.org/getocc/download/loadocc/) or [community edition](https://github.com/tpaviot/oce)) For converting IFC representation items into BRep solids and tesselated meshes * [ICU](http://site.icu-project.org/) *optional* For handling code pages and Unicode in the parser @@ -92,7 +92,10 @@ To build IfcOpenShell please take the following steps: $ cmake ../ $ make -If all worked out correctly you can now use IfcOpenShell. For example: +If all worked out correctly you can now use IfcOpenShell. See the examples below. + +Usage examples +============== **Invoking IfcConvert from the command line** @@ -101,8 +104,6 @@ If all worked out correctly you can now use IfcOpenShell. For example: $ ./IfcConvert Munkerud_hus6_BE.ifc $ less Munkerud_hus6_BE.obj -Or: - **Using the IfcOpenShell Python interface** $ wget -O duplex.zip http://projects.buildingsmartalliance.org/files/?artifact_id=4278 diff --git a/win/build-deps.cmd b/win/build-deps.cmd index 2ea1e471ae..75ec4caa99 100644 --- a/win/build-deps.cmd +++ b/win/build-deps.cmd @@ -33,10 +33,18 @@ setlocal EnableDelayedExpansion :: Make sure vcvarsall.bat is called and dev env set is up. IF "%VSINSTALLDIR%"=="" ( - call utils\cecho.cmd 0 12 "Visual Studio environment variables not set - cannot proceed!" + call utils\cecho.cmd 0 12 "Visual Studio environment variables not set- cannot proceed." GOTO :ErrorAndPrintUsage ) +:: Check for cl.exe - at least the "Typical" Visual Studio 2015 installation does not include the C++ toolset by default, +:: http://blogs.msdn.com/b/vcblog/archive/2015/07/24/setup-changes-in-visual-studio-2015-affecting-c-developers.aspx +where cl.exe 2>&1>NUL +if not %ERRORLEVEL%==0 ( + call utils\cecho.cmd 0 12 "%~nx0: cl.exe not in PATH. Make sure to select the C++ toolset when installing Visual Studio- cannot proceed." + GOTO :ErrorAndPrintUsage +) + :: Set up variables depending on the used Visual Studio version call vs-cfg.cmd %1 %2 IF NOT %ERRORLEVEL%==0 GOTO :Error @@ -422,7 +430,7 @@ echo 2. Install Git and make sure 'git' is accessible from PATH. echo - http://code.google.com/p/tortoisegit/ echo 3. Install CMake and make sure 'cmake' is accessible from PATH. echo - http://www.cmake.org/ -echo 4. Visual Studio 2008 or newer (2013 or newer recommended). +echo 4. Visual Studio 2008 or newer (2013 or newer recommended) with C++ toolset. echo - https://www.visualstudio.com/ echo 5. Run this batch script with Visual Studio environment variables set. echo - https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx diff --git a/win/vs-cfg.cmd b/win/vs-cfg.cmd index cf70bb5265..9eb6494d8b 100644 --- a/win/vs-cfg.cmd +++ b/win/vs-cfg.cmd @@ -47,7 +47,7 @@ set GENERATORS[8]="Visual Studio 14 2015 Win64" set GENERATORS[9]="Visual Studio 14 2015" set LAST_GENERATOR_IDX=9 -REM Deduce desired architecture from the location of cl.exe +:: Deduce desired architecture from the location of cl.exe where cl.exe | findstr /r /c:"amd64" >nul set START=%ERRORLEVEL% set STEP=2 @@ -65,11 +65,18 @@ IF "!GENERATOR!"=="" IF NOT "%VisualStudioVersion%"=="" ( ) ) ) +:: Check that the used CMake version supports the chosen generator +set GENERATOR_CHECK=%GENERATOR: Win64=% +cmake --help | findstr /c:%GENERATOR_CHECK% +if not %ERRORLEVEL%==0 ( + call utils\cecho.cmd 0 12 "%~nx0: The used CMake version does not support '`"!GENERATOR!`'"- cannot proceed." + exit /b 1 +) FOR /l %%i in (0,1,%LAST_GENERATOR_IDX%) DO ( 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." echo Supported CMake generator strings: FOR /l %%i in (0,1,%LAST_GENERATOR_IDX%) DO ( echo !GENERATORS[%%i]! @@ -133,7 +140,7 @@ IF "!BUILD_CFG!"=="" ( ) IF NOT !BUILD_CFG!==%BUILD_CFG_MINSIZEREL% IF NOT !BUILD_CFG!==%BUILD_CFG_RELEASE% ( IF NOT !BUILD_CFG!==%BUILD_CFG_RELWITHDEBINFO% IF NOT !BUILD_CFG!==%BUILD_CFG_DEBUG% ( - call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake build configuration type passed: !BUILD_CFG!. Cannot proceed, aborting!" + call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake build configuration type passed: !BUILD_CFG!. Cannot proceed." exit /b 1 ))