mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-03 21:38:12 +00:00
cmake format and unify file
This commit is contained in:
committed by
Thomas Krijnen
parent
863bf8ebbe
commit
7d7c04ddc0
+318
-196
@@ -33,42 +33,47 @@ set( EXTRA_VERSION "-alpha.3")
|
|||||||
|
|
||||||
foreach(max_year RANGE 2014 2030)
|
foreach(max_year RANGE 2014 2030)
|
||||||
set(max_sdk "$ENV{ADSK_3DSMAX_SDK_${max_year}}")
|
set(max_sdk "$ENV{ADSK_3DSMAX_SDK_${max_year}}")
|
||||||
|
|
||||||
if(NOT "${max_sdk}" STREQUAL "")
|
if(NOT "${max_sdk}" STREQUAL "")
|
||||||
MESSAGE(STATUS "Autodesk 3ds Max SDK found at ${max_sdk}")
|
message(STATUS "Autodesk 3ds Max SDK found at ${max_sdk}")
|
||||||
set(HAS_MAX TRUE)
|
set(HAS_MAX TRUE)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
OPTION(MINIMAL_BUILD "The build is to make a minimal version of IFC converter from OCCT into IFC." OFF)
|
|
||||||
OPTION(COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON)
|
option(MINIMAL_BUILD "The build is to make a minimal version of IFC converter from OCCT into IFC." OFF)
|
||||||
OPTION(IFCXML_SUPPORT "Build IfcParse with ifcXML support (requires libxml2)." 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(IFCXML_SUPPORT "Build IfcParse with ifcXML support (requires libxml2)." ON)
|
||||||
OPTION(BUILD_PACKAGE "" OFF)
|
option(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF)
|
||||||
OPTION(BUILD_IFCGEOM "Build IfcGeom." ON)
|
option(BUILD_PACKAGE "" OFF)
|
||||||
OPTION(BUILD_DOCUMENTATION "Build IfcOpenShell Documentation." OFF)
|
option(BUILD_IFCGEOM "Build IfcGeom." ON)
|
||||||
OPTION(BUILD_IFCPYTHON "Build IfcPython." ON)
|
option(BUILD_DOCUMENTATION "Build IfcOpenShell Documentation." OFF)
|
||||||
OPTION(BUILD_EXAMPLES "Build example applications." ON)
|
option(BUILD_IFCPYTHON "Build IfcPython." ON)
|
||||||
OPTION(BUILD_GEOMSERVER "Build IfcGeomServer executable." ON)
|
option(BUILD_EXAMPLES "Build example applications." ON)
|
||||||
OPTION(BUILD_CONVERT "Build IfcConvert executable." ON)
|
option(BUILD_GEOMSERVER "Build IfcGeomServer executable." ON)
|
||||||
OPTION(HDF5_SUPPORT "Enable HDF5 support (requires HDF5, zlib)" ON)
|
option(BUILD_CONVERT "Build IfcConvert executable." ON)
|
||||||
OPTION(USE_VLD "Use Visual Leak Detector for debugging memory leaks, MSVC-only." OFF)
|
option(HDF5_SUPPORT "Enable HDF5 support (requires HDF5, zlib)" ON)
|
||||||
OPTION(USE_MMAP "Adds a command line options to parse IFC files from memory mapped files using Boost.Iostreams" OFF)
|
option(USE_VLD "Use Visual Leak Detector for debugging memory leaks, MSVC-only." OFF)
|
||||||
OPTION(BUILD_SHARED_LIBS "Build IfcParse and IfcGeom as shared libs (SO/DLL)." OFF)
|
option(USE_MMAP "Adds a command line options to parse IFC files from memory mapped files using Boost.Iostreams" OFF)
|
||||||
OPTION(MSVC_PARALLEL_BUILD "Multi-threaded compilation in Microsoft Visual Studio (/MP)" OFF)
|
option(BUILD_SHARED_LIBS "Build IfcParse and IfcGeom as shared libs (SO/DLL)." OFF)
|
||||||
|
option(MSVC_PARALLEL_BUILD "Multi-threaded compilation in Microsoft Visual Studio (/MP)" OFF)
|
||||||
|
|
||||||
OPTION(NO_WARN "Disable all warnings" OFF)
|
OPTION(NO_WARN "Disable all warnings" OFF)
|
||||||
OPTION(WASM_BUILD OFF)
|
OPTION(WASM_BUILD OFF)
|
||||||
if(${HAS_MAX})
|
if(${HAS_MAX})
|
||||||
OPTION(BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." OFF)
|
option(BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${BUILD_CONVERT})
|
if(${BUILD_CONVERT})
|
||||||
OPTION(GLTF_SUPPORT "Build IfcConvert with glTF support (requires json.hpp)." OFF)
|
option(GLTF_SUPPORT "Build IfcConvert with glTF support (requires json.hpp)." OFF)
|
||||||
OPTION(USD_SUPPORT "Build IfcConvert with USD support (requires pixar's USD library)." OFF)
|
OPTION(USD_SUPPORT "Build IfcConvert with USD support (requires pixar's USD library)." OFF)
|
||||||
endif()
|
endif()
|
||||||
OPTION(USERSPACE_PYTHON_PREFIX "Installs IfcPython for the current user only instead of system-wide." OFF)
|
|
||||||
OPTION(ADD_COMMIT_SHA "Add commit sha and branch in version number, warning results in many rebuilds, requires git" OFF)
|
|
||||||
|
|
||||||
IF(NOT CMAKE_BUILD_TYPE)
|
option(USERSPACE_PYTHON_PREFIX "Installs IfcPython for the current user only instead of system-wide." OFF)
|
||||||
SET(CMAKE_BUILD_TYPE "Release")
|
option(ADD_COMMIT_SHA "Add commit sha and branch in version number, warning results in many rebuilds, requires git" OFF)
|
||||||
ENDIF()
|
|
||||||
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE "Release")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MSVC AND MSVC_PARALLEL_BUILD)
|
if(MSVC AND MSVC_PARALLEL_BUILD)
|
||||||
add_definitions("/MP")
|
add_definitions("/MP")
|
||||||
@@ -85,58 +90,69 @@ endif()
|
|||||||
# QtViewer requires Qt6
|
# QtViewer requires Qt6
|
||||||
OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer" OFF)
|
OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer" OFF)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
if((BUILD_CONVERT OR BUILD_GEOMSERVER OR BUILD_IFCPYTHON) AND(NOT BUILD_IFCGEOM))
|
if((BUILD_CONVERT OR BUILD_GEOMSERVER OR BUILD_IFCPYTHON) AND(NOT BUILD_IFCGEOM))
|
||||||
message(STATUS "'IfcGeom' is required with current outputs")
|
message(STATUS "'IfcGeom' is required with current outputs")
|
||||||
set(BUILD_IFCGEOM ON)
|
set(BUILD_IFCGEOM ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Specify where to install files
|
# Specify where to install files
|
||||||
IF(NOT BINDIR)
|
if(NOT BINDIR)
|
||||||
set(BINDIR bin)
|
set(BINDIR bin)
|
||||||
ENDIF()
|
endif()
|
||||||
IF(NOT IS_ABSOLUTE ${BINDIR})
|
|
||||||
|
if(NOT IS_ABSOLUTE ${BINDIR})
|
||||||
set(BINDIR ${CMAKE_INSTALL_BINDIR})
|
set(BINDIR ${CMAKE_INSTALL_BINDIR})
|
||||||
ENDIF()
|
endif()
|
||||||
MESSAGE(STATUS "BINDIR: ${BINDIR}")
|
|
||||||
|
|
||||||
IF(NOT INCLUDEDIR)
|
message(STATUS "BINDIR: ${BINDIR}")
|
||||||
|
|
||||||
|
if(NOT INCLUDEDIR)
|
||||||
set(INCLUDEDIR include)
|
set(INCLUDEDIR include)
|
||||||
ENDIF()
|
endif()
|
||||||
IF(NOT IS_ABSOLUTE ${INCLUDEDIR})
|
|
||||||
set(INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
|
|
||||||
ENDIF()
|
|
||||||
MESSAGE(STATUS "INCLUDEDIR: ${INCLUDEDIR}")
|
|
||||||
|
|
||||||
IF(NOT LIBDIR)
|
if(NOT IS_ABSOLUTE ${INCLUDEDIR})
|
||||||
|
set(INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "INCLUDEDIR: ${INCLUDEDIR}")
|
||||||
|
|
||||||
|
if(NOT LIBDIR)
|
||||||
set(LIBDIR lib)
|
set(LIBDIR lib)
|
||||||
ENDIF()
|
endif()
|
||||||
IF(NOT IS_ABSOLUTE ${LIBDIR})
|
|
||||||
|
if(NOT IS_ABSOLUTE ${LIBDIR})
|
||||||
set(LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
set(LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
||||||
ENDIF()
|
endif()
|
||||||
MESSAGE(STATUS "LIBDIR: ${LIBDIR}")
|
|
||||||
|
message(STATUS "LIBDIR: ${LIBDIR}")
|
||||||
|
|
||||||
set(IFCOPENSHELL_LIBRARY_DIR "") # for *nix rpaths
|
set(IFCOPENSHELL_LIBRARY_DIR "") # for *nix rpaths
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
add_definitions(-DIFC_SHARED_BUILD)
|
add_definitions(-DIFC_SHARED_BUILD)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
message(WARNING "Building DLLs against the static VC run-time. This is not recommended if the DLLs are to be redistributed.")
|
message(WARNING "Building DLLs against the static VC run-time. This is not recommended if the DLLs are to be redistributed.")
|
||||||
|
|
||||||
# C4521: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
|
# C4521: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
|
||||||
# There will be couple hundreds of these so suppress them away, https://msdn.microsoft.com/en-us/library/esew7y1w.aspx
|
# There will be couple hundreds of these so suppress them away, https://msdn.microsoft.com/en-us/library/esew7y1w.aspx
|
||||||
add_definitions(-wd4251)
|
add_definitions(-wd4251)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(IFCOPENSHELL_LIBRARY_DIR "${LIBDIR}")
|
set(IFCOPENSHELL_LIBRARY_DIR "${LIBDIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Create cache entries if absent for environment variables
|
# Create cache entries if absent for environment variables
|
||||||
MACRO(UNIFY_ENVVARS_AND_CACHE VAR)
|
macro(UNIFY_ENVVARS_AND_CACHE VAR)
|
||||||
IF ((NOT DEFINED ${VAR}) AND (NOT "$ENV{${VAR}}" STREQUAL ""))
|
if((NOT DEFINED ${VAR}) AND(NOT "$ENV{${VAR}}" STREQUAL ""))
|
||||||
SET(${VAR} "$ENV{${VAR}}" CACHE STRING "${VAR}" FORCE)
|
set(${VAR} "$ENV{${VAR}}" CACHE STRING "${VAR}" FORCE)
|
||||||
ENDIF()
|
endif()
|
||||||
ENDMACRO()
|
endmacro()
|
||||||
|
|
||||||
UNIFY_ENVVARS_AND_CACHE(OCC_INCLUDE_DIR)
|
UNIFY_ENVVARS_AND_CACHE(OCC_INCLUDE_DIR)
|
||||||
UNIFY_ENVVARS_AND_CACHE(OCC_LIBRARY_DIR)
|
UNIFY_ENVVARS_AND_CACHE(OCC_LIBRARY_DIR)
|
||||||
|
|
||||||
if(NOT MINIMAL_BUILD)
|
if(NOT MINIMAL_BUILD)
|
||||||
UNIFY_ENVVARS_AND_CACHE(OPENCOLLADA_INCLUDE_DIR)
|
UNIFY_ENVVARS_AND_CACHE(OPENCOLLADA_INCLUDE_DIR)
|
||||||
UNIFY_ENVVARS_AND_CACHE(OPENCOLLADA_LIBRARY_DIR)
|
UNIFY_ENVVARS_AND_CACHE(OPENCOLLADA_LIBRARY_DIR)
|
||||||
@@ -147,6 +163,12 @@ UNIFY_ENVVARS_AND_CACHE(PYTHON_EXECUTABLE)
|
|||||||
UNIFY_ENVVARS_AND_CACHE(HDF5_INCLUDE_DIR)
|
UNIFY_ENVVARS_AND_CACHE(HDF5_INCLUDE_DIR)
|
||||||
UNIFY_ENVVARS_AND_CACHE(HDF5_LIBRARY_DIR)
|
UNIFY_ENVVARS_AND_CACHE(HDF5_LIBRARY_DIR)
|
||||||
UNIFY_ENVVARS_AND_CACHE(HDF5_LIBRARIES)
|
UNIFY_ENVVARS_AND_CACHE(HDF5_LIBRARIES)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
UNIFY_ENVVARS_AND_CACHE(BOOST_ROOT)
|
||||||
|
UNIFY_ENVVARS_AND_CACHE(BOOST_LIBRARYDIR)
|
||||||
|
|
||||||
|
if(NOT MINIMAL_BUILD)
|
||||||
UNIFY_ENVVARS_AND_CACHE(CGAL_INCLUDE_DIR)
|
UNIFY_ENVVARS_AND_CACHE(CGAL_INCLUDE_DIR)
|
||||||
UNIFY_ENVVARS_AND_CACHE(CGAL_LIBRARY_DIR)
|
UNIFY_ENVVARS_AND_CACHE(CGAL_LIBRARY_DIR)
|
||||||
UNIFY_ENVVARS_AND_CACHE(GMP_INCLUDE_DIR)
|
UNIFY_ENVVARS_AND_CACHE(GMP_INCLUDE_DIR)
|
||||||
@@ -154,8 +176,6 @@ UNIFY_ENVVARS_AND_CACHE(GMP_LIBRARY_DIR)
|
|||||||
UNIFY_ENVVARS_AND_CACHE(MPFR_INCLUDE_DIR)
|
UNIFY_ENVVARS_AND_CACHE(MPFR_INCLUDE_DIR)
|
||||||
UNIFY_ENVVARS_AND_CACHE(MPFR_LIBRARY_DIR)
|
UNIFY_ENVVARS_AND_CACHE(MPFR_LIBRARY_DIR)
|
||||||
endif()
|
endif()
|
||||||
UNIFY_ENVVARS_AND_CACHE(BOOST_ROOT)
|
|
||||||
UNIFY_ENVVARS_AND_CACHE(BOOST_LIBRARYDIR)
|
|
||||||
|
|
||||||
if(WASM_BUILD)
|
if(WASM_BUILD)
|
||||||
# when using the nix/build-all.py build script we should not
|
# when using the nix/build-all.py build script we should not
|
||||||
@@ -168,11 +188,13 @@ endif()
|
|||||||
if(NOT MINIMAL_BUILD AND GLTF_SUPPORT AND BUILD_CONVERT)
|
if(NOT MINIMAL_BUILD AND GLTF_SUPPORT AND BUILD_CONVERT)
|
||||||
UNIFY_ENVVARS_AND_CACHE(JSON_INCLUDE_DIR)
|
UNIFY_ENVVARS_AND_CACHE(JSON_INCLUDE_DIR)
|
||||||
FIND_FILE(json_hpp "json.hpp" ${JSON_INCLUDE_DIR}/nlohmann)
|
FIND_FILE(json_hpp "json.hpp" ${JSON_INCLUDE_DIR}/nlohmann)
|
||||||
IF(json_hpp)
|
|
||||||
MESSAGE(STATUS "JSON for Modern C++ header file found")
|
if(json_hpp)
|
||||||
ELSE()
|
message(STATUS "JSON for Modern C++ header file found")
|
||||||
MESSAGE(FATAL_ERROR "Unable to find JSON for Modern C++ header file, aborting")
|
else()
|
||||||
ENDIF()
|
message(FATAL_ERROR "Unable to find JSON for Modern C++ header file, aborting")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_definitions(-DWITH_GLTF)
|
add_definitions(-DWITH_GLTF)
|
||||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_GLTF)
|
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_GLTF)
|
||||||
endif()
|
endif()
|
||||||
@@ -226,42 +248,48 @@ if(NOT MINIMAL_BUILD AND USD_SUPPORT)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set INSTALL_RPATH for target
|
# Set INSTALL_RPATH for target
|
||||||
MACRO(SET_INSTALL_RPATHS _target _paths)
|
macro(SET_INSTALL_RPATHS _target _paths)
|
||||||
SET(${_target}_rpaths "")
|
set(${_target}_rpaths "")
|
||||||
FOREACH(_path ${_paths})
|
|
||||||
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${_path}" isSystemDir)
|
foreach(_path ${_paths})
|
||||||
IF("${isSystemDir}" STREQUAL "-1")
|
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${_path}" isSystemDir)
|
||||||
LIST(APPEND ${_target}_rpaths ${_path})
|
|
||||||
ENDIF()
|
if("${isSystemDir}" STREQUAL "-1")
|
||||||
ENDFOREACH()
|
list(APPEND ${_target}_rpaths ${_path})
|
||||||
MESSAGE(STATUS "Set INSTALL_RPATH for ${_target}: ${${_target}_rpaths}")
|
endif()
|
||||||
SET_TARGET_PROPERTIES(${_target} PROPERTIES INSTALL_RPATH "${${_target}_rpaths}")
|
endforeach()
|
||||||
ENDMACRO()
|
|
||||||
|
message(STATUS "Set INSTALL_RPATH for ${_target}: ${${_target}_rpaths}")
|
||||||
|
set_target_properties(${_target} PROPERTIES INSTALL_RPATH "${${_target}_rpaths}")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# Find Boost: On win32 the (hardcoded) default is to use static libraries and
|
# Find Boost: On win32 the (hardcoded) default is to use static libraries and
|
||||||
# runtime, when doing running conda-build we pick what conda prepared for us.
|
# runtime, when doing running conda-build we pick what conda prepared for us.
|
||||||
IF(WIN32 AND ("$ENV{CONDA_BUILD}" STREQUAL ""))
|
if(WIN32 AND("$ENV{CONDA_BUILD}" STREQUAL ""))
|
||||||
SET(Boost_USE_STATIC_LIBS ON)
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
SET(Boost_USE_STATIC_RUNTIME OFF)
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||||
SET(Boost_USE_MULTITHREADED ON)
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
|
|
||||||
# Disable Boost's autolinking as the libraries to be linked to are supplied
|
# Disable Boost's autolinking as the libraries to be linked to are supplied
|
||||||
# already by CMake, and wrong libraries would be asked for when code is
|
# already by CMake, and wrong libraries would be asked for when code is
|
||||||
# compiled with a toolset different from default.
|
# compiled with a toolset different from default.
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
ADD_DEFINITIONS(-DBOOST_ALL_NO_LIB)
|
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||||
|
|
||||||
# Necessary for boost version >= 1.67
|
# Necessary for boost version >= 1.67
|
||||||
SET(BCRYPT_LIBRARIES "bcrypt.lib")
|
set(BCRYPT_LIBRARIES "bcrypt.lib")
|
||||||
ENDIF()
|
endif()
|
||||||
ELSE()
|
else()
|
||||||
# Disable Boost's autolinking as the libraries to be linked to are supplied
|
# Disable Boost's autolinking as the libraries to be linked to are supplied
|
||||||
# already by CMake, and it's going to conflict if there are multiple, as is
|
# already by CMake, and it's going to conflict if there are multiple, as is
|
||||||
# the case in conda-forge's libboost feedstock.
|
# the case in conda-forge's libboost feedstock.
|
||||||
ADD_DEFINITIONS(-DBOOST_ALL_NO_LIB)
|
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||||
IF(WIN32)
|
|
||||||
|
if(WIN32)
|
||||||
# Necessary for boost version >= 1.67
|
# Necessary for boost version >= 1.67
|
||||||
SET(BCRYPT_LIBRARIES "bcrypt.lib")
|
set(BCRYPT_LIBRARIES "bcrypt.lib")
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
if (WASM_BUILD)
|
if (WASM_BUILD)
|
||||||
set(BOOST_COMPONENTS)
|
set(BOOST_COMPONENTS)
|
||||||
@@ -278,6 +306,7 @@ if(USE_MMAP)
|
|||||||
else()
|
else()
|
||||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} iostreams)
|
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} iostreams)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(-DUSE_MMAP)
|
add_definitions(-DUSE_MMAP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -295,6 +324,10 @@ if (NOT MINIMAL_BUILD AND IFCXML_SUPPORT)
|
|||||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_IFCXML)
|
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_IFCXML)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
|
message(STATUS "Boost include files found in ${Boost_INCLUDE_DIRS}")
|
||||||
|
message(STATUS "Boost libraries found in ${Boost_LIBRARY_DIRS}")
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# set(SOME_LIRARIES foo bar)
|
# set(SOME_LIRARIES foo bar)
|
||||||
# add_debug_variants(SOME_LIRARIES "${SOME_LIRARIES}" d)
|
# add_debug_variants(SOME_LIRARIES "${SOME_LIRARIES}" d)
|
||||||
@@ -308,9 +341,11 @@ endif()
|
|||||||
function(add_debug_variants NAME LIBRARIES POSTFIX)
|
function(add_debug_variants NAME LIBRARIES POSTFIX)
|
||||||
set(LIBRARIES_STR "${LIBRARIES}")
|
set(LIBRARIES_STR "${LIBRARIES}")
|
||||||
set(LIBRARIES "")
|
set(LIBRARIES "")
|
||||||
|
|
||||||
# the result, "optimized <lib> debug <lib>", needs to be a list instead of a string
|
# the result, "optimized <lib> debug <lib>", needs to be a list instead of a string
|
||||||
foreach(lib ${LIBRARIES_STR})
|
foreach(lib ${LIBRARIES_STR})
|
||||||
list(APPEND LIBRARIES optimized)
|
list(APPEND LIBRARIES optimized)
|
||||||
|
|
||||||
if("${lib}" MATCHES ".lib")
|
if("${lib}" MATCHES ".lib")
|
||||||
string(REPLACE ".lib" "" lib ${lib})
|
string(REPLACE ".lib" "" lib ${lib})
|
||||||
list(APPEND LIBRARIES ${lib}.lib)
|
list(APPEND LIBRARIES ${lib}.lib)
|
||||||
@@ -319,6 +354,7 @@ function(add_debug_variants NAME LIBRARIES POSTFIX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND LIBRARIES debug)
|
list(APPEND LIBRARIES debug)
|
||||||
|
|
||||||
if("${lib}" MATCHES ".lib")
|
if("${lib}" MATCHES ".lib")
|
||||||
string(REPLACE ".lib" "" lib ${lib})
|
string(REPLACE ".lib" "" lib ${lib})
|
||||||
list(APPEND LIBRARIES ${lib}${POSTFIX}.lib)
|
list(APPEND LIBRARIES ${lib}${POSTFIX}.lib)
|
||||||
@@ -326,18 +362,18 @@ function(add_debug_variants NAME LIBRARIES POSTFIX)
|
|||||||
list(APPEND LIBRARIES ${lib}${POSTFIX})
|
list(APPEND LIBRARIES ${lib}${POSTFIX})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(${NAME} ${LIBRARIES} PARENT_SCOPE)
|
set(${NAME} ${LIBRARIES} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if(BUILD_IFCGEOM)
|
if(BUILD_IFCGEOM)
|
||||||
|
if(MSVC)
|
||||||
IF(MSVC)
|
|
||||||
add_debug_variants(LIBXML2_LIBRARIES "${LIBXML2_LIBRARIES}" d)
|
add_debug_variants(LIBXML2_LIBRARIES "${LIBXML2_LIBRARIES}" d)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# Open CASCADE
|
# Open CASCADE
|
||||||
IF("${OCC_INCLUDE_DIR}" STREQUAL "")
|
if("${OCC_INCLUDE_DIR}" STREQUAL "")
|
||||||
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
|
find_path(OCC_INCLUDE_DIR Standard_Version.hxx
|
||||||
[PATHS
|
[PATHS
|
||||||
/usr/include/occt
|
/usr/include/occt
|
||||||
/usr/include/oce
|
/usr/include/oce
|
||||||
@@ -345,17 +381,18 @@ IF("${OCC_INCLUDE_DIR}" STREQUAL "")
|
|||||||
]
|
]
|
||||||
REQUIRED
|
REQUIRED
|
||||||
)
|
)
|
||||||
IF(OCC_INCLUDE_DIR)
|
|
||||||
MESSAGE(STATUS "Found Open CASCADE include files in: ${OCC_INCLUDE_DIR}")
|
|
||||||
ELSE()
|
|
||||||
MESSAGE(FATAL_ERROR "Unable to find Open CASCADE include directory, specify OCC_INCLUDE_DIR manually.")
|
|
||||||
ENDIF()
|
|
||||||
ELSE()
|
|
||||||
SET(OCC_INCLUDE_DIR ${OCC_INCLUDE_DIR} CACHE FILEPATH "Open CASCADE header files")
|
|
||||||
MESSAGE(STATUS "Looking for Open CASCADE include files in: ${OCC_INCLUDE_DIR}")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(OPENCASCADE_LIBRARY_NAMES
|
if(OCC_INCLUDE_DIR)
|
||||||
|
message(STATUS "Found Open CASCADE include files in: ${OCC_INCLUDE_DIR}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unable to find Open CASCADE include directory, specify OCC_INCLUDE_DIR manually.")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(OCC_INCLUDE_DIR ${OCC_INCLUDE_DIR} CACHE FILEPATH "Open CASCADE header files")
|
||||||
|
message(STATUS "Looking for Open CASCADE include files in: ${OCC_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(OPENCASCADE_LIBRARY_NAMES
|
||||||
TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO
|
TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO
|
||||||
TKFillet TKSTEP TKSTEPBase TKSTEPAttr TKXSBase TKSTEP209 TKIGES TKOffset TKHLR
|
TKFillet TKSTEP TKSTEPBase TKSTEPAttr TKXSBase TKSTEP209 TKIGES TKOffset TKHLR
|
||||||
|
|
||||||
@@ -363,30 +400,32 @@ SET(OPENCASCADE_LIBRARY_NAMES
|
|||||||
TKBin
|
TKBin
|
||||||
)
|
)
|
||||||
|
|
||||||
IF("${OCC_LIBRARY_DIR}" STREQUAL "")
|
if("${OCC_LIBRARY_DIR}" STREQUAL "")
|
||||||
find_library(OCC_LIBRARY TKernel
|
find_library(OCC_LIBRARY TKernel
|
||||||
[PATHS
|
[PATHS
|
||||||
/usr/lib
|
/usr/lib
|
||||||
]
|
]
|
||||||
REQUIRED
|
REQUIRED
|
||||||
)
|
)
|
||||||
IF(OCC_LIBRARY)
|
|
||||||
GET_FILENAME_COMPONENT(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
|
|
||||||
MESSAGE(STATUS "Found Open CASCADE library files in: ${OCC_LIBRARY_DIR}")
|
|
||||||
ELSE()
|
|
||||||
MESSAGE(FATAL_ERROR "Unable find Open CASCADE library directory, specify OCC_LIBRARY_DIR manually.")
|
|
||||||
ENDIF()
|
|
||||||
ELSE()
|
|
||||||
SET(OCC_LIBRARY_DIR ${OCC_LIBRARY_DIR} CACHE FILEPATH "Open CASCADE library files")
|
|
||||||
MESSAGE(STATUS "Looking for Open CASCADE library files in: ${OCC_LIBRARY_DIR}")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
FIND_LIBRARY(libTKernel NAMES TKernel TKerneld PATHS ${OCC_LIBRARY_DIR} NO_DEFAULT_PATH)
|
if(OCC_LIBRARY)
|
||||||
IF(libTKernel)
|
GET_FILENAME_COMPONENT(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
|
||||||
MESSAGE(STATUS "Required Open Cascade Library files found")
|
message(STATUS "Found Open CASCADE library files in: ${OCC_LIBRARY_DIR}")
|
||||||
ELSE()
|
else()
|
||||||
MESSAGE(FATAL_ERROR "Unable to find Open Cascade library files, aborting")
|
message(FATAL_ERROR "Unable find Open CASCADE library directory, specify OCC_LIBRARY_DIR manually.")
|
||||||
ENDIF()
|
endif()
|
||||||
|
else()
|
||||||
|
set(OCC_LIBRARY_DIR ${OCC_LIBRARY_DIR} CACHE FILEPATH "Open CASCADE library files")
|
||||||
|
message(STATUS "Looking for Open CASCADE library files in: ${OCC_LIBRARY_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(libTKernel NAMES TKernel TKerneld PATHS ${OCC_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||||
|
|
||||||
|
if(libTKernel)
|
||||||
|
message(STATUS "Required Open Cascade Library files found")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unable to find Open Cascade library files, aborting")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Use the found libTKernel as a template for all other OCC libraries
|
# Use the found libTKernel as a template for all other OCC libraries
|
||||||
# TODO Extract this into macro/function
|
# TODO Extract this into macro/function
|
||||||
@@ -401,6 +440,7 @@ if(MSVC)
|
|||||||
add_definitions(-DHAVE_NO_DLL)
|
add_definitions(-DHAVE_NO_DLL)
|
||||||
add_debug_variants(OPENCASCADE_LIBRARIES "${OPENCASCADE_LIBRARIES}" d)
|
add_debug_variants(OPENCASCADE_LIBRARIES "${OPENCASCADE_LIBRARIES}" d)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# OCC might require linking to Winsock depending on the version and build configuration
|
# OCC might require linking to Winsock depending on the version and build configuration
|
||||||
list(APPEND OPENCASCADE_LIBRARIES ws2_32.lib)
|
list(APPEND OPENCASCADE_LIBRARIES ws2_32.lib)
|
||||||
@@ -438,23 +478,24 @@ endif()
|
|||||||
|
|
||||||
endif(BUILD_IFCGEOM)
|
endif(BUILD_IFCGEOM)
|
||||||
|
|
||||||
IF(NOT MINIMAL_BUILD AND COLLADA_SUPPORT)
|
if(NOT MINIMAL_BUILD AND COLLADA_SUPPORT)
|
||||||
# Find OpenCOLLADA
|
# Find OpenCOLLADA
|
||||||
IF("${OPENCOLLADA_INCLUDE_DIR}" STREQUAL "")
|
if("${OPENCOLLADA_INCLUDE_DIR}" STREQUAL "")
|
||||||
MESSAGE(STATUS "No OpenCOLLADA include directory specified")
|
message(STATUS "No OpenCOLLADA include directory specified")
|
||||||
SET(OPENCOLLADA_INCLUDE_DIR "/usr/include/opencollada" CACHE FILEPATH "OpenCOLLADA header files")
|
set(OPENCOLLADA_INCLUDE_DIR "/usr/include/opencollada" CACHE FILEPATH "OpenCOLLADA header files")
|
||||||
ELSE()
|
else()
|
||||||
SET(OPENCOLLADA_INCLUDE_DIR "${OPENCOLLADA_INCLUDE_DIR}" CACHE FILEPATH "OpenCOLLADA header files")
|
set(OPENCOLLADA_INCLUDE_DIR "${OPENCOLLADA_INCLUDE_DIR}" CACHE FILEPATH "OpenCOLLADA header files")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF("${OPENCOLLADA_LIBRARY_DIR}" STREQUAL "")
|
if("${OPENCOLLADA_LIBRARY_DIR}" STREQUAL "")
|
||||||
MESSAGE(STATUS "No OpenCOLLADA library directory specified")
|
message(STATUS "No OpenCOLLADA library directory specified")
|
||||||
FIND_LIBRARY(OPENCOLLADA_FRAMEWORK_LIB NAMES OpenCOLLADAFramework
|
find_library(OPENCOLLADA_FRAMEWORK_LIB NAMES OpenCOLLADAFramework
|
||||||
PATHS /usr/lib64/opencollada /usr/lib/opencollada /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib)
|
PATHS /usr/lib64/opencollada /usr/lib/opencollada /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib)
|
||||||
GET_FILENAME_COMPONENT(OPENCOLLADA_LIBRARY_DIR ${OPENCOLLADA_FRAMEWORK_LIB} PATH)
|
get_filename_component(OPENCOLLADA_LIBRARY_DIR ${OPENCOLLADA_FRAMEWORK_LIB} PATH)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
|
find_library(OpenCOLLADAFramework NAMES OpenCOLLADAFramework OpenCOLLADAFrameworkd PATHS ${OPENCOLLADA_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||||
|
|
||||||
FIND_LIBRARY(OpenCOLLADAFramework NAMES OpenCOLLADAFramework OpenCOLLADAFrameworkd PATHS ${OPENCOLLADA_LIBRARY_DIR} NO_DEFAULT_PATH)
|
|
||||||
if(OpenCOLLADAFramework)
|
if(OpenCOLLADAFramework)
|
||||||
message(STATUS "OpenCOLLADA library files found")
|
message(STATUS "OpenCOLLADA library files found")
|
||||||
else()
|
else()
|
||||||
@@ -462,17 +503,18 @@ IF(NOT MINIMAL_BUILD AND COLLADA_SUPPORT)
|
|||||||
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
|
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
SET(OPENCOLLADA_LIBRARY_DIR "${OPENCOLLADA_LIBRARY_DIR}" CACHE FILEPATH "OpenCOLLADA library files")
|
set(OPENCOLLADA_LIBRARY_DIR "${OPENCOLLADA_LIBRARY_DIR}" CACHE FILEPATH "OpenCOLLADA library files")
|
||||||
|
|
||||||
SET(OPENCOLLADA_INCLUDE_DIRS "${OPENCOLLADA_INCLUDE_DIR}/COLLADABaseUtils" "${OPENCOLLADA_INCLUDE_DIR}/COLLADAStreamWriter")
|
set(OPENCOLLADA_INCLUDE_DIRS "${OPENCOLLADA_INCLUDE_DIR}/COLLADABaseUtils" "${OPENCOLLADA_INCLUDE_DIR}/COLLADAStreamWriter")
|
||||||
|
|
||||||
|
find_file(COLLADASWStreamWriter_h "COLLADASWStreamWriter.h" ${OPENCOLLADA_INCLUDE_DIRS})
|
||||||
|
|
||||||
FIND_FILE(COLLADASWStreamWriter_h "COLLADASWStreamWriter.h" ${OPENCOLLADA_INCLUDE_DIRS})
|
|
||||||
IF(COLLADASWStreamWriter_h)
|
IF(COLLADASWStreamWriter_h)
|
||||||
MESSAGE(STATUS "OpenCOLLADA header files found")
|
message(STATUS "OpenCOLLADA header files found")
|
||||||
ADD_DEFINITIONS(-DWITH_OPENCOLLADA)
|
add_definitions(-DWITH_OPENCOLLADA)
|
||||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_OPENCOLLADA)
|
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_OPENCOLLADA)
|
||||||
|
|
||||||
SET(OPENCOLLADA_LIBRARY_NAMES
|
set(OPENCOLLADA_LIBRARY_NAMES
|
||||||
GeneratedSaxParser MathMLSolver OpenCOLLADABaseUtils OpenCOLLADAFramework OpenCOLLADASaxFrameworkLoader
|
GeneratedSaxParser MathMLSolver OpenCOLLADABaseUtils OpenCOLLADAFramework OpenCOLLADASaxFrameworkLoader
|
||||||
OpenCOLLADAStreamWriter UTF buffer ftoa
|
OpenCOLLADAStreamWriter UTF buffer ftoa
|
||||||
)
|
)
|
||||||
@@ -491,13 +533,15 @@ IF(NOT MINIMAL_BUILD AND COLLADA_SUPPORT)
|
|||||||
else()
|
else()
|
||||||
find_library(pcre_library NAMES pcre PATHS ${OPENCOLLADA_LIBRARY_DIR})
|
find_library(pcre_library NAMES pcre PATHS ${OPENCOLLADA_LIBRARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
GET_FILENAME_COMPONENT(PCRE_LIBRARY_DIR ${pcre_library} PATH)
|
|
||||||
|
get_filename_component(PCRE_LIBRARY_DIR ${pcre_library} PATH)
|
||||||
else()
|
else()
|
||||||
find_library(pcre_library NAMES pcre pcred PATHS ${PCRE_LIBRARY_DIR} NO_DEFAULT_PATH)
|
find_library(pcre_library NAMES pcre pcred PATHS ${PCRE_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(pcre_library)
|
if(pcre_library)
|
||||||
SET(OPENCOLLADA_LIBRARY_DIR ${OPENCOLLADA_LIBRARY_DIR} ${PCRE_LIBRARY_DIR})
|
set(OPENCOLLADA_LIBRARY_DIR ${OPENCOLLADA_LIBRARY_DIR} ${PCRE_LIBRARY_DIR})
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Add release lib regardless whether release or debug found. Debug version will be appended below.
|
# Add release lib regardless whether release or debug found. Debug version will be appended below.
|
||||||
list(APPEND OPENCOLLADA_LIBRARIES "${PCRE_LIBRARY_DIR}/pcre.lib")
|
list(APPEND OPENCOLLADA_LIBRARIES "${PCRE_LIBRARY_DIR}/pcre.lib")
|
||||||
@@ -509,37 +553,34 @@ IF(NOT MINIMAL_BUILD AND COLLADA_SUPPORT)
|
|||||||
"Disable COLLADA_SUPPORT or fix PCRE_LIBRARY_DIR path to proceed.")
|
"Disable COLLADA_SUPPORT or fix PCRE_LIBRARY_DIR path to proceed.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
IF(MSVC)
|
if(MSVC)
|
||||||
add_debug_variants(OPENCOLLADA_LIBRARIES "${OPENCOLLADA_LIBRARIES}" d)
|
add_debug_variants(OPENCOLLADA_LIBRARIES "${OPENCOLLADA_LIBRARIES}" d)
|
||||||
ENDIF()
|
endif()
|
||||||
ELSE()
|
else()
|
||||||
message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA headers. "
|
message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA headers. "
|
||||||
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
|
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
if(NOT MINIMAL_BUILD AND HDF5_SUPPORT)
|
if(NOT MINIMAL_BUILD AND HDF5_SUPPORT)
|
||||||
IF("${HDF5_INCLUDE_DIR}" STREQUAL "")
|
if("${HDF5_INCLUDE_DIR}" STREQUAL "")
|
||||||
MESSAGE(STATUS "No HDF5 include directory specified")
|
message(STATUS "No HDF5 include directory specified")
|
||||||
ElSE()
|
else()
|
||||||
SET(HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIR}" CACHE FILEPATH "HDF5 header files")
|
set(HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIR}" CACHE FILEPATH "HDF5 header files")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF("${HDF5_LIBRARY_DIR}" STREQUAL "")
|
if("${HDF5_LIBRARY_DIR}" STREQUAL "")
|
||||||
MESSAGE(STATUS "No HDF5 library directory specified")
|
message(STATUS "No HDF5 library directory specified")
|
||||||
ElSE()
|
else()
|
||||||
SET(HDF5_LIBRARY_DIR "${HDF5_LIBRARY_DIR}" CACHE FILEPATH "HDF5 library files")
|
set(HDF5_LIBRARY_DIR "${HDF5_LIBRARY_DIR}" CACHE FILEPATH "HDF5 library files")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
if(HDF5_LIBRARY_DIR)
|
if(HDF5_LIBRARY_DIR)
|
||||||
# result of the HDF5 ctest package
|
# result of the HDF5 ctest package
|
||||||
# Find zlib using cmake find_library. How should this be implemented?
|
# Find zlib using cmake find_library. How should this be implemented?
|
||||||
# FIND_LIBRARY(NAMES z libz libz_debug PATHS ... NO_DEFAULT_PATH)
|
# FIND_LIBRARY(NAMES z libz libz_debug PATHS ... NO_DEFAULT_PATH)
|
||||||
|
|
||||||
|
|
||||||
if("$ENV{CONDA_BUILD}" STREQUAL "")
|
if("$ENV{CONDA_BUILD}" STREQUAL "")
|
||||||
# result of the HDF5 ctest package
|
# result of the HDF5 ctest package
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(zlib_post lib)
|
set(zlib_post lib)
|
||||||
set(lib_ext lib)
|
set(lib_ext lib)
|
||||||
@@ -551,7 +592,7 @@ if(NOT MINIMAL_BUILD AND HDF5_SUPPORT)
|
|||||||
set(debug_postfix "_debug")
|
set(debug_postfix "_debug")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
SET(HDF5_LIBRARIES
|
set(HDF5_LIBRARIES
|
||||||
"${HDF5_LIBRARY_DIR}/libhdf5_cpp${debug_postfix}.${lib_ext}"
|
"${HDF5_LIBRARY_DIR}/libhdf5_cpp${debug_postfix}.${lib_ext}"
|
||||||
"${HDF5_LIBRARY_DIR}/libhdf5${debug_postfix}.${lib_ext}"
|
"${HDF5_LIBRARY_DIR}/libhdf5${debug_postfix}.${lib_ext}"
|
||||||
"${HDF5_LIBRARY_DIR}/libz${zlib_post}${debug_postfix}.${lib_ext}"
|
"${HDF5_LIBRARY_DIR}/libz${zlib_post}${debug_postfix}.${lib_ext}"
|
||||||
@@ -559,8 +600,9 @@ if(NOT MINIMAL_BUILD AND HDF5_SUPPORT)
|
|||||||
"${HDF5_LIBRARY_DIR}/libaec${debug_postfix}.${lib_ext}"
|
"${HDF5_LIBRARY_DIR}/libaec${debug_postfix}.${lib_ext}"
|
||||||
)
|
)
|
||||||
|
|
||||||
ELSE()
|
else()
|
||||||
MESSAGE(STATUS "Packaging hdf5 and zlib for conda distribution")
|
message(STATUS "Packaging hdf5 and zlib for conda distribution")
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# Windows
|
# Windows
|
||||||
set(zlib_post zlib)
|
set(zlib_post zlib)
|
||||||
@@ -575,19 +617,17 @@ if(NOT MINIMAL_BUILD AND HDF5_SUPPORT)
|
|||||||
set(lib_ext so)
|
set(lib_ext so)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
SET(HDF5_LIBRARIES
|
set(HDF5_LIBRARIES
|
||||||
"${HDF5_LIBRARY_DIR}/libhdf5_cpp.${lib_ext}"
|
"${HDF5_LIBRARY_DIR}/libhdf5_cpp.${lib_ext}"
|
||||||
"${HDF5_LIBRARY_DIR}/libhdf5.${lib_ext}"
|
"${HDF5_LIBRARY_DIR}/libhdf5.${lib_ext}"
|
||||||
"${HDF5_LIBRARY_DIR}/${zlib_post}.${lib_ext}"
|
"${HDF5_LIBRARY_DIR}/${zlib_post}.${lib_ext}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT HDF5_LIBRARIES)
|
if(NOT HDF5_LIBRARIES)
|
||||||
# debian default
|
# debian default
|
||||||
|
set(HDF5_LIBRARIES
|
||||||
SET(HDF5_LIBRARIES
|
|
||||||
/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so
|
/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so
|
||||||
/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so
|
/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so
|
||||||
/usr/lib/x86_64-linux-gnu/libsz.so
|
/usr/lib/x86_64-linux-gnu/libsz.so
|
||||||
@@ -609,9 +649,11 @@ if(ENABLE_BUILD_OPTIMIZATIONS)
|
|||||||
# C++
|
# C++
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ob2 /GL")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ob2 /GL")
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
||||||
|
|
||||||
# Linker
|
# Linker
|
||||||
# /OPT:REF enables also /OPT:ICF and disables INCREMENTAL
|
# /OPT:REF enables also /OPT:ICF and disables INCREMENTAL
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF")
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF")
|
||||||
|
|
||||||
# /OPT:NOICF is recommended when /DEBUG is used (http://msdn.microsoft.com/en-us/library/xe4t6fc1.aspx)
|
# /OPT:NOICF is recommended when /DEBUG is used (http://msdn.microsoft.com/en-us/library/xe4t6fc1.aspx)
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:NOICF")
|
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:NOICF")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF")
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF")
|
||||||
@@ -623,11 +665,12 @@ if(ENABLE_BUILD_OPTIMIZATIONS)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
IF(MSVC)
|
if(MSVC)
|
||||||
# warning due to virtual inheritance
|
# warning due to virtual inheritance
|
||||||
ADD_DEFINITIONS(-wd4250)
|
add_definitions(-wd4250)
|
||||||
|
|
||||||
# warning due to select definitions in the schema being redundant
|
# warning due to select definitions in the schema being redundant
|
||||||
ADD_DEFINITIONS(-wd4584)
|
add_definitions(-wd4584)
|
||||||
|
|
||||||
# didn't work well on ifcopenbot, @todo make configurable
|
# didn't work well on ifcopenbot, @todo make configurable
|
||||||
# add_definitions(/MP)
|
# add_definitions(/MP)
|
||||||
@@ -637,24 +680,30 @@ IF(MSVC)
|
|||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
IF(USE_VLD)
|
if(USE_VLD)
|
||||||
ADD_DEFINITIONS(-DUSE_VLD)
|
add_definitions(-DUSE_VLD)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# Enforce Unicode for CRT and Win32 API calls
|
# Enforce Unicode for CRT and Win32 API calls
|
||||||
ADD_DEFINITIONS(-D_UNICODE -DUNICODE)
|
add_definitions(-D_UNICODE -DUNICODE)
|
||||||
|
|
||||||
# Disable warnings about unsafe C functions; we could use the safe C99 & C11 versions if we have no need for supporting old compilers.
|
# Disable warnings about unsafe C functions; we could use the safe C99 & C11 versions if we have no need for supporting old compilers.
|
||||||
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
|
||||||
ADD_DEFINITIONS(-bigobj) # required for building the big ifcXXX.objs, https://msdn.microsoft.com/en-us/library/ms173499.aspx
|
add_definitions(-bigobj) # required for building the big ifcXXX.objs, https://msdn.microsoft.com/en-us/library/ms173499.aspx
|
||||||
|
|
||||||
# Bump up the warning level from the default 3 to 4.
|
# Bump up the warning level from the default 3 to 4.
|
||||||
ADD_DEFINITIONS(-W4)
|
add_definitions(-W4)
|
||||||
IF(MSVC_VERSION GREATER 1800) # > 2013
|
|
||||||
|
if(MSVC_VERSION GREATER 1800) # > 2013
|
||||||
# Disable overeager and false positives causing C4458 ("declaration of 'indentifier' hides class member"), at least for now.
|
# Disable overeager and false positives causing C4458 ("declaration of 'indentifier' hides class member"), at least for now.
|
||||||
ADD_DEFINITIONS(-wd4458)
|
add_definitions(-wd4458)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# Enforce standards-conformance on VS > 2015, older Boost versions fail to compile with this
|
# Enforce standards-conformance on VS > 2015, older Boost versions fail to compile with this
|
||||||
if(MSVC_VERSION GREATER 1900 AND(Boost_MAJOR_VERSION GREATER 1 OR Boost_MINOR_VERSION GREATER 66))
|
if(MSVC_VERSION GREATER 1900 AND(Boost_MAJOR_VERSION GREATER 1 OR Boost_MINOR_VERSION GREATER 66))
|
||||||
add_definitions(-permissive-)
|
add_definitions(-permissive-)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Link against the static VC runtime
|
# Link against the static VC runtime
|
||||||
# TODO Make this configurable
|
# TODO Make this configurable
|
||||||
# IF("$ENV{CONDA_BUILD}" STREQUAL "")
|
# IF("$ENV{CONDA_BUILD}" STREQUAL "")
|
||||||
@@ -669,22 +718,25 @@ IF(MSVC)
|
|||||||
# ENDIF()
|
# ENDIF()
|
||||||
# ENDFOREACH()
|
# ENDFOREACH()
|
||||||
# ENDIF()
|
# ENDIF()
|
||||||
ElSE()
|
else()
|
||||||
add_definitions(-Wall -Wextra)
|
add_definitions(-Wall -Wextra)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
add_definitions(-Wno-tautological-constant-out-of-range-compare)
|
add_definitions(-Wno-tautological-constant-out-of-range-compare)
|
||||||
else()
|
else()
|
||||||
add_definitions(-Wno-maybe-uninitialized)
|
add_definitions(-Wno-maybe-uninitialized)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 9.0))
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 9.0))
|
||||||
# OpenCascade spews a lot of deprecated-copy warnings
|
# OpenCascade spews a lot of deprecated-copy warnings
|
||||||
add_definitions(-Wno-deprecated-copy)
|
add_definitions(-Wno-deprecated-copy)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# -fPIC is not relevant on Windows and creates pointless warnings
|
# -fPIC is not relevant on Windows and creates pointless warnings
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
add_definitions(-fPIC)
|
add_definitions(-fPIC)
|
||||||
endif()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS}
|
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS}
|
||||||
${Boost_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${JSON_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}
|
${Boost_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${JSON_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}
|
||||||
@@ -715,33 +767,38 @@ foreach(s ${SCHEMA_VERSIONS})
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
string(REPLACE ";" ")(" schema_version_seq "(${SCHEMA_VERSIONS})")
|
string(REPLACE ";" ")(" schema_version_seq "(${SCHEMA_VERSIONS})")
|
||||||
ADD_DEFINITIONS(-DSCHEMA_SEQ=${schema_version_seq})
|
add_definitions(-DSCHEMA_SEQ=${schema_version_seq})
|
||||||
|
|
||||||
if(COMPILE_SCHEMA)
|
if(COMPILE_SCHEMA)
|
||||||
# @todo, this appears to be untested at the moment
|
# @todo, this appears to be untested at the moment
|
||||||
|
|
||||||
find_package(PythonInterp)
|
find_package(PythonInterp)
|
||||||
|
|
||||||
IF(NOT PYTHONINTERP_FOUND)
|
if(NOT PYTHONINTERP_FOUND)
|
||||||
MESSAGE(FATAL_ERROR "A Python interpreter is necessary when COMPILE_SCHEMA is enabled. Disable COMPILE_SCHEMA or fix Python paths to proceed.")
|
message(FATAL_ERROR "A Python interpreter is necessary when COMPILE_SCHEMA is enabled. Disable COMPILE_SCHEMA or fix Python paths to proceed.")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
set(IFC_RELEASE_NOT_USED ${SCHEMA_VERSIONS})
|
set(IFC_RELEASE_NOT_USED ${SCHEMA_VERSIONS})
|
||||||
|
|
||||||
# Install pyparsing if necessary
|
# Install pyparsing if necessary
|
||||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip freeze OUTPUT_VARIABLE PYTHON_PACKAGE_LIST)
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip freeze OUTPUT_VARIABLE PYTHON_PACKAGE_LIST)
|
||||||
|
|
||||||
if("${PYTHON_PACKAGE_LIST}" STREQUAL "")
|
if("${PYTHON_PACKAGE_LIST}" STREQUAL "")
|
||||||
execute_process(COMMAND pip freeze OUTPUT_VARIABLE PYTHON_PACKAGE_LIST)
|
execute_process(COMMAND pip freeze OUTPUT_VARIABLE PYTHON_PACKAGE_LIST)
|
||||||
|
|
||||||
if("${PYTHON_PACKAGE_LIST}" STREQUAL "")
|
if("${PYTHON_PACKAGE_LIST}" STREQUAL "")
|
||||||
message(WARNING "Failed to find pip. Pip is required to automatically install pyparsing")
|
message(WARNING "Failed to find pip. Pip is required to automatically install pyparsing")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
string(FIND "${PYTHON_PACKAGE_LIST}" pyparsing PYPARSING_FOUND)
|
string(FIND "${PYTHON_PACKAGE_LIST}" pyparsing PYPARSING_FOUND)
|
||||||
|
|
||||||
if("${PYPARSING_FOUND}" STREQUAL "-1")
|
if("${PYPARSING_FOUND}" STREQUAL "-1")
|
||||||
message(STATUS "Installing pyparsing")
|
message(STATUS "Installing pyparsing")
|
||||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip "install" --user pyparsing RESULT_VARIABLE SUCCESS)
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip "install" --user pyparsing RESULT_VARIABLE SUCCESS)
|
||||||
|
|
||||||
if(NOT "${SUCCESS}" STREQUAL "0")
|
if(NOT "${SUCCESS}" STREQUAL "0")
|
||||||
execute_process(COMMAND pip "install" --user pyparsing RESULT_VARIABLE SUCCESS)
|
execute_process(COMMAND pip "install" --user pyparsing RESULT_VARIABLE SUCCESS)
|
||||||
|
|
||||||
if(NOT "${SUCCESS}" STREQUAL "0")
|
if(NOT "${SUCCESS}" STREQUAL "0")
|
||||||
message(WARNING "Failed to automatically install pyparsing. Please install manually")
|
message(WARNING "Failed to automatically install pyparsing. Please install manually")
|
||||||
endif()
|
endif()
|
||||||
@@ -758,7 +815,7 @@ if(COMPILE_SCHEMA)
|
|||||||
RESULT_VARIABLE SUCCESS)
|
RESULT_VARIABLE SUCCESS)
|
||||||
|
|
||||||
if(NOT "${SUCCESS}" STREQUAL "0")
|
if(NOT "${SUCCESS}" STREQUAL "0")
|
||||||
MESSAGE(FATAL_ERROR "Failed to bootstrap parser. Make sure pyparsing is installed")
|
message(FATAL_ERROR "Failed to bootstrap parser. Make sure pyparsing is installed")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Generate code
|
# Generate code
|
||||||
@@ -803,6 +860,7 @@ file(GLOB IFCPARSE_CPP_FILES_ALL ../src/ifcparse/*.cpp)
|
|||||||
|
|
||||||
foreach(s ${IFCPARSE_H_FILES_ALL})
|
foreach(s ${IFCPARSE_H_FILES_ALL})
|
||||||
get_filename_component(p "${s}" NAME)
|
get_filename_component(p "${s}" NAME)
|
||||||
|
|
||||||
if(NOT "${p}" MATCHES "[0-9]")
|
if(NOT "${p}" MATCHES "[0-9]")
|
||||||
list(APPEND IFCPARSE_H_FILES "${s}")
|
list(APPEND IFCPARSE_H_FILES "${s}")
|
||||||
endif()
|
endif()
|
||||||
@@ -810,6 +868,7 @@ endforeach()
|
|||||||
|
|
||||||
foreach(s ${IFCPARSE_CPP_FILES_ALL})
|
foreach(s ${IFCPARSE_CPP_FILES_ALL})
|
||||||
get_filename_component(p "${s}" NAME)
|
get_filename_component(p "${s}" NAME)
|
||||||
|
|
||||||
if(NOT "${p}" MATCHES "[0-9]")
|
if(NOT "${p}" MATCHES "[0-9]")
|
||||||
list(APPEND IFCPARSE_CPP_FILES "${s}")
|
list(APPEND IFCPARSE_CPP_FILES "${s}")
|
||||||
endif()
|
endif()
|
||||||
@@ -826,7 +885,6 @@ foreach(s ${SCHEMA_VERSIONS})
|
|||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES})
|
set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES})
|
||||||
|
|
||||||
add_library(IfcParse ${IFCPARSE_FILES})
|
add_library(IfcParse ${IFCPARSE_FILES})
|
||||||
@@ -838,8 +896,8 @@ else()
|
|||||||
TARGET_LINK_LIBRARIES(IfcParse ${Boost_LIBRARIES} ${BCRYPT_LIBRARIES} ${LIBXML2_LIBRARIES})
|
TARGET_LINK_LIBRARIES(IfcParse ${Boost_LIBRARIES} ${BCRYPT_LIBRARIES} ${LIBXML2_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_IFCGEOM)
|
|
||||||
|
|
||||||
|
if(BUILD_IFCGEOM)
|
||||||
# IfcGeom
|
# IfcGeom
|
||||||
file(GLOB IFCGEOM_H_FILES ../src/ifcgeom/*.h ../src/ifcgeom/*.i)
|
file(GLOB IFCGEOM_H_FILES ../src/ifcgeom/*.h ../src/ifcgeom/*.i)
|
||||||
file(GLOB IFCGEOM_CPP_FILES ../src/ifcgeom/*.cpp)
|
file(GLOB IFCGEOM_CPP_FILES ../src/ifcgeom/*.cpp)
|
||||||
@@ -874,7 +932,6 @@ endif()
|
|||||||
endif(BUILD_IFCGEOM)
|
endif(BUILD_IFCGEOM)
|
||||||
|
|
||||||
if(BUILD_CONVERT OR BUILD_IFCPYTHON)
|
if(BUILD_CONVERT OR BUILD_IFCPYTHON)
|
||||||
|
|
||||||
# Serializers
|
# Serializers
|
||||||
file(GLOB SERIALIZERS_H_FILES ../src/serializers/*.h)
|
file(GLOB SERIALIZERS_H_FILES ../src/serializers/*.h)
|
||||||
file(GLOB SERIALIZERS_CPP_FILES ../src/serializers/*.cpp)
|
file(GLOB SERIALIZERS_CPP_FILES ../src/serializers/*.cpp)
|
||||||
@@ -902,12 +959,11 @@ TARGET_LINK_LIBRARIES(Serializers ${SERIALIZER_SCHEMA_LIBRARIES} ${OPENCOLLADA_L
|
|||||||
endif(BUILD_CONVERT OR BUILD_IFCPYTHON)
|
endif(BUILD_CONVERT OR BUILD_IFCPYTHON)
|
||||||
|
|
||||||
if(BUILD_CONVERT)
|
if(BUILD_CONVERT)
|
||||||
|
|
||||||
# IfcConvert
|
# IfcConvert
|
||||||
file(GLOB IFCCONVERT_CPP_FILES ../src/ifcconvert/*.cpp)
|
file(GLOB IFCCONVERT_CPP_FILES ../src/ifcconvert/*.cpp)
|
||||||
file(GLOB IFCCONVERT_H_FILES ../src/ifcconvert/*.h)
|
file(GLOB IFCCONVERT_H_FILES ../src/ifcconvert/*.h)
|
||||||
set(IFCCONVERT_FILES ${IFCCONVERT_CPP_FILES} ${IFCCONVERT_H_FILES})
|
set(IFCCONVERT_FILES ${IFCCONVERT_CPP_FILES} ${IFCCONVERT_H_FILES})
|
||||||
ADD_EXECUTABLE(IfcConvert ${IFCCONVERT_FILES})
|
add_executable(IfcConvert ${IFCCONVERT_FILES})
|
||||||
set_target_properties(IfcConvert PROPERTIES COMPILE_FLAGS "${CONVERT_PRECISION}")
|
set_target_properties(IfcConvert PROPERTIES COMPILE_FLAGS "${CONVERT_PRECISION}")
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(IfcConvert ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${HDF5_LIBRARIES} ${USD_LIBRARIES})
|
TARGET_LINK_LIBRARIES(IfcConvert ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${HDF5_LIBRARIES} ${USD_LIBRARIES})
|
||||||
@@ -919,33 +975,98 @@ if ((NOT WIN32) AND BUILD_SHARED_LIBS)
|
|||||||
SET_INSTALL_RPATHS(IfcConvert "${IFCOPENSHELL_LIBRARY_DIR};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS};${OPENCOLLADA_LIBRARY_DIR}")
|
SET_INSTALL_RPATHS(IfcConvert "${IFCOPENSHELL_LIBRARY_DIR};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS};${OPENCOLLADA_LIBRARY_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
INSTALL(TARGETS IfcConvert
|
install(TARGETS IfcConvert
|
||||||
ARCHIVE DESTINATION ${LIBDIR}
|
ARCHIVE DESTINATION ${LIBDIR}
|
||||||
LIBRARY DESTINATION ${LIBDIR}
|
LIBRARY DESTINATION ${LIBDIR}
|
||||||
RUNTIME DESTINATION ${BINDIR}
|
RUNTIME DESTINATION ${BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
endif(BUILD_CONVERT)
|
endif(BUILD_CONVERT)
|
||||||
|
|
||||||
# IfcGeomServer
|
# IfcGeomServer
|
||||||
if(NOT MINIMAL_BUILD AND BUILD_GEOMSERVER)
|
if(NOT MINIMAL_BUILD AND BUILD_GEOMSERVER)
|
||||||
|
|
||||||
file(GLOB CPP_FILES ../src/ifcgeomserver/*.cpp)
|
file(GLOB CPP_FILES ../src/ifcgeomserver/*.cpp)
|
||||||
file(GLOB H_FILES ../src/ifcgeomserver/*.h)
|
file(GLOB H_FILES ../src/ifcgeomserver/*.h)
|
||||||
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
|
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
|
||||||
ADD_EXECUTABLE(IfcGeomServer ${SOURCE_FILES})
|
add_executable(IfcGeomServer ${SOURCE_FILES})
|
||||||
TARGET_LINK_LIBRARIES(IfcGeomServer ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES})
|
target_link_libraries(IfcGeomServer ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES})
|
||||||
|
|
||||||
if((NOT WIN32) AND BUILD_SHARED_LIBS)
|
if((NOT WIN32) AND BUILD_SHARED_LIBS)
|
||||||
SET_INSTALL_RPATHS(IfcGeomServer "${IFCOPENSHELL_LIBRARY_DIR};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS}")
|
SET_INSTALL_RPATHS(IfcGeomServer "${IFCOPENSHELL_LIBRARY_DIR};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
INSTALL(TARGETS IfcGeomServer
|
install(TARGETS IfcGeomServer
|
||||||
|
ARCHIVE DESTINATION ${LIBDIR}
|
||||||
|
LIBRARY DESTINATION ${LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${BINDIR}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ADD_COMMIT_SHA)
|
||||||
|
find_package(Git)
|
||||||
|
|
||||||
|
if(GIT_FOUND)
|
||||||
|
message("git found: ${GIT_EXECUTABLE} with version ${GIT_VERSION_STRING}")
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} branch --contains HEAD
|
||||||
|
OUTPUT_VARIABLE git_branches
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
string(REPLACE "\n" ";" git_branch_list "${git_branches}")
|
||||||
|
|
||||||
|
foreach(git_branch_candidate IN ITEMS ${git_branch_list})
|
||||||
|
string(STRIP "${git_branch_candidate}" git_branch_candidate_2)
|
||||||
|
|
||||||
|
if(NOT git_branch_candidate_2 MATCHES "^HEAD$")
|
||||||
|
set(git_branch ${git_branch_candidate_2})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||||
|
OUTPUT_VARIABLE git_sha
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
message(STATUS "IfcOpenShell branch: \"${git_branch}\"")
|
||||||
|
message(STATUS "IfcOpenShell commit: \"${git_sha}\"")
|
||||||
|
add_definitions(-DIFCOPENSHELL_BRANCH=${git_branch})
|
||||||
|
add_definitions(-DIFCOPENSHELL_COMMIT=${git_sha})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
if(BUILD_DOCUMENTATION)
|
||||||
|
set(CMAKE_MODULE_PATH "../docs/cmake")
|
||||||
|
add_subdirectory(../docs docs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT MINIMAL_BUILD AND BUILD_IFCPYTHON)
|
||||||
|
add_subdirectory(../src/ifcwrap ifcwrap)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_EXAMPLES)
|
||||||
|
add_subdirectory(../src/examples examples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT MINIMAL_BUILD AND BUILD_IFCMAX)
|
||||||
|
add_subdirectory(../src/ifcmax ifcmax)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT MINIMAL_BUILD)
|
||||||
|
add_subdirectory(../src/svgfill svgfill)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# CMake installation targets
|
||||||
|
install(FILES ${IFCPARSE_H_FILES}
|
||||||
|
DESTINATION ${INCLUDEDIR}/ifcparse
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS IfcParse
|
||||||
ARCHIVE DESTINATION ${LIBDIR}
|
ARCHIVE DESTINATION ${LIBDIR}
|
||||||
LIBRARY DESTINATION ${LIBDIR}
|
LIBRARY DESTINATION ${LIBDIR}
|
||||||
RUNTIME DESTINATION ${BINDIR}
|
RUNTIME DESTINATION ${BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ADD_COMMIT_SHA)
|
if (ADD_COMMIT_SHA)
|
||||||
@@ -1010,16 +1131,18 @@ INSTALL(TARGETS IfcParse
|
|||||||
RUNTIME DESTINATION ${BINDIR}
|
RUNTIME DESTINATION ${BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> af84942e (cmake format and unify file)
|
||||||
if(BUILD_IFCGEOM)
|
if(BUILD_IFCGEOM)
|
||||||
INSTALL(FILES ${IFCGEOM_H_FILES}
|
install(FILES ${IFCGEOM_H_FILES}
|
||||||
DESTINATION ${INCLUDEDIR}/ifcgeom
|
DESTINATION ${INCLUDEDIR}/ifcgeom
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALL(FILES ${SCHEMA_AGNOSTIC_H_FILES}
|
install(FILES ${SCHEMA_AGNOSTIC_H_FILES}
|
||||||
DESTINATION ${INCLUDEDIR}/ifcgeom_schema_agnostic
|
DESTINATION ${INCLUDEDIR}/ifcgeom_schema_agnostic
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALL(TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} IfcGeom
|
install(TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} IfcGeom
|
||||||
ARCHIVE DESTINATION ${LIBDIR}
|
ARCHIVE DESTINATION ${LIBDIR}
|
||||||
LIBRARY DESTINATION ${LIBDIR}
|
LIBRARY DESTINATION ${LIBDIR}
|
||||||
RUNTIME DESTINATION ${BINDIR}
|
RUNTIME DESTINATION ${BINDIR}
|
||||||
@@ -1027,23 +1150,23 @@ INSTALL(TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} IfcGeom
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BUILD_CONVERT)
|
if(BUILD_CONVERT)
|
||||||
INSTALL(TARGETS Serializers ${SERIALIZER_SCHEMA_LIBRARIES}
|
install(TARGETS Serializers ${SERIALIZER_SCHEMA_LIBRARIES}
|
||||||
ARCHIVE DESTINATION ${LIBDIR}
|
ARCHIVE DESTINATION ${LIBDIR}
|
||||||
LIBRARY DESTINATION ${LIBDIR}
|
LIBRARY DESTINATION ${LIBDIR}
|
||||||
RUNTIME DESTINATION ${BINDIR}
|
RUNTIME DESTINATION ${BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALL(FILES ${SERIALIZERS_FILES}
|
install(FILES ${SERIALIZERS_FILES}
|
||||||
DESTINATION ${INCLUDEDIR}/serializers/
|
DESTINATION ${INCLUDEDIR}/serializers/
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALL(FILES ${SERIALIZERS_S_FILES}
|
install(FILES ${SERIALIZERS_S_FILES}
|
||||||
DESTINATION ${INCLUDEDIR}/serializers/schema_dependent
|
DESTINATION ${INCLUDEDIR}/serializers/schema_dependent
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
IF(BUILD_QTVIEWER)
|
IF(BUILD_QTVIEWER)
|
||||||
ADD_SUBDIRECTORY(../src/qtviewer qtviewer)
|
add_subdirectory(../src/qtviewer qtviewer)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND CPACK_SOURCE_IGNORE_FILES
|
list(APPEND CPACK_SOURCE_IGNORE_FILES
|
||||||
@@ -1063,11 +1186,10 @@ set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
|||||||
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
||||||
|
|
||||||
|
|
||||||
set(CPACK_GENERATOR "TGZ;DEB")
|
set(CPACK_GENERATOR "TGZ;DEB")
|
||||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||||
|
|
||||||
FOREACH(COMPONENT IN ITEMS ${BOOST_COMPONENTS})
|
foreach(COMPONENT IN ITEMS ${BOOST_COMPONENTS})
|
||||||
string(REPLACE "_" "-" COMP ${COMPONENT})
|
string(REPLACE "_" "-" COMP ${COMPONENT})
|
||||||
set(BOOST_DEPS "${BOOST_DEPS}, libboost-${COMP}-dev")
|
set(BOOST_DEPS "${BOOST_DEPS}, libboost-${COMP}-dev")
|
||||||
endforeach(COMPONENT)
|
endforeach(COMPONENT)
|
||||||
@@ -1081,6 +1203,6 @@ set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
|||||||
set(CPACK_DEBIAN_PACKAGE_SECTION "science")
|
set(CPACK_DEBIAN_PACKAGE_SECTION "science")
|
||||||
set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${EXTRA_VERSION}")
|
set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${EXTRA_VERSION}")
|
||||||
set(CPACK_DEBIAN_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
set(CPACK_DEBIAN_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
#set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/debian/postinst")
|
|
||||||
|
|
||||||
|
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/debian/postinst")
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|||||||
Reference in New Issue
Block a user