mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 14:02:27 +00:00
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:
+12
-7
@@ -21,13 +21,15 @@ cmake_minimum_required (VERSION 2.6)
|
|||||||
|
|
||||||
project (IfcOpenShell)
|
project (IfcOpenShell)
|
||||||
|
|
||||||
OPTION(UNICODE_SUPPORT "Build with Unicode support enabled (requires ICU)." ON)
|
OPTION(UNICODE_SUPPORT "Build IfcOpenShell with Unicode support (requires ICU)." ON)
|
||||||
OPTION(COLLADA_SUPPORT "Build with COLLADA support enabled (requires OpenCOLLADA)." 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)
|
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)
|
#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(USE_IFC4 "Use IFC 4 instead of IFC 2x3" OFF)
|
||||||
OPTION(BUILD_IFCPYTHON "Build IfcPython." ON)
|
OPTION(BUILD_IFCPYTHON "Build IfcPython." ON)
|
||||||
OPTION(BUILD_EXAMPLES "Build example applications." 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
|
# Find Boost
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
@@ -117,7 +119,7 @@ IF(UNICODE_SUPPORT)
|
|||||||
SET(ICU_LIBRARIES icuuc icudata)
|
SET(ICU_LIBRARIES icuuc icudata)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ELSE()
|
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()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@@ -158,7 +160,7 @@ IF(COLLADA_SUPPORT)
|
|||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ELSE()
|
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()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@@ -242,7 +244,7 @@ endif()
|
|||||||
IF(USE_IFC4)
|
IF(USE_IFC4)
|
||||||
ADD_DEFINITIONS(-DUSE_IFC4)
|
ADD_DEFINITIONS(-DUSE_IFC4)
|
||||||
ELSE()
|
ELSE()
|
||||||
ADD_DEFINITIONS(-DUSE_IFC2x3)
|
ADD_DEFINITIONS(-DUSE_IFC2x3) # TODO Make all caps? i.e. USE_IFC2X3
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# IfcParse
|
# IfcParse
|
||||||
@@ -250,7 +252,7 @@ file(GLOB CPP_FILES ../src/ifcparse/*.cpp)
|
|||||||
file(GLOB H_FILES ../src/ifcparse/*.h)
|
file(GLOB H_FILES ../src/ifcparse/*.h)
|
||||||
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
|
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
|
||||||
ADD_LIBRARY(IfcParse STATIC ${SOURCE_FILES})
|
ADD_LIBRARY(IfcParse STATIC ${SOURCE_FILES})
|
||||||
IF(icu)
|
IF(UNICODE_SUPPORT)
|
||||||
TARGET_LINK_LIBRARIES(IfcParse ${ICU_LIBRARIES})
|
TARGET_LINK_LIBRARIES(IfcParse ${ICU_LIBRARIES})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@@ -297,7 +299,10 @@ IF(BUILD_EXAMPLES)
|
|||||||
ADD_SUBDIRECTORY(../src/examples examples)
|
ADD_SUBDIRECTORY(../src/examples examples)
|
||||||
ENDIF()
|
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
|
# CMake installation targets
|
||||||
FILE(GLOB include_files_geom ../src/ifcgeom/*.h)
|
FILE(GLOB include_files_geom ../src/ifcgeom/*.h)
|
||||||
|
|||||||
@@ -18,8 +18,9 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
FIND_PACKAGE(SWIG)
|
FIND_PACKAGE(SWIG)
|
||||||
|
IF(NOT SWIG_FOUND)
|
||||||
IF(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})
|
INCLUDE(${SWIG_USE_FILE})
|
||||||
|
|
||||||
@@ -33,8 +34,9 @@ IF(NOT "$ENV{PYTHON_LIBRARY}" STREQUAL "")
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
FIND_PACKAGE(PythonLibs)
|
FIND_PACKAGE(PythonLibs)
|
||||||
|
IF(NOT PYTHONLIBS_FOUND)
|
||||||
IF(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})
|
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
|
||||||
|
|
||||||
@@ -70,7 +72,3 @@ INSTALL(FILES
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/geom/__init__.py"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/geom/__init__.py"
|
||||||
DESTINATION "${python_package_dir}/ifcopenshell/geom")
|
DESTINATION "${python_package_dir}/ifcopenshell/geom")
|
||||||
INSTALL(TARGETS _ifcopenshell_wrapper DESTINATION "${python_package_dir}/ifcopenshell")
|
INSTALL(TARGETS _ifcopenshell_wrapper DESTINATION "${python_package_dir}/ifcopenshell")
|
||||||
|
|
||||||
ENDIF(PYTHONLIBS_FOUND)
|
|
||||||
|
|
||||||
ENDIF(SWIG_FOUND)
|
|
||||||
|
|||||||
@@ -17,12 +17,6 @@
|
|||||||
# #
|
# #
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
OPTION( QT_USE_QTVIEWER "IfcOpenShell QT GUI Viewer, QT environment required" OFF )
|
|
||||||
|
|
||||||
|
|
||||||
IF (QT_USE_QTVIEWER)
|
|
||||||
|
|
||||||
|
|
||||||
# Find QT header files
|
# Find QT header files
|
||||||
SET(QT_MIN_VERSION "4.5.0")
|
SET(QT_MIN_VERSION "4.5.0")
|
||||||
FIND_PACKAGE(Qt4 REQUIRED)
|
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
|
#http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake
|
||||||
|
|
||||||
TARGET_LINK_libRARIES (QTviewer IfcParse IfcGeom ${QT_LIBRARIES} ${OPENCASCADE_LIBRARIES})
|
TARGET_LINK_libRARIES (QTviewer IfcParse IfcGeom ${QT_LIBRARIES} ${OPENCASCADE_LIBRARIES})
|
||||||
|
|
||||||
|
|
||||||
ENDIF (QT_USE_QTVIEWER)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user