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.

This commit is contained in:
Stinkfist0
2015-11-11 13:24:34 +02:00
parent d912e73282
commit 431e993ba3
3 changed files with 18 additions and 24 deletions
+12 -7
View File
@@ -21,13 +21,15 @@ cmake_minimum_required (VERSION 2.6)
project (IfcOpenShell)
OPTION(UNICODE_SUPPORT "Build with Unicode support enabled (requires ICU)." ON)
OPTION(COLLADA_SUPPORT "Build with COLLADA support enabled (requires OpenCOLLADA)." ON)
OPTION(UNICODE_SUPPORT "Build IfcOpenShell with Unicode support (requires ICU)." ON)
OPTION(COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON)
OPTION(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF)
#TODO OPTION(IFCCONVERT_DOUBLE_PRECISION "IfcConvert: Use double precision floating-point numbers." OFF)
OPTION(USE_IFC4 "Use IFC 4 instead of IFC 2x3" OFF)
OPTION(BUILD_IFCPYTHON "Build IfcPython." ON)
OPTION(BUILD_EXAMPLES "Build example applications." ON)
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
# OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer (requires Qt 4 framework)." OFF)
# Find Boost
IF(MSVC)
@@ -117,7 +119,7 @@ IF(UNICODE_SUPPORT)
SET(ICU_LIBRARIES icuuc icudata)
ENDIF()
ELSE()
MESSAGE(STATUS "Unable to find ICU library files, continuing")
MESSAGE(FATAL_ERROR "UNICODE_SUPPORT enabled, but unable to find ICU. Disable UNICODE_SUPPORT or fix ICU paths to proceed.")
ENDIF()
ENDIF()
@@ -158,7 +160,7 @@ IF(COLLADA_SUPPORT)
)
ENDIF()
ELSE()
MESSAGE(STATUS "OpenCOLLADA header files not found, continuing without COLLADA support")
MESSAGE(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA. Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
ENDIF()
ENDIF()
@@ -242,7 +244,7 @@ endif()
IF(USE_IFC4)
ADD_DEFINITIONS(-DUSE_IFC4)
ELSE()
ADD_DEFINITIONS(-DUSE_IFC2x3)
ADD_DEFINITIONS(-DUSE_IFC2x3) # TODO Make all caps? i.e. USE_IFC2X3
ENDIF()
# IfcParse
@@ -250,7 +252,7 @@ file(GLOB CPP_FILES ../src/ifcparse/*.cpp)
file(GLOB H_FILES ../src/ifcparse/*.h)
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
ADD_LIBRARY(IfcParse STATIC ${SOURCE_FILES})
IF(icu)
IF(UNICODE_SUPPORT)
TARGET_LINK_LIBRARIES(IfcParse ${ICU_LIBRARIES})
ENDIF()
@@ -297,7 +299,10 @@ IF(BUILD_EXAMPLES)
ADD_SUBDIRECTORY(../src/examples examples)
ENDIF()
# ADD_SUBDIRECTORY(../src/qtviewer qtviewer)
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
# IF(BUILD_QTVIEWER)
# ADD_SUBDIRECTORY(../src/qtviewer qtviewer)
# ENDIF()
# CMake installation targets
FILE(GLOB include_files_geom ../src/ifcgeom/*.h)
+6 -8
View File
@@ -18,8 +18,9 @@
################################################################################
FIND_PACKAGE(SWIG)
IF(SWIG_FOUND)
IF(NOT SWIG_FOUND)
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find SWIG. Disable BUILD_IFCPYTHON or fix SWIG paths to proceed.")
ENDIF()
INCLUDE(${SWIG_USE_FILE})
@@ -33,8 +34,9 @@ IF(NOT "$ENV{PYTHON_LIBRARY}" STREQUAL "")
ENDIF()
FIND_PACKAGE(PythonLibs)
IF(PYTHONLIBS_FOUND)
IF(NOT PYTHONLIBS_FOUND)
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find Python. Disable BUILD_IFCPYTHON or fix Python paths to proceed.")
ENDIF()
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
@@ -70,7 +72,3 @@ INSTALL(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/geom/__init__.py"
DESTINATION "${python_package_dir}/ifcopenshell/geom")
INSTALL(TARGETS _ifcopenshell_wrapper DESTINATION "${python_package_dir}/ifcopenshell")
ENDIF(PYTHONLIBS_FOUND)
ENDIF(SWIG_FOUND)
-9
View File
@@ -17,12 +17,6 @@
# #
################################################################################
OPTION( QT_USE_QTVIEWER "IfcOpenShell QT GUI Viewer, QT environment required" OFF )
IF (QT_USE_QTVIEWER)
# Find QT header files
SET(QT_MIN_VERSION "4.5.0")
FIND_PACKAGE(Qt4 REQUIRED)
@@ -59,6 +53,3 @@ ADD_EXECUTABLE( QTviewer ${QTviewer_SRCS} ${QTviewer_MOC_SRCS})
#http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake
TARGET_LINK_libRARIES (QTviewer IfcParse IfcGeom ${QT_LIBRARIES} ${OPENCASCADE_LIBRARIES})
ENDIF (QT_USE_QTVIEWER)