Skip to content

Commit 18e451b

Browse files
committed
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.
1 parent a529013 commit 18e451b

3 files changed

Lines changed: 26 additions & 10 deletions

File tree

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ Open source (LGPL) software library for working with the IFC file format.
88

99
Prerequisites
1010
=============
11-
* Git, CMake (2.6 or newer), Visual Studio 2008 or newer (Windows), or GCC (*nix, Clang untested).
11+
* Git, CMake (2.6 or newer), Visual Studio 2008 or newer with C++ toolset (Windows), or GCC (*nix, Clang untested).
1212

1313

1414
Dependencies
1515
============
1616
* [Boost](http://www.boost.org/)
1717
* Open Cascade *optional*, but required for building IfcGeom
18-
[Official](http://www.opencascade.org/getocc/download/loadocc/) or [community edition](https://github.com/tpaviot/oce)
18+
([official](http://www.opencascade.org/getocc/download/loadocc/) or [community edition](https://github.com/tpaviot/oce))
1919
For converting IFC representation items into BRep solids and tesselated meshes
2020
* [ICU](http://site.icu-project.org/) *optional*
2121
For handling code pages and Unicode in the parser
@@ -92,7 +92,10 @@ To build IfcOpenShell please take the following steps:
9292
$ cmake ../
9393
$ make
9494

95-
If all worked out correctly you can now use IfcOpenShell. For example:
95+
If all worked out correctly you can now use IfcOpenShell. See the examples below.
96+
97+
Usage examples
98+
==============
9699

97100
**Invoking IfcConvert from the command line**
98101

@@ -101,8 +104,6 @@ If all worked out correctly you can now use IfcOpenShell. For example:
101104
$ ./IfcConvert Munkerud_hus6_BE.ifc
102105
$ less Munkerud_hus6_BE.obj
103106

104-
Or:
105-
106107
**Using the IfcOpenShell Python interface**
107108

108109
$ wget -O duplex.zip http://projects.buildingsmartalliance.org/files/?artifact_id=4278

win/build-deps.cmd

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,18 @@ setlocal EnableDelayedExpansion
3333

3434
:: Make sure vcvarsall.bat is called and dev env set is up.
3535
IF "%VSINSTALLDIR%"=="" (
36-
call utils\cecho.cmd 0 12 "Visual Studio environment variables not set - cannot proceed!"
36+
call utils\cecho.cmd 0 12 "Visual Studio environment variables not set- cannot proceed."
3737
GOTO :ErrorAndPrintUsage
3838
)
3939

40+
:: Check for cl.exe - at least the "Typical" Visual Studio 2015 installation does not include the C++ toolset by default,
41+
:: http://blogs.msdn.com/b/vcblog/archive/2015/07/24/setup-changes-in-visual-studio-2015-affecting-c-developers.aspx
42+
where cl.exe 2>&1>NUL
43+
if not %ERRORLEVEL%==0 (
44+
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."
45+
GOTO :ErrorAndPrintUsage
46+
)
47+
4048
:: Set up variables depending on the used Visual Studio version
4149
call vs-cfg.cmd %1 %2
4250
IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -422,7 +430,7 @@ echo 2. Install Git and make sure 'git' is accessible from PATH.
422430
echo - http://code.google.com/p/tortoisegit/
423431
echo 3. Install CMake and make sure 'cmake' is accessible from PATH.
424432
echo - http://www.cmake.org/
425-
echo 4. Visual Studio 2008 or newer (2013 or newer recommended).
433+
echo 4. Visual Studio 2008 or newer (2013 or newer recommended) with C++ toolset.
426434
echo - https://www.visualstudio.com/
427435
echo 5. Run this batch script with Visual Studio environment variables set.
428436
echo - https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx

win/vs-cfg.cmd

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ set GENERATORS[8]="Visual Studio 14 2015 Win64"
4747
set GENERATORS[9]="Visual Studio 14 2015"
4848
set LAST_GENERATOR_IDX=9
4949

50-
REM Deduce desired architecture from the location of cl.exe
50+
:: Deduce desired architecture from the location of cl.exe
5151
where cl.exe | findstr /r /c:"amd64" >nul
5252
set START=%ERRORLEVEL%
5353
set STEP=2
@@ -65,11 +65,18 @@ IF "!GENERATOR!"=="" IF NOT "%VisualStudioVersion%"=="" (
6565
)
6666
)
6767
)
68+
:: Check that the used CMake version supports the chosen generator
69+
set GENERATOR_CHECK=%GENERATOR: Win64=%
70+
cmake --help | findstr /c:%GENERATOR_CHECK%
71+
if not %ERRORLEVEL%==0 (
72+
call utils\cecho.cmd 0 12 "%~nx0: The used CMake version does not support '`"!GENERATOR!`'"- cannot proceed."
73+
exit /b 1
74+
)
6875

6976
FOR /l %%i in (0,1,%LAST_GENERATOR_IDX%) DO (
7077
IF !GENERATOR!==!GENERATORS[%%i]! GOTO :GeneratorValid
7178
)
72-
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!"
79+
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'"- cannot proceed."
7380
echo Supported CMake generator strings:
7481
FOR /l %%i in (0,1,%LAST_GENERATOR_IDX%) DO (
7582
echo !GENERATORS[%%i]!
@@ -133,7 +140,7 @@ IF "!BUILD_CFG!"=="" (
133140
)
134141
IF NOT !BUILD_CFG!==%BUILD_CFG_MINSIZEREL% IF NOT !BUILD_CFG!==%BUILD_CFG_RELEASE% (
135142
IF NOT !BUILD_CFG!==%BUILD_CFG_RELWITHDEBINFO% IF NOT !BUILD_CFG!==%BUILD_CFG_DEBUG% (
136-
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake build configuration type passed: !BUILD_CFG!. Cannot proceed, aborting!"
143+
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake build configuration type passed: !BUILD_CFG!. Cannot proceed."
137144
exit /b 1
138145
))
139146

0 commit comments

Comments
 (0)