Skip to content

Commit 431e993

Browse files
committed
CMake biz: Instead of providing elusive prints of missing dependencies for required features and continuing the build configuration, fail fast instead; user can easily disable the feature or fix the paths for the dependency.
1 parent d912e73 commit 431e993

3 files changed

Lines changed: 18 additions & 24 deletions

File tree

cmake/CMakeLists.txt

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ cmake_minimum_required (VERSION 2.6)
2121

2222
project (IfcOpenShell)
2323

24-
OPTION(UNICODE_SUPPORT "Build with Unicode support enabled (requires ICU)." ON)
25-
OPTION(COLLADA_SUPPORT "Build with COLLADA support enabled (requires OpenCOLLADA)." ON)
24+
OPTION(UNICODE_SUPPORT "Build IfcOpenShell with Unicode support (requires ICU)." ON)
25+
OPTION(COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON)
2626
OPTION(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF)
2727
#TODO OPTION(IFCCONVERT_DOUBLE_PRECISION "IfcConvert: Use double precision floating-point numbers." OFF)
2828
OPTION(USE_IFC4 "Use IFC 4 instead of IFC 2x3" OFF)
2929
OPTION(BUILD_IFCPYTHON "Build IfcPython." ON)
3030
OPTION(BUILD_EXAMPLES "Build example applications." ON)
31+
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
32+
# OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer (requires Qt 4 framework)." OFF)
3133

3234
# Find Boost
3335
IF(MSVC)
@@ -117,7 +119,7 @@ IF(UNICODE_SUPPORT)
117119
SET(ICU_LIBRARIES icuuc icudata)
118120
ENDIF()
119121
ELSE()
120-
MESSAGE(STATUS "Unable to find ICU library files, continuing")
122+
MESSAGE(FATAL_ERROR "UNICODE_SUPPORT enabled, but unable to find ICU. Disable UNICODE_SUPPORT or fix ICU paths to proceed.")
121123
ENDIF()
122124
ENDIF()
123125

@@ -158,7 +160,7 @@ IF(COLLADA_SUPPORT)
158160
)
159161
ENDIF()
160162
ELSE()
161-
MESSAGE(STATUS "OpenCOLLADA header files not found, continuing without COLLADA support")
163+
MESSAGE(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA. Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
162164
ENDIF()
163165
ENDIF()
164166

@@ -242,15 +244,15 @@ endif()
242244
IF(USE_IFC4)
243245
ADD_DEFINITIONS(-DUSE_IFC4)
244246
ELSE()
245-
ADD_DEFINITIONS(-DUSE_IFC2x3)
247+
ADD_DEFINITIONS(-DUSE_IFC2x3) # TODO Make all caps? i.e. USE_IFC2X3
246248
ENDIF()
247249

248250
# IfcParse
249251
file(GLOB CPP_FILES ../src/ifcparse/*.cpp)
250252
file(GLOB H_FILES ../src/ifcparse/*.h)
251253
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
252254
ADD_LIBRARY(IfcParse STATIC ${SOURCE_FILES})
253-
IF(icu)
255+
IF(UNICODE_SUPPORT)
254256
TARGET_LINK_LIBRARIES(IfcParse ${ICU_LIBRARIES})
255257
ENDIF()
256258

@@ -297,7 +299,10 @@ IF(BUILD_EXAMPLES)
297299
ADD_SUBDIRECTORY(../src/examples examples)
298300
ENDIF()
299301

300-
# ADD_SUBDIRECTORY(../src/qtviewer qtviewer)
302+
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
303+
# IF(BUILD_QTVIEWER)
304+
# ADD_SUBDIRECTORY(../src/qtviewer qtviewer)
305+
# ENDIF()
301306

302307
# CMake installation targets
303308
FILE(GLOB include_files_geom ../src/ifcgeom/*.h)

src/ifcwrap/CMakeLists.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
################################################################################
1919

2020
FIND_PACKAGE(SWIG)
21-
22-
IF(SWIG_FOUND)
21+
IF(NOT SWIG_FOUND)
22+
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find SWIG. Disable BUILD_IFCPYTHON or fix SWIG paths to proceed.")
23+
ENDIF()
2324

2425
INCLUDE(${SWIG_USE_FILE})
2526

@@ -33,8 +34,9 @@ IF(NOT "$ENV{PYTHON_LIBRARY}" STREQUAL "")
3334
ENDIF()
3435

3536
FIND_PACKAGE(PythonLibs)
36-
37-
IF(PYTHONLIBS_FOUND)
37+
IF(NOT PYTHONLIBS_FOUND)
38+
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find Python. Disable BUILD_IFCPYTHON or fix Python paths to proceed.")
39+
ENDIF()
3840

3941
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
4042

@@ -70,7 +72,3 @@ INSTALL(FILES
7072
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/geom/__init__.py"
7173
DESTINATION "${python_package_dir}/ifcopenshell/geom")
7274
INSTALL(TARGETS _ifcopenshell_wrapper DESTINATION "${python_package_dir}/ifcopenshell")
73-
74-
ENDIF(PYTHONLIBS_FOUND)
75-
76-
ENDIF(SWIG_FOUND)

src/qtviewer/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
# #
1818
################################################################################
1919

20-
OPTION( QT_USE_QTVIEWER "IfcOpenShell QT GUI Viewer, QT environment required" OFF )
21-
22-
23-
IF (QT_USE_QTVIEWER)
24-
25-
2620
# Find QT header files
2721
SET(QT_MIN_VERSION "4.5.0")
2822
FIND_PACKAGE(Qt4 REQUIRED)
@@ -59,6 +53,3 @@ ADD_EXECUTABLE( QTviewer ${QTviewer_SRCS} ${QTviewer_MOC_SRCS})
5953
#http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake
6054

6155
TARGET_LINK_libRARIES (QTviewer IfcParse IfcGeom ${QT_LIBRARIES} ${OPENCASCADE_LIBRARIES})
62-
63-
64-
ENDIF (QT_USE_QTVIEWER)

0 commit comments

Comments
 (0)