2015-10-28 19:45:07 +02:00
|
|
|
################################################################################
|
|
|
|
|
# #
|
|
|
|
|
# This file is part of IfcOpenShell. #
|
|
|
|
|
# #
|
|
|
|
|
# IfcOpenShell is free software: you can redistribute it and/or modify #
|
|
|
|
|
# it under the terms of the Lesser GNU General Public License as published by #
|
|
|
|
|
# the Free Software Foundation, either version 3.0 of the License, or #
|
|
|
|
|
# (at your option) any later version. #
|
|
|
|
|
# #
|
|
|
|
|
# IfcOpenShell is distributed in the hope that it will be useful, #
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
|
|
|
# Lesser GNU General Public License for more details. #
|
|
|
|
|
# #
|
|
|
|
|
# You should have received a copy of the Lesser GNU General Public License #
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
|
|
|
|
# #
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2018-06-19 09:45:16 +02:00
|
|
|
cmake_minimum_required(VERSION 3.1.3)
|
2021-07-29 14:54:00 +02:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
2023-08-28 09:29:58 +02:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON) # not necessary, but encouraged
|
2015-10-28 19:45:07 +02:00
|
|
|
|
2023-05-07 22:46:05 +02:00
|
|
|
project(IfcOpenShell VERSION 0.7.0)
|
2021-08-07 23:09:19 +02:00
|
|
|
|
|
|
|
|
cmake_policy(SET CMP0048 NEW)
|
|
|
|
|
cmake_policy(SET CMP0074 NEW)
|
|
|
|
|
cmake_policy(SET CMP0078 OLD)
|
|
|
|
|
cmake_policy(SET CMP0086 NEW)
|
2011-05-08 11:04:32 +00:00
|
|
|
|
2023-08-28 09:32:39 +02:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-07-01 17:55:47 +01:00
|
|
|
# use extra version to make pre-release using eg semver
|
2023-08-28 09:29:58 +02:00
|
|
|
set(EXTRA_VERSION "-alpha.3")
|
2011-05-08 11:04:32 +00:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
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(IFCXML_SUPPORT "Build IfcParse with ifcXML support (requires libxml2)." ON)
|
|
|
|
|
option(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF)
|
|
|
|
|
option(BUILD_PACKAGE "" OFF)
|
|
|
|
|
option(BUILD_IFCGEOM "Build IfcGeom." ON)
|
|
|
|
|
option(BUILD_DOCUMENTATION "Build IfcOpenShell Documentation." OFF)
|
|
|
|
|
option(BUILD_IFCPYTHON "Build IfcPython." ON)
|
|
|
|
|
option(BUILD_EXAMPLES "Build example applications." ON)
|
|
|
|
|
option(BUILD_GEOMSERVER "Build IfcGeomServer executable." ON)
|
|
|
|
|
option(BUILD_CONVERT "Build IfcConvert executable." ON)
|
|
|
|
|
option(HDF5_SUPPORT "Enable HDF5 support (requires HDF5, zlib)" ON)
|
|
|
|
|
option(USE_VLD "Use Visual Leak Detector for debugging memory leaks, MSVC-only." OFF)
|
|
|
|
|
option(USE_MMAP "Adds a command line options to parse IFC files from memory mapped files using Boost.Iostreams" 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)
|
|
|
|
|
|
2023-05-07 11:45:47 +02:00
|
|
|
OPTION(NO_WARN "Disable all warnings" OFF)
|
2022-11-25 13:16:36 +01:00
|
|
|
OPTION(WASM_BUILD OFF)
|
2023-08-28 09:29:58 +02:00
|
|
|
if(${HAS_MAX})
|
|
|
|
|
option(BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." OFF)
|
2019-04-03 15:08:14 +02:00
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if(${BUILD_CONVERT})
|
|
|
|
|
option(GLTF_SUPPORT "Build IfcConvert with glTF support (requires json.hpp)." OFF)
|
2023-05-07 11:45:47 +02:00
|
|
|
OPTION(USD_SUPPORT "Build IfcConvert with USD support (requires pixar's USD library)." OFF)
|
2019-07-10 14:35:56 +02:00
|
|
|
endif()
|
2019-04-03 15:08:14 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
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)
|
2023-08-28 09:32:39 +02:00
|
|
|
option(GLTF_SUPPORT "Build IfcConvert with glTF support (requires json.hpp)." OFF)
|
|
|
|
|
option(BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." OFF)
|
|
|
|
|
# QtViewer requires Qt5
|
|
|
|
|
option(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer" OFF)
|
2022-03-19 19:32:42 +00:00
|
|
|
|
2022-06-14 15:25:14 +02:00
|
|
|
if(MSVC AND MSVC_PARALLEL_BUILD)
|
2023-08-28 09:29:58 +02:00
|
|
|
add_definitions("/MP")
|
2022-06-14 15:25:14 +02:00
|
|
|
endif()
|
|
|
|
|
|
2023-05-07 11:45:47 +02:00
|
|
|
if(NO_WARN)
|
|
|
|
|
if(MSVC)
|
|
|
|
|
add_compile_options("/w")
|
|
|
|
|
else()
|
|
|
|
|
add_compile_options("-w")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-08-29 09:10:02 +05:30
|
|
|
# QtViewer requires Qt6
|
2022-04-23 15:39:03 +02:00
|
|
|
OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer" OFF)
|
2021-02-09 12:54:05 +00:00
|
|
|
include(GNUInstallDirs)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if((BUILD_CONVERT OR BUILD_GEOMSERVER OR BUILD_IFCPYTHON) AND(NOT BUILD_IFCGEOM))
|
2018-09-08 13:23:36 +02:00
|
|
|
message(STATUS "'IfcGeom' is required with current outputs")
|
|
|
|
|
set(BUILD_IFCGEOM ON)
|
|
|
|
|
endif()
|
2016-01-09 06:38:33 +01:00
|
|
|
|
2016-05-15 15:47:21 +02:00
|
|
|
# Specify where to install files
|
2023-08-28 09:29:58 +02:00
|
|
|
if(NOT BINDIR)
|
2016-05-15 15:47:21 +02:00
|
|
|
set(BINDIR bin)
|
2023-08-28 09:29:58 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(NOT IS_ABSOLUTE ${BINDIR})
|
2021-02-09 12:54:05 +00:00
|
|
|
set(BINDIR ${CMAKE_INSTALL_BINDIR})
|
2023-08-28 09:29:58 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
message(STATUS "BINDIR: ${BINDIR}")
|
2016-05-15 15:47:21 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(NOT INCLUDEDIR)
|
2016-05-15 15:47:21 +02:00
|
|
|
set(INCLUDEDIR include)
|
2023-08-28 09:29:58 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(NOT IS_ABSOLUTE ${INCLUDEDIR})
|
2021-02-09 12:54:05 +00:00
|
|
|
set(INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
|
2023-08-28 09:29:58 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
message(STATUS "INCLUDEDIR: ${INCLUDEDIR}")
|
2016-05-15 15:47:21 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(NOT LIBDIR)
|
2016-05-15 15:47:21 +02:00
|
|
|
set(LIBDIR lib)
|
2023-08-28 09:29:58 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(NOT IS_ABSOLUTE ${LIBDIR})
|
2021-02-09 12:54:05 +00:00
|
|
|
set(LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
2023-08-28 09:29:58 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
message(STATUS "LIBDIR: ${LIBDIR}")
|
2016-05-15 15:47:21 +02:00
|
|
|
|
2021-02-09 12:54:05 +00:00
|
|
|
set(IFCOPENSHELL_LIBRARY_DIR "") # for *nix rpaths
|
2016-05-30 15:29:45 +03:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(BUILD_SHARED_LIBS)
|
2016-07-20 22:59:19 +03:00
|
|
|
add_definitions(-DIFC_SHARED_BUILD)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if(MSVC)
|
2016-05-30 00:59:06 +03:00
|
|
|
message(WARNING "Building DLLs against the static VC run-time. This is not recommended if the DLLs are to be redistributed.")
|
2023-08-28 09:29:58 +02:00
|
|
|
|
2016-05-31 14:45:22 +03:00
|
|
|
# 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
|
2016-05-30 13:54:24 +03:00
|
|
|
add_definitions(-wd4251)
|
2016-05-30 00:59:06 +03:00
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
|
2021-02-09 12:54:05 +00:00
|
|
|
set(IFCOPENSHELL_LIBRARY_DIR "${LIBDIR}")
|
2016-05-30 00:59:06 +03:00
|
|
|
endif()
|
2016-05-15 15:47:21 +02:00
|
|
|
|
2016-01-09 06:38:33 +01:00
|
|
|
# Create cache entries if absent for environment variables
|
2023-08-28 09:29:58 +02:00
|
|
|
macro(UNIFY_ENVVARS_AND_CACHE VAR)
|
|
|
|
|
if((NOT DEFINED ${VAR}) AND(NOT "$ENV{${VAR}}" STREQUAL ""))
|
|
|
|
|
set(${VAR} "$ENV{${VAR}}" CACHE STRING "${VAR}" FORCE)
|
|
|
|
|
endif()
|
|
|
|
|
endmacro()
|
2016-01-09 06:38:33 +01:00
|
|
|
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(OCC_INCLUDE_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(OCC_LIBRARY_DIR)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if(NOT MINIMAL_BUILD)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(OPENCOLLADA_INCLUDE_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(OPENCOLLADA_LIBRARY_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(LIBXML2_INCLUDE_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(LIBXML2_LIBRARIES)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(PCRE_LIBRARY_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(PYTHON_EXECUTABLE)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(HDF5_INCLUDE_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(HDF5_LIBRARY_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(HDF5_LIBRARIES)
|
2022-02-10 11:11:49 +03:00
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
|
2023-05-07 11:45:47 +02:00
|
|
|
UNIFY_ENVVARS_AND_CACHE(BOOST_ROOT)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(BOOST_LIBRARYDIR)
|
2021-08-07 23:09:19 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(NOT MINIMAL_BUILD)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(CGAL_INCLUDE_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(CGAL_LIBRARY_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(GMP_INCLUDE_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(GMP_LIBRARY_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(MPFR_INCLUDE_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(MPFR_LIBRARY_DIR)
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-11-25 13:16:36 +01:00
|
|
|
if(WASM_BUILD)
|
|
|
|
|
# when using the nix/build-all.py build script we should not
|
|
|
|
|
# look into the sysroot for most of the dependencies but rather
|
|
|
|
|
# in the designated build/ folder created by the script.
|
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_BACKUP "${CMAKE_FIND_ROOT_PATH}")
|
|
|
|
|
set(CMAKE_FIND_ROOT_PATH "")
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(NOT MINIMAL_BUILD AND GLTF_SUPPORT AND BUILD_CONVERT)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(JSON_INCLUDE_DIR)
|
|
|
|
|
FIND_FILE(json_hpp "json.hpp" ${JSON_INCLUDE_DIR}/nlohmann)
|
|
|
|
|
|
|
|
|
|
if(json_hpp)
|
|
|
|
|
message(STATUS "JSON for Modern C++ header file found")
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Unable to find JSON for Modern C++ header file, aborting")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
add_definitions(-DWITH_GLTF)
|
|
|
|
|
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_GLTF)
|
2019-05-07 17:06:45 +02:00
|
|
|
endif()
|
|
|
|
|
|
2023-05-07 11:45:47 +02:00
|
|
|
# Add USD support to serializers
|
|
|
|
|
if(NOT MINIMAL_BUILD AND USD_SUPPORT)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(USD_INCLUDE_DIR)
|
|
|
|
|
UNIFY_ENVVARS_AND_CACHE(USD_LIBRARY_DIR)
|
|
|
|
|
|
|
|
|
|
if("${USD_INCLUDE_DIR}" STREQUAL "")
|
|
|
|
|
find_path(USD_INCLUDE_DIR pxr.h
|
|
|
|
|
[PATHS
|
|
|
|
|
/usr/include/pxr
|
|
|
|
|
/usr/local/include/pxr
|
|
|
|
|
]
|
|
|
|
|
REQUIRED
|
|
|
|
|
)
|
|
|
|
|
if(USD_INCLUDE_DIR)
|
|
|
|
|
message(STATUS "Found USD include files in: ${USD_INCLUDE_DIR}")
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Unable to find USD include directory, specify USD_INCLUDE_DIR manually.")
|
|
|
|
|
endif()
|
|
|
|
|
else()
|
|
|
|
|
set(USD_INCLUDE_DIR ${USD_INCLUDE_DIR} CACHE FILEPATH "USD header files")
|
|
|
|
|
message(STATUS "Looking for USD include files in: ${USD_INCLUDE_DIR}")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
set(USD_LIBRARIES
|
|
|
|
|
usd_usd
|
|
|
|
|
usd_usdGeom
|
|
|
|
|
usd_usdShade
|
|
|
|
|
usd_usdLux
|
|
|
|
|
usd_vt
|
|
|
|
|
usd_sdf
|
|
|
|
|
usd_tf
|
|
|
|
|
usd_gf
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
find_library(USD_LIBRARY
|
|
|
|
|
NAMES ${USD_LIBRARIES}
|
|
|
|
|
PATHS ${USD_LIBRARY_DIR})
|
|
|
|
|
if(USD_LIBRARY)
|
|
|
|
|
message(STATUS "USD libraries ${USD_LIBRARIES} found in: ${USD_LIBRARY_DIR}")
|
|
|
|
|
link_directories(${USD_LIBRARY_DIR})
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Unable to find USD libraries in: ${USD_LIBRARY_DIR}")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
add_definitions(-DWITH_USD)
|
|
|
|
|
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_USD)
|
|
|
|
|
endif()
|
|
|
|
|
|
2016-05-15 15:47:21 +02:00
|
|
|
# Set INSTALL_RPATH for target
|
2023-08-28 09:29:58 +02:00
|
|
|
macro(SET_INSTALL_RPATHS _target _paths)
|
|
|
|
|
set(${_target}_rpaths "")
|
|
|
|
|
|
|
|
|
|
foreach(_path ${_paths})
|
|
|
|
|
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${_path}" isSystemDir)
|
|
|
|
|
|
|
|
|
|
if("${isSystemDir}" STREQUAL "-1")
|
|
|
|
|
list(APPEND ${_target}_rpaths ${_path})
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
message(STATUS "Set INSTALL_RPATH for ${_target}: ${${_target}_rpaths}")
|
|
|
|
|
set_target_properties(${_target} PROPERTIES INSTALL_RPATH "${${_target}_rpaths}")
|
|
|
|
|
endmacro()
|
2016-05-15 15:47:21 +02:00
|
|
|
|
2018-01-08 12:02:34 +01:00
|
|
|
# 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.
|
2023-08-28 09:29:58 +02:00
|
|
|
if(WIN32 AND("$ENV{CONDA_BUILD}" STREQUAL ""))
|
|
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
|
|
|
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
|
|
|
|
set(Boost_USE_MULTITHREADED ON)
|
|
|
|
|
|
2020-12-30 12:25:21 +01:00
|
|
|
# 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
|
|
|
|
|
# compiled with a toolset different from default.
|
|
|
|
|
if(MSVC)
|
2023-08-28 09:29:58 +02:00
|
|
|
add_definitions(-DBOOST_ALL_NO_LIB)
|
|
|
|
|
|
2020-12-30 12:25:21 +01:00
|
|
|
# Necessary for boost version >= 1.67
|
2023-08-28 09:29:58 +02:00
|
|
|
set(BCRYPT_LIBRARIES "bcrypt.lib")
|
|
|
|
|
endif()
|
|
|
|
|
else()
|
2018-03-16 12:17:49 +01:00
|
|
|
# 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
|
|
|
|
|
# the case in conda-forge's libboost feedstock.
|
2023-08-28 09:29:58 +02:00
|
|
|
add_definitions(-DBOOST_ALL_NO_LIB)
|
|
|
|
|
|
|
|
|
|
if(WIN32)
|
2018-08-15 09:07:40 +02:00
|
|
|
# Necessary for boost version >= 1.67
|
2023-08-28 09:29:58 +02:00
|
|
|
set(BCRYPT_LIBRARIES "bcrypt.lib")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
2017-07-23 14:52:04 +02:00
|
|
|
|
2022-11-25 13:16:36 +01:00
|
|
|
if (WASM_BUILD)
|
|
|
|
|
set(BOOST_COMPONENTS)
|
|
|
|
|
else()
|
|
|
|
|
# @todo review this, shouldn't this be all possible header-only now?
|
|
|
|
|
# ... or rewritten using C++17 features?
|
|
|
|
|
set(BOOST_COMPONENTS system program_options regex thread date_time)
|
|
|
|
|
endif()
|
|
|
|
|
|
2017-07-23 14:52:04 +02:00
|
|
|
if(USE_MMAP)
|
|
|
|
|
if(MSVC)
|
|
|
|
|
# filesystem is necessary for the utf-16 wpath
|
|
|
|
|
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} iostreams filesystem)
|
|
|
|
|
else()
|
|
|
|
|
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} iostreams)
|
|
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
|
2017-07-23 14:52:04 +02:00
|
|
|
add_definitions(-DUSE_MMAP)
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-11-25 13:16:36 +01:00
|
|
|
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}")
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(NOT MINIMAL_BUILD)
|
|
|
|
|
# libxml2 is required for IFCXML (optional) and SVGFILL (mandatory)
|
|
|
|
|
find_package(LibXml2 REQUIRED)
|
2022-02-10 11:11:49 +03:00
|
|
|
endif()
|
2021-08-31 10:54:46 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(NOT MINIMAL_BUILD AND IFCXML_SUPPORT)
|
2018-08-29 12:54:25 +02:00
|
|
|
add_definitions(-DWITH_IFCXML)
|
2023-08-28 09:29:58 +02:00
|
|
|
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_IFCXML)
|
2018-08-29 12:54:25 +02:00
|
|
|
endif()
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
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}")
|
|
|
|
|
|
2015-11-14 19:19:55 +02:00
|
|
|
# Usage:
|
2016-09-01 12:28:17 +03:00
|
|
|
# set(SOME_LIRARIES foo bar)
|
2016-12-30 15:57:13 +02:00
|
|
|
# add_debug_variants(SOME_LIRARIES "${SOME_LIRARIES}" d)
|
2015-11-14 19:19:55 +02:00
|
|
|
# "foo bar" -> "optimized foo debug food optimized bar debug bard"
|
2016-09-01 12:28:17 +03:00
|
|
|
# or
|
|
|
|
|
# set(SOME_LIRARIES path/foo.lib)
|
|
|
|
|
# add_debug_variants(SOME_LIRARIES "${SOME_LIRARIES}" "d")
|
|
|
|
|
# "path/foo.lib" -> "optimized path/foo.lib debug path/food.lib"
|
|
|
|
|
# TODO Could be refined: take the library file extension as a parameter and
|
|
|
|
|
# make sure the lib variable ends with not just contains it.
|
|
|
|
|
function(add_debug_variants NAME LIBRARIES POSTFIX)
|
|
|
|
|
set(LIBRARIES_STR "${LIBRARIES}")
|
2017-05-11 17:22:21 +03:00
|
|
|
set(LIBRARIES "")
|
2023-08-28 09:29:58 +02:00
|
|
|
|
2016-12-30 15:57:13 +02:00
|
|
|
# the result, "optimized <lib> debug <lib>", needs to be a list instead of a string
|
2016-09-01 12:28:17 +03:00
|
|
|
foreach(lib ${LIBRARIES_STR})
|
2016-12-30 15:57:13 +02:00
|
|
|
list(APPEND LIBRARIES optimized)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if("${lib}" MATCHES ".lib")
|
2016-12-30 15:57:13 +02:00
|
|
|
string(REPLACE ".lib" "" lib ${lib})
|
|
|
|
|
list(APPEND LIBRARIES ${lib}.lib)
|
|
|
|
|
else()
|
|
|
|
|
list(APPEND LIBRARIES ${lib})
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
list(APPEND LIBRARIES debug)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if("${lib}" MATCHES ".lib")
|
2016-09-01 12:28:17 +03:00
|
|
|
string(REPLACE ".lib" "" lib ${lib})
|
2016-12-30 15:57:13 +02:00
|
|
|
list(APPEND LIBRARIES ${lib}${POSTFIX}.lib)
|
2016-09-01 12:28:17 +03:00
|
|
|
else()
|
2016-12-30 15:57:13 +02:00
|
|
|
list(APPEND LIBRARIES ${lib}${POSTFIX})
|
2016-09-01 12:28:17 +03:00
|
|
|
endif()
|
|
|
|
|
endforeach()
|
2023-08-28 09:29:58 +02:00
|
|
|
|
2016-09-01 12:28:17 +03:00
|
|
|
set(${NAME} ${LIBRARIES} PARENT_SCOPE)
|
|
|
|
|
endfunction()
|
2015-11-14 19:19:55 +02:00
|
|
|
|
2018-09-08 13:23:36 +02:00
|
|
|
if(BUILD_IFCGEOM)
|
2023-08-28 09:29:58 +02:00
|
|
|
if(MSVC)
|
|
|
|
|
add_debug_variants(LIBXML2_LIBRARIES "${LIBXML2_LIBRARIES}" d)
|
|
|
|
|
endif()
|
2018-09-08 13:23:36 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
# Open CASCADE
|
|
|
|
|
if("${OCC_INCLUDE_DIR}" STREQUAL "")
|
|
|
|
|
find_path(OCC_INCLUDE_DIR Standard_Version.hxx
|
|
|
|
|
[PATHS
|
2021-03-06 17:13:47 +02:00
|
|
|
/usr/include/occt
|
|
|
|
|
/usr/include/oce
|
|
|
|
|
/usr/include/opencascade
|
2023-08-28 09:29:58 +02:00
|
|
|
]
|
|
|
|
|
REQUIRED
|
|
|
|
|
)
|
2011-05-08 11:04:32 +00:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
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()
|
2015-11-14 19:19:55 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
set(OPENCASCADE_LIBRARY_NAMES
|
|
|
|
|
TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO
|
|
|
|
|
TKFillet TKSTEP TKSTEPBase TKSTEPAttr TKXSBase TKSTEP209 TKIGES TKOffset TKHLR
|
|
|
|
|
|
|
|
|
|
# @todo investigate the exact conditions when this is necessary
|
|
|
|
|
TKBin
|
2021-03-06 17:13:47 +02:00
|
|
|
)
|
2011-05-08 11:04:32 +00:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if("${OCC_LIBRARY_DIR}" STREQUAL "")
|
|
|
|
|
find_library(OCC_LIBRARY TKernel
|
|
|
|
|
[PATHS
|
|
|
|
|
/usr/lib
|
|
|
|
|
]
|
|
|
|
|
REQUIRED
|
|
|
|
|
)
|
2011-05-08 11:04:32 +00:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
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()
|
2016-08-07 10:37:29 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
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
|
|
|
|
|
# TODO Extract this into macro/function
|
|
|
|
|
foreach(lib ${OPENCASCADE_LIBRARY_NAMES})
|
|
|
|
|
# Make sure we'll handle the Windows/MSVC debug postfix convention too.
|
|
|
|
|
string(REPLACE TKerneld "${lib}" lib_path "${libTKernel}")
|
|
|
|
|
string(REPLACE TKernel "${lib}" lib_path "${lib_path}")
|
|
|
|
|
list(APPEND OPENCASCADE_LIBRARIES "${lib_path}")
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
|
add_definitions(-DHAVE_NO_DLL)
|
|
|
|
|
add_debug_variants(OPENCASCADE_LIBRARIES "${OPENCASCADE_LIBRARIES}" d)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
|
# OCC might require linking to Winsock depending on the version and build configuration
|
|
|
|
|
list(APPEND OPENCASCADE_LIBRARIES ws2_32.lib)
|
|
|
|
|
endif()
|
2016-08-07 10:37:29 +02:00
|
|
|
|
2018-09-08 13:23:36 +02:00
|
|
|
# Make sure cross-referenced symbols between static OCC libraries get
|
|
|
|
|
# resolved. Also add thread and rt libraries.
|
|
|
|
|
get_filename_component(libTKernelExt ${libTKernel} EXT)
|
|
|
|
|
if("${libTKernelExt}" STREQUAL ".a")
|
2019-08-02 14:55:55 +02:00
|
|
|
set(OCCT_STATIC ON)
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-11-25 13:16:36 +01:00
|
|
|
if(WASM_BUILD)
|
|
|
|
|
set(CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH_BACKUP}")
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-08-02 14:55:55 +02:00
|
|
|
if(OCCT_STATIC)
|
2018-09-08 13:23:36 +02:00
|
|
|
find_package(Threads)
|
2022-11-25 13:16:36 +01:00
|
|
|
|
|
|
|
|
if(WASM_BUILD)
|
|
|
|
|
set(OPENCASCADE_LIBRARIES ${OPENCASCADE_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
else()
|
|
|
|
|
# OPENCASCADE_LIBRARIES repeated N times below in order to fix cyclic dependencies - use --start-group ... --end-group instead?
|
|
|
|
|
# tfk: --start-group ... --end-group didn't work on the apple linker when last tested
|
|
|
|
|
set(OPENCASCADE_LIBRARIES ${OPENCASCADE_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
endif()
|
|
|
|
|
|
2018-09-08 13:23:36 +02:00
|
|
|
if (NOT APPLE AND NOT WIN32)
|
|
|
|
|
set(OPENCASCADE_LIBRARIES ${OPENCASCADE_LIBRARIES} "rt")
|
|
|
|
|
endif()
|
|
|
|
|
if (NOT WIN32)
|
|
|
|
|
set(OPENCASCADE_LIBRARIES ${OPENCASCADE_LIBRARIES} "dl")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
endif(BUILD_IFCGEOM)
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(NOT MINIMAL_BUILD AND COLLADA_SUPPORT)
|
|
|
|
|
# Find OpenCOLLADA
|
|
|
|
|
if("${OPENCOLLADA_INCLUDE_DIR}" STREQUAL "")
|
|
|
|
|
message(STATUS "No OpenCOLLADA include directory specified")
|
|
|
|
|
set(OPENCOLLADA_INCLUDE_DIR "/usr/include/opencollada" CACHE FILEPATH "OpenCOLLADA header files")
|
|
|
|
|
else()
|
|
|
|
|
set(OPENCOLLADA_INCLUDE_DIR "${OPENCOLLADA_INCLUDE_DIR}" CACHE FILEPATH "OpenCOLLADA header files")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if("${OPENCOLLADA_LIBRARY_DIR}" STREQUAL "")
|
|
|
|
|
message(STATUS "No OpenCOLLADA library directory specified")
|
|
|
|
|
find_library(OPENCOLLADA_FRAMEWORK_LIB NAMES OpenCOLLADAFramework
|
|
|
|
|
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)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
find_library(OpenCOLLADAFramework NAMES OpenCOLLADAFramework OpenCOLLADAFrameworkd PATHS ${OPENCOLLADA_LIBRARY_DIR} NO_DEFAULT_PATH)
|
|
|
|
|
|
|
|
|
|
if(OpenCOLLADAFramework)
|
2017-05-11 23:30:17 +03:00
|
|
|
message(STATUS "OpenCOLLADA library files found")
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA libraries. "
|
|
|
|
|
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
|
|
|
|
|
endif()
|
2016-08-07 10:37:29 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
set(OPENCOLLADA_LIBRARY_DIR "${OPENCOLLADA_LIBRARY_DIR}" CACHE FILEPATH "OpenCOLLADA library files")
|
2015-10-28 19:45:07 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
set(OPENCOLLADA_INCLUDE_DIRS "${OPENCOLLADA_INCLUDE_DIR}/COLLADABaseUtils" "${OPENCOLLADA_INCLUDE_DIR}/COLLADAStreamWriter")
|
2015-10-28 19:45:07 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
find_file(COLLADASWStreamWriter_h "COLLADASWStreamWriter.h" ${OPENCOLLADA_INCLUDE_DIRS})
|
2021-10-29 10:39:02 +02:00
|
|
|
|
2022-09-08 18:28:34 +02:00
|
|
|
if(COLLADASWStreamWriter_h)
|
2023-08-28 09:29:58 +02:00
|
|
|
message(STATUS "OpenCOLLADA header files found")
|
|
|
|
|
add_definitions(-DWITH_OPENCOLLADA)
|
|
|
|
|
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_OPENCOLLADA)
|
2016-08-07 10:37:29 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
set(OPENCOLLADA_LIBRARY_NAMES
|
|
|
|
|
GeneratedSaxParser MathMLSolver OpenCOLLADABaseUtils OpenCOLLADAFramework OpenCOLLADASaxFrameworkLoader
|
|
|
|
|
OpenCOLLADAStreamWriter UTF buffer ftoa
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Use the found OpenCOLLADAFramework as a template for all other OpenCOLLADA libraries
|
|
|
|
|
foreach(lib ${OPENCOLLADA_LIBRARY_NAMES})
|
2021-05-26 22:11:57 -04:00
|
|
|
# Make sure we'll handle the Windows/MSVC debug postfix convention too.
|
2017-05-11 23:30:17 +03:00
|
|
|
string(REPLACE OpenCOLLADAFrameworkd "${lib}" lib_path "${OpenCOLLADAFramework}")
|
|
|
|
|
string(REPLACE OpenCOLLADAFramework "${lib}" lib_path "${lib_path}")
|
2023-08-28 09:29:58 +02:00
|
|
|
list(APPEND OPENCOLLADA_LIBRARIES "${lib_path}")
|
|
|
|
|
endforeach()
|
2016-08-07 10:37:29 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if("${PCRE_LIBRARY_DIR}" STREQUAL "")
|
2016-09-01 11:40:49 +02:00
|
|
|
if(WIN32)
|
2017-05-11 23:30:17 +03:00
|
|
|
find_library(pcre_library NAMES pcre pcred PATHS ${OPENCOLLADA_LIBRARY_DIR} NO_DEFAULT_PATH)
|
2016-09-01 11:40:49 +02:00
|
|
|
else()
|
|
|
|
|
find_library(pcre_library NAMES pcre PATHS ${OPENCOLLADA_LIBRARY_DIR})
|
|
|
|
|
endif()
|
2016-08-22 12:45:37 +03:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
get_filename_component(PCRE_LIBRARY_DIR ${pcre_library} PATH)
|
|
|
|
|
else()
|
|
|
|
|
find_library(pcre_library NAMES pcre pcred PATHS ${PCRE_LIBRARY_DIR} NO_DEFAULT_PATH)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(pcre_library)
|
|
|
|
|
set(OPENCOLLADA_LIBRARY_DIR ${OPENCOLLADA_LIBRARY_DIR} ${PCRE_LIBRARY_DIR})
|
|
|
|
|
|
|
|
|
|
if(MSVC)
|
2017-05-11 23:30:17 +03:00
|
|
|
# Add release lib regardless whether release or debug found. Debug version will be appended below.
|
|
|
|
|
list(APPEND OPENCOLLADA_LIBRARIES "${PCRE_LIBRARY_DIR}/pcre.lib")
|
|
|
|
|
else()
|
|
|
|
|
list(APPEND OPENCOLLADA_LIBRARIES "${pcre_library}")
|
|
|
|
|
endif()
|
2016-08-22 12:45:37 +03:00
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find PCRE. "
|
|
|
|
|
"Disable COLLADA_SUPPORT or fix PCRE_LIBRARY_DIR path to proceed.")
|
2023-08-28 09:29:58 +02:00
|
|
|
endif()
|
2016-08-22 12:45:37 +03:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(MSVC)
|
|
|
|
|
add_debug_variants(OPENCOLLADA_LIBRARIES "${OPENCOLLADA_LIBRARIES}" d)
|
|
|
|
|
endif()
|
|
|
|
|
else()
|
2017-05-11 23:30:17 +03:00
|
|
|
message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA headers. "
|
|
|
|
|
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
|
2023-08-28 09:29:58 +02:00
|
|
|
endif()
|
|
|
|
|
endif()
|
2014-01-02 15:52:20 +00:00
|
|
|
|
2022-02-10 11:11:49 +03:00
|
|
|
if(NOT MINIMAL_BUILD AND HDF5_SUPPORT)
|
2023-08-28 09:29:58 +02:00
|
|
|
if("${HDF5_INCLUDE_DIR}" STREQUAL "")
|
|
|
|
|
message(STATUS "No HDF5 include directory specified")
|
|
|
|
|
else()
|
|
|
|
|
set(HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIR}" CACHE FILEPATH "HDF5 header files")
|
|
|
|
|
endif()
|
2022-08-15 16:40:42 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if("${HDF5_LIBRARY_DIR}" STREQUAL "")
|
|
|
|
|
message(STATUS "No HDF5 library directory specified")
|
|
|
|
|
else()
|
|
|
|
|
set(HDF5_LIBRARY_DIR "${HDF5_LIBRARY_DIR}" CACHE FILEPATH "HDF5 library files")
|
|
|
|
|
endif()
|
2022-08-15 16:40:42 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(HDF5_LIBRARY_DIR)
|
|
|
|
|
# result of the HDF5 ctest package
|
|
|
|
|
# Find zlib using cmake find_library. How should this be implemented?
|
|
|
|
|
# FIND_LIBRARY(NAMES z libz libz_debug PATHS ... NO_DEFAULT_PATH)
|
|
|
|
|
if("$ENV{CONDA_BUILD}" STREQUAL "")
|
2022-08-15 16:40:42 +02:00
|
|
|
# result of the HDF5 ctest package
|
2023-08-28 09:29:58 +02:00
|
|
|
if(WIN32)
|
2022-08-15 16:40:42 +02:00
|
|
|
set(zlib_post lib)
|
|
|
|
|
set(lib_ext lib)
|
|
|
|
|
else()
|
|
|
|
|
set(lib_ext a)
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
2022-08-15 16:40:42 +02:00
|
|
|
set(debug_postfix "_debug")
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
set(HDF5_LIBRARIES
|
|
|
|
|
"${HDF5_LIBRARY_DIR}/libhdf5_cpp${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}/libsz${debug_postfix}.${lib_ext}"
|
|
|
|
|
"${HDF5_LIBRARY_DIR}/libaec${debug_postfix}.${lib_ext}"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Packaging hdf5 and zlib for conda distribution")
|
|
|
|
|
|
|
|
|
|
if(WIN32)
|
2022-08-15 16:40:42 +02:00
|
|
|
# Windows
|
|
|
|
|
set(zlib_post zlib)
|
|
|
|
|
set(lib_ext lib)
|
|
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
|
# macOS
|
|
|
|
|
set(zlib_post libz)
|
|
|
|
|
set(lib_ext dylib)
|
|
|
|
|
else()
|
|
|
|
|
# linux
|
|
|
|
|
set(zlib_post libz)
|
|
|
|
|
set(lib_ext so)
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
set(HDF5_LIBRARIES
|
|
|
|
|
"${HDF5_LIBRARY_DIR}/libhdf5_cpp.${lib_ext}"
|
|
|
|
|
"${HDF5_LIBRARY_DIR}/libhdf5.${lib_ext}"
|
|
|
|
|
"${HDF5_LIBRARY_DIR}/${zlib_post}.${lib_ext}"
|
|
|
|
|
)
|
2021-07-11 19:15:20 +00:00
|
|
|
endif()
|
|
|
|
|
endif()
|
2022-08-15 16:40:42 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(NOT HDF5_LIBRARIES)
|
|
|
|
|
# debian default
|
|
|
|
|
set(HDF5_LIBRARIES
|
2021-10-08 22:01:34 +02:00
|
|
|
/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/libsz.so
|
|
|
|
|
/usr/lib/x86_64-linux-gnu/libaec.so
|
2021-08-31 11:03:28 +02:00
|
|
|
z dl
|
|
|
|
|
)
|
2021-07-11 19:15:20 +00:00
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
|
2021-08-31 11:03:28 +02:00
|
|
|
add_definitions(-DWITH_HDF5)
|
2023-08-28 09:29:58 +02:00
|
|
|
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_HDF5)
|
2021-02-05 13:47:54 +01:00
|
|
|
endif()
|
|
|
|
|
|
2015-10-28 19:45:07 +02:00
|
|
|
if(ENABLE_BUILD_OPTIMIZATIONS)
|
2023-08-28 09:29:58 +02:00
|
|
|
if(MSVC)
|
2016-07-15 06:49:32 +03:00
|
|
|
# NOTE: RelWithDebInfo and Release use O2 (= /Ox /Gl /Gy/ = Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) by default,
|
|
|
|
|
# with the exception with RelWithDebInfo has /Ob1 instead. /Ob2 has been observed to improve the performance
|
|
|
|
|
# of IfcConvert significantly.
|
|
|
|
|
# TODO Setting of /GL and /LTCG don't seem to apply for static libraries (IfcGeom, IfcParse)
|
2023-08-28 09:29:58 +02:00
|
|
|
# C++
|
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ob2 /GL")
|
|
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
|
|
|
|
|
|
|
|
|
# Linker
|
|
|
|
|
# /OPT:REF enables also /OPT:ICF and disables INCREMENTAL
|
|
|
|
|
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)
|
|
|
|
|
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_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:NOICF")
|
|
|
|
|
else()
|
2016-07-15 06:49:32 +03:00
|
|
|
# GCC-like: Release should use O3 but RelWithDebInfo 02 so enforce 03. Anything other useful that could be added here?
|
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
|
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
2023-08-28 09:29:58 +02:00
|
|
|
endif()
|
2015-10-28 19:45:07 +02:00
|
|
|
endif()
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(MSVC)
|
|
|
|
|
# warning due to virtual inheritance
|
|
|
|
|
add_definitions(-wd4250)
|
|
|
|
|
|
|
|
|
|
# warning due to select definitions in the schema being redundant
|
|
|
|
|
add_definitions(-wd4584)
|
|
|
|
|
|
|
|
|
|
# didn't work well on ifcopenbot, @todo make configurable
|
|
|
|
|
# add_definitions(/MP)
|
2021-07-11 14:55:27 +02:00
|
|
|
|
2016-02-21 16:52:00 +02:00
|
|
|
# Enable solution folders (free VS versions prior to 2012 don't support solution folders)
|
2023-08-28 09:29:58 +02:00
|
|
|
if(MSVC_VERSION GREATER 1600)
|
2016-02-20 00:13:04 +02:00
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(USE_VLD)
|
|
|
|
|
add_definitions(-DUSE_VLD)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# Enforce Unicode for CRT and Win32 API calls
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
# Bump up the warning level from the default 3 to 4.
|
|
|
|
|
add_definitions(-W4)
|
|
|
|
|
|
|
|
|
|
if(MSVC_VERSION GREATER 1800) # > 2013
|
|
|
|
|
# Disable overeager and false positives causing C4458 ("declaration of 'indentifier' hides class member"), at least for now.
|
|
|
|
|
add_definitions(-wd4458)
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-07-01 17:55:47 +01:00
|
|
|
# Enforce standards-conformance on VS > 2015, older Boost versions fail to compile with this
|
2023-08-28 09:29:58 +02:00
|
|
|
if(MSVC_VERSION GREATER 1900 AND(Boost_MAJOR_VERSION GREATER 1 OR Boost_MINOR_VERSION GREATER 66))
|
2018-09-25 10:29:48 +03:00
|
|
|
add_definitions(-permissive-)
|
|
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
# Link against the static VC runtime
|
|
|
|
|
# TODO Make this configurable
|
|
|
|
|
# IF("$ENV{CONDA_BUILD}" STREQUAL "")
|
|
|
|
|
# FOREACH(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
|
|
|
|
|
# CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
|
|
|
|
# CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
|
|
|
|
# IF(${flag} MATCHES "/MD")
|
|
|
|
|
# STRING(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
|
|
|
|
# ENDIF()
|
|
|
|
|
# IF(${flag} MATCHES "/MDd")
|
|
|
|
|
# STRING(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
|
|
|
|
# ENDIF()
|
|
|
|
|
# ENDFOREACH()
|
|
|
|
|
# ENDIF()
|
|
|
|
|
else()
|
2018-12-22 14:05:49 +01:00
|
|
|
add_definitions(-Wall -Wextra)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
2016-10-09 13:39:47 +03:00
|
|
|
add_definitions(-Wno-tautological-constant-out-of-range-compare)
|
2018-12-22 14:05:49 +01:00
|
|
|
else()
|
|
|
|
|
add_definitions(-Wno-maybe-uninitialized)
|
2016-10-09 13:39:47 +03:00
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
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))
|
2021-03-20 21:23:05 +02:00
|
|
|
# OpenCascade spews a lot of deprecated-copy warnings
|
|
|
|
|
add_definitions(-Wno-deprecated-copy)
|
|
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
|
2016-07-15 06:49:32 +03:00
|
|
|
# -fPIC is not relevant on Windows and creates pointless warnings
|
2023-08-28 09:29:58 +02:00
|
|
|
if(UNIX)
|
2016-07-15 06:49:32 +03:00
|
|
|
add_definitions(-fPIC)
|
|
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
endif()
|
2011-05-08 11:04:32 +00:00
|
|
|
|
2015-10-28 19:45:07 +02:00
|
|
|
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS}
|
2021-02-05 13:47:54 +01:00
|
|
|
${Boost_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${JSON_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}
|
2023-05-07 11:45:47 +02:00
|
|
|
${USD_INCLUDE_DIR}
|
2011-08-24 12:21:07 +00:00
|
|
|
)
|
2015-10-28 19:45:07 +02:00
|
|
|
|
2016-02-15 16:59:47 +01:00
|
|
|
function(files_for_ifc_version IFC_VERSION RESULT_NAME)
|
|
|
|
|
set(IFC_PARSE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src/ifcparse)
|
2021-07-01 17:55:47 +01:00
|
|
|
set(${RESULT_NAME}
|
|
|
|
|
${IFC_PARSE_DIR}/Ifc${IFC_VERSION}.h
|
2016-02-15 16:59:47 +01:00
|
|
|
${IFC_PARSE_DIR}/Ifc${IFC_VERSION}enum.h
|
|
|
|
|
${IFC_PARSE_DIR}/Ifc${IFC_VERSION}.cpp
|
2023-08-28 09:29:58 +02:00
|
|
|
PARENT_SCOPE
|
2016-02-15 16:59:47 +01:00
|
|
|
)
|
|
|
|
|
endfunction()
|
|
|
|
|
|
2021-07-10 21:10:03 +02:00
|
|
|
if(NOT SCHEMA_VERSIONS)
|
2022-11-25 13:16:36 +01:00
|
|
|
if(WASM_BUILD)
|
|
|
|
|
# super arbitrarily try to keep size down at least a little bit
|
|
|
|
|
set(SCHEMA_VERSIONS "2x3" "4")
|
|
|
|
|
else()
|
|
|
|
|
set(SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3_rc1" "4x3_rc2" "4x3_rc3" "4x3_rc4" "4x3" "4x3_tc1" "4x3_add1")
|
|
|
|
|
endif()
|
2021-07-10 21:10:03 +02:00
|
|
|
endif()
|
2019-06-26 13:50:46 +02:00
|
|
|
|
2021-05-11 22:29:16 +02:00
|
|
|
foreach(s ${SCHEMA_VERSIONS})
|
2023-08-28 09:29:58 +02:00
|
|
|
add_definitions(-DHAS_SCHEMA_${s})
|
2021-05-11 22:29:16 +02:00
|
|
|
endforeach()
|
2019-06-26 13:50:46 +02:00
|
|
|
|
2022-07-17 21:13:46 +02:00
|
|
|
string(REPLACE ";" ")(" schema_version_seq "(${SCHEMA_VERSIONS})")
|
2023-08-28 09:29:58 +02:00
|
|
|
add_definitions(-DSCHEMA_SEQ=${schema_version_seq})
|
2022-07-17 21:13:46 +02:00
|
|
|
|
2016-02-15 16:59:47 +01:00
|
|
|
if(COMPILE_SCHEMA)
|
2023-08-28 09:29:58 +02:00
|
|
|
# @todo, this appears to be untested at the moment
|
2016-02-17 12:03:38 +01:00
|
|
|
find_package(PythonInterp)
|
2021-07-01 17:55:47 +01:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
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.")
|
|
|
|
|
endif()
|
2021-07-01 17:55:47 +01:00
|
|
|
|
2019-06-26 13:50:46 +02:00
|
|
|
set(IFC_RELEASE_NOT_USED ${SCHEMA_VERSIONS})
|
2021-07-01 17:55:47 +01:00
|
|
|
|
2016-02-15 16:59:47 +01:00
|
|
|
# Install pyparsing if necessary
|
2016-02-18 13:17:15 +01:00
|
|
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip freeze OUTPUT_VARIABLE PYTHON_PACKAGE_LIST)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if("${PYTHON_PACKAGE_LIST}" STREQUAL "")
|
2016-02-18 13:17:15 +01:00
|
|
|
execute_process(COMMAND pip freeze OUTPUT_VARIABLE PYTHON_PACKAGE_LIST)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if("${PYTHON_PACKAGE_LIST}" STREQUAL "")
|
2016-02-18 13:17:15 +01:00
|
|
|
message(WARNING "Failed to find pip. Pip is required to automatically install pyparsing")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
|
2016-02-15 16:59:47 +01:00
|
|
|
string(FIND "${PYTHON_PACKAGE_LIST}" pyparsing PYPARSING_FOUND)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if("${PYPARSING_FOUND}" STREQUAL "-1")
|
2016-02-15 16:59:47 +01:00
|
|
|
message(STATUS "Installing pyparsing")
|
2016-02-18 13:17:15 +01:00
|
|
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip "install" --user pyparsing RESULT_VARIABLE SUCCESS)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if(NOT "${SUCCESS}" STREQUAL "0")
|
2016-02-18 13:17:15 +01:00
|
|
|
execute_process(COMMAND pip "install" --user pyparsing RESULT_VARIABLE SUCCESS)
|
2023-08-28 09:29:58 +02:00
|
|
|
|
|
|
|
|
if(NOT "${SUCCESS}" STREQUAL "0")
|
2016-02-18 13:17:15 +01:00
|
|
|
message(WARNING "Failed to automatically install pyparsing. Please install manually")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
2016-02-15 16:59:47 +01:00
|
|
|
else()
|
|
|
|
|
message(STATUS "Python interpreter with pyparsing found")
|
|
|
|
|
endif()
|
2021-07-01 17:55:47 +01:00
|
|
|
|
2016-02-15 16:59:47 +01:00
|
|
|
# Bootstrap the parser
|
|
|
|
|
message(STATUS "Compiling schema, this will take a while...")
|
2021-07-01 17:55:47 +01:00
|
|
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} bootstrap.py express.bnf
|
|
|
|
|
WORKING_DIRECTORY ../src/ifcexpressparser
|
2016-02-18 13:17:15 +01:00
|
|
|
OUTPUT_FILE express_parser.py
|
|
|
|
|
RESULT_VARIABLE SUCCESS)
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(NOT "${SUCCESS}" STREQUAL "0")
|
|
|
|
|
message(FATAL_ERROR "Failed to bootstrap parser. Make sure pyparsing is installed")
|
2016-02-18 13:17:15 +01:00
|
|
|
endif()
|
2021-07-01 17:55:47 +01:00
|
|
|
|
2016-02-15 16:59:47 +01:00
|
|
|
# Generate code
|
2016-02-17 12:03:38 +01:00
|
|
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} ../ifcexpressparser/express_parser.py ../../${COMPILE_SCHEMA}
|
2016-02-15 16:59:47 +01:00
|
|
|
WORKING_DIRECTORY ../src/ifcparse
|
|
|
|
|
OUTPUT_VARIABLE COMPILED_SCHEMA_NAME)
|
2021-07-01 17:55:47 +01:00
|
|
|
|
2016-02-15 16:59:47 +01:00
|
|
|
# Prevent the schema that had just been compiled from being excluded
|
2023-08-28 09:29:58 +02:00
|
|
|
foreach(s ${SCHEMA_VERSIONS})
|
|
|
|
|
if("${COMPILED_SCHEMA_NAME}" STREQUAL "${s}")
|
|
|
|
|
list(REMOVE_ITEM IFC_RELEASE_NOT_USED "${s}")
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
2016-02-15 16:59:47 +01:00
|
|
|
endif()
|
2011-08-24 12:21:07 +00:00
|
|
|
|
2016-05-30 00:59:06 +03:00
|
|
|
# Boost >= 1.58 requires BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE to build on some Linux distros.
|
2016-05-15 15:47:21 +02:00
|
|
|
if(NOT Boost_VERSION LESS 105800)
|
|
|
|
|
add_definitions(-DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE)
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-05-28 12:04:13 +02:00
|
|
|
set(IFCOPENSHELL_LIBRARIES IfcParse)
|
|
|
|
|
if (BUILD_IFCGEOM)
|
2019-06-26 13:50:46 +02:00
|
|
|
foreach(s ${SCHEMA_VERSIONS})
|
|
|
|
|
set(IFCGEOM_SCHEMA_LIBRARIES ${IFCGEOM_SCHEMA_LIBRARIES} IfcGeom_ifc${s})
|
|
|
|
|
endforeach()
|
2022-11-25 13:16:36 +01:00
|
|
|
if (WASM_BUILD)
|
|
|
|
|
set(IFCOPENSHELL_LIBRARIES ${IFCOPENSHELL_LIBRARIES} IfcGeom ${IFCGEOM_SCHEMA_LIBRARIES})
|
|
|
|
|
else()
|
|
|
|
|
set(IFCOPENSHELL_LIBRARIES ${IFCOPENSHELL_LIBRARIES} IfcGeom ${IFCGEOM_SCHEMA_LIBRARIES} IfcGeom ${IFCGEOM_SCHEMA_LIBRARIES})
|
|
|
|
|
endif()
|
2019-05-28 12:04:13 +02:00
|
|
|
endif()
|
2022-07-06 16:19:57 +02:00
|
|
|
if (BUILD_CONVERT OR BUILD_IFCPYTHON)
|
2019-06-26 13:50:46 +02:00
|
|
|
foreach(s ${SCHEMA_VERSIONS})
|
|
|
|
|
set(SERIALIZER_SCHEMA_LIBRARIES ${SERIALIZER_SCHEMA_LIBRARIES} Serializers_ifc${s})
|
|
|
|
|
endforeach()
|
|
|
|
|
set(IFCOPENSHELL_LIBRARIES ${IFCOPENSHELL_LIBRARIES} Serializers ${SERIALIZER_SCHEMA_LIBRARIES})
|
2019-05-28 12:04:13 +02:00
|
|
|
endif()
|
2016-05-30 15:12:07 +03:00
|
|
|
|
2015-10-28 19:45:07 +02:00
|
|
|
# IfcParse
|
2021-05-11 22:29:16 +02:00
|
|
|
file(GLOB IFCPARSE_H_FILES_ALL ../src/ifcparse/*.h)
|
|
|
|
|
file(GLOB IFCPARSE_CPP_FILES_ALL ../src/ifcparse/*.cpp)
|
|
|
|
|
|
|
|
|
|
foreach(s ${IFCPARSE_H_FILES_ALL})
|
2023-08-28 09:29:58 +02:00
|
|
|
get_filename_component(p "${s}" NAME)
|
|
|
|
|
|
|
|
|
|
if(NOT "${p}" MATCHES "[0-9]")
|
|
|
|
|
list(APPEND IFCPARSE_H_FILES "${s}")
|
|
|
|
|
endif()
|
2021-05-11 22:29:16 +02:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
foreach(s ${IFCPARSE_CPP_FILES_ALL})
|
2023-08-28 09:29:58 +02:00
|
|
|
get_filename_component(p "${s}" NAME)
|
|
|
|
|
|
|
|
|
|
if(NOT "${p}" MATCHES "[0-9]")
|
|
|
|
|
list(APPEND IFCPARSE_CPP_FILES "${s}")
|
|
|
|
|
endif()
|
2021-05-11 22:29:16 +02:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
foreach(s ${SCHEMA_VERSIONS})
|
2023-08-28 09:29:58 +02:00
|
|
|
list(APPEND IFCPARSE_H_FILES
|
|
|
|
|
../src/ifcparse/Ifc${s}.h
|
|
|
|
|
../src/ifcparse/Ifc${s}-definitions.h
|
|
|
|
|
)
|
|
|
|
|
list(APPEND IFCPARSE_CPP_FILES
|
|
|
|
|
../src/ifcparse/Ifc${s}.cpp
|
|
|
|
|
../src/ifcparse/Ifc${s}-schema.cpp
|
|
|
|
|
)
|
2021-05-11 22:29:16 +02:00
|
|
|
endforeach()
|
|
|
|
|
|
2016-02-17 12:03:38 +01:00
|
|
|
set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES})
|
|
|
|
|
|
2016-06-22 14:54:55 +02:00
|
|
|
add_library(IfcParse ${IFCPARSE_FILES})
|
2020-08-23 14:00:53 +02:00
|
|
|
set_target_properties(IfcParse PROPERTIES COMPILE_FLAGS -DIFC_PARSE_EXPORTS VERSION "0.6.0" SOVERSION "0.6")
|
2016-02-15 16:59:47 +01:00
|
|
|
|
2022-11-25 13:16:36 +01:00
|
|
|
if (WASM_BUILD)
|
|
|
|
|
TARGET_LINK_LIBRARIES(IfcParse ${BCRYPT_LIBRARIES} ${LIBXML2_LIBRARIES})
|
|
|
|
|
else()
|
|
|
|
|
TARGET_LINK_LIBRARIES(IfcParse ${Boost_LIBRARIES} ${BCRYPT_LIBRARIES} ${LIBXML2_LIBRARIES})
|
|
|
|
|
endif()
|
2018-08-15 09:07:40 +02:00
|
|
|
|
2018-09-08 13:23:36 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(BUILD_IFCGEOM)
|
|
|
|
|
# IfcGeom
|
|
|
|
|
file(GLOB IFCGEOM_H_FILES ../src/ifcgeom/*.h ../src/ifcgeom/*.i)
|
|
|
|
|
file(GLOB IFCGEOM_CPP_FILES ../src/ifcgeom/*.cpp)
|
|
|
|
|
set(IFCGEOM_FILES ${IFCGEOM_CPP_FILES} ${IFCGEOM_H_FILES})
|
2016-06-22 14:54:55 +02:00
|
|
|
|
2019-06-26 13:50:46 +02:00
|
|
|
foreach(s ${SCHEMA_VERSIONS})
|
|
|
|
|
add_library(IfcGeom_ifc${s} STATIC ${IFCGEOM_FILES})
|
|
|
|
|
set_target_properties(IfcGeom_ifc${s} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${s}")
|
2022-11-25 13:16:36 +01:00
|
|
|
if (NOT WASM_BUILD)
|
|
|
|
|
TARGET_LINK_LIBRARIES(IfcGeom_ifc${s} IfcParse ${OPENCASCADE_LIBRARIES})
|
|
|
|
|
endif()
|
2019-06-26 13:50:46 +02:00
|
|
|
endforeach()
|
2012-06-12 10:36:34 +00:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
# IfcGeom (schema agnostic)
|
|
|
|
|
file(GLOB SCHEMA_AGNOSTIC_H_FILES ../src/ifcgeom_schema_agnostic/*.h)
|
|
|
|
|
file(GLOB SCHEMA_AGNOSTIC_CPP_FILES ../src/ifcgeom_schema_agnostic/*.cpp)
|
|
|
|
|
set(SCHEMA_AGNOSTIC_FILES ${SCHEMA_AGNOSTIC_H_FILES} ${SCHEMA_AGNOSTIC_CPP_FILES})
|
2017-12-19 20:24:00 +01:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
add_library(IfcGeom ${SCHEMA_AGNOSTIC_FILES})
|
|
|
|
|
set_target_properties(IfcGeom PROPERTIES COMPILE_FLAGS -DIFC_GEOM_EXPORTS VERSION "0.6.0" SOVERSION "0.6")
|
2019-08-02 14:55:55 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(UNIX)
|
|
|
|
|
find_package(Threads)
|
|
|
|
|
endif()
|
2019-08-02 14:55:55 +02:00
|
|
|
|
2022-11-25 13:16:36 +01:00
|
|
|
if (WASM_BUILD)
|
|
|
|
|
TARGET_LINK_LIBRARIES(IfcGeom ${IFCGEOM_SCHEMA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
else()
|
|
|
|
|
TARGET_LINK_LIBRARIES(IfcGeom IfcParse ${IFCGEOM_SCHEMA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
endif()
|
2017-12-19 20:24:00 +01:00
|
|
|
|
2018-09-08 13:23:36 +02:00
|
|
|
endif(BUILD_IFCGEOM)
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(BUILD_CONVERT OR BUILD_IFCPYTHON)
|
|
|
|
|
# Serializers
|
|
|
|
|
file(GLOB SERIALIZERS_H_FILES ../src/serializers/*.h)
|
|
|
|
|
file(GLOB SERIALIZERS_CPP_FILES ../src/serializers/*.cpp)
|
|
|
|
|
set(SERIALIZERS_FILES ${SERIALIZERS_H_FILES} ${SERIALIZERS_CPP_FILES})
|
|
|
|
|
file(GLOB SERIALIZERS_S_H_FILES ../src/serializers/schema_dependent/*.h)
|
|
|
|
|
file(GLOB SERIALIZERS_S_CPP_FILES ../src/serializers/schema_dependent/*.cpp)
|
|
|
|
|
set(SERIALIZERS_S_FILES ${SERIALIZERS_S_H_FILES} ${SERIALIZERS_S_CPP_FILES})
|
2018-03-04 10:42:18 +01:00
|
|
|
|
2019-06-26 13:50:46 +02:00
|
|
|
foreach(s ${SCHEMA_VERSIONS})
|
|
|
|
|
add_library(Serializers_ifc${s} STATIC ${SERIALIZERS_S_FILES})
|
|
|
|
|
set_target_properties(Serializers_ifc${s} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${s} ${CONVERT_PRECISION}")
|
2022-11-25 13:16:36 +01:00
|
|
|
|
|
|
|
|
if (WASM_BUILD)
|
|
|
|
|
TARGET_LINK_LIBRARIES(Serializers_ifc${s} ${HDF5_LIBRARIES})
|
|
|
|
|
else()
|
|
|
|
|
TARGET_LINK_LIBRARIES(Serializers_ifc${s} IfcGeom ${OPENCASCADE_LIBRARIES} ${HDF5_LIBRARIES})
|
|
|
|
|
endif()
|
2019-06-26 13:50:46 +02:00
|
|
|
endforeach()
|
2018-03-04 10:42:18 +01:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
add_library(Serializers ${SERIALIZERS_FILES})
|
|
|
|
|
set_target_properties(Serializers PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS ${CONVERT_PRECISION}" VERSION "0.6.0" SOVERSION "0.6")
|
2018-03-04 10:42:18 +01:00
|
|
|
|
2023-05-07 11:45:47 +02:00
|
|
|
TARGET_LINK_LIBRARIES(Serializers ${SERIALIZER_SCHEMA_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${USD_LIBRARIES})
|
2018-03-04 10:42:18 +01:00
|
|
|
|
2023-05-09 21:07:36 +02:00
|
|
|
endif(BUILD_CONVERT OR BUILD_IFCPYTHON)
|
2022-07-06 16:06:16 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if(BUILD_CONVERT)
|
|
|
|
|
# IfcConvert
|
|
|
|
|
file(GLOB IFCCONVERT_CPP_FILES ../src/ifcconvert/*.cpp)
|
|
|
|
|
file(GLOB IFCCONVERT_H_FILES ../src/ifcconvert/*.h)
|
|
|
|
|
set(IFCCONVERT_FILES ${IFCCONVERT_CPP_FILES} ${IFCCONVERT_H_FILES})
|
|
|
|
|
add_executable(IfcConvert ${IFCCONVERT_FILES})
|
|
|
|
|
set_target_properties(IfcConvert PROPERTIES COMPILE_FLAGS "${CONVERT_PRECISION}")
|
2018-09-08 13:23:36 +02:00
|
|
|
|
2023-05-07 11:45:47 +02:00
|
|
|
TARGET_LINK_LIBRARIES(IfcConvert ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${HDF5_LIBRARIES} ${USD_LIBRARIES})
|
2018-09-08 13:23:36 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
if((NOT WIN32) AND BUILD_SHARED_LIBS)
|
|
|
|
|
# Only set RPATHs when building shared libraries (i.e. IfcParse and
|
|
|
|
|
# IfcGeom are dynamically linked). Not necessarily a perfect solution
|
|
|
|
|
# but probably a good indication of whether RPATHs are necessary.
|
|
|
|
|
SET_INSTALL_RPATHS(IfcConvert "${IFCOPENSHELL_LIBRARY_DIR};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS};${OPENCOLLADA_LIBRARY_DIR}")
|
|
|
|
|
endif()
|
2018-09-08 13:23:36 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
install(TARGETS IfcConvert
|
|
|
|
|
ARCHIVE DESTINATION ${LIBDIR}
|
|
|
|
|
LIBRARY DESTINATION ${LIBDIR}
|
|
|
|
|
RUNTIME DESTINATION ${BINDIR}
|
|
|
|
|
)
|
2018-09-08 13:23:36 +02:00
|
|
|
endif(BUILD_CONVERT)
|
|
|
|
|
|
2015-10-28 19:45:07 +02:00
|
|
|
# IfcGeomServer
|
2022-02-10 11:11:49 +03:00
|
|
|
if(NOT MINIMAL_BUILD AND BUILD_GEOMSERVER)
|
2023-08-28 09:29:58 +02:00
|
|
|
file(GLOB CPP_FILES ../src/ifcgeomserver/*.cpp)
|
|
|
|
|
file(GLOB H_FILES ../src/ifcgeomserver/*.h)
|
|
|
|
|
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
|
|
|
|
|
add_executable(IfcGeomServer ${SOURCE_FILES})
|
|
|
|
|
target_link_libraries(IfcGeomServer ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES})
|
|
|
|
|
|
|
|
|
|
if((NOT WIN32) AND BUILD_SHARED_LIBS)
|
|
|
|
|
SET_INSTALL_RPATHS(IfcGeomServer "${IFCOPENSHELL_LIBRARY_DIR};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS}")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
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()
|
2018-09-08 13:23:36 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
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()
|
2018-09-08 13:23:36 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
# Documentation
|
|
|
|
|
if(BUILD_DOCUMENTATION)
|
|
|
|
|
set(CMAKE_MODULE_PATH "../docs/cmake")
|
|
|
|
|
add_subdirectory(../docs docs)
|
2018-09-08 13:23:36 +02:00
|
|
|
endif()
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
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)
|
2023-08-28 09:32:39 +02:00
|
|
|
foreach(max_year RANGE 2014 2030)
|
|
|
|
|
set(max_sdk "$ENV{ADSK_3DSMAX_SDK_${max_year}}")
|
|
|
|
|
|
|
|
|
|
if(NOT "${max_sdk}" STREQUAL "")
|
|
|
|
|
message(STATUS "Autodesk 3ds Max SDK found at ${max_sdk}")
|
|
|
|
|
set(HAS_MAX TRUE)
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
|
2022-09-13 16:19:03 +02:00
|
|
|
if(HAS_MAX)
|
2023-08-28 09:32:39 +02:00
|
|
|
add_subdirectory(../src/ifcmax ifcmax)
|
2022-09-13 16:19:03 +02:00
|
|
|
else()
|
|
|
|
|
message(STATUS "Autodesk 3ds Max SDK not found, is required to build IFCMax.")
|
2023-08-28 09:32:39 +02:00
|
|
|
endif()
|
2023-08-28 09:29:58 +02:00
|
|
|
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
|
2018-09-08 13:23:36 +02:00
|
|
|
ARCHIVE DESTINATION ${LIBDIR}
|
|
|
|
|
LIBRARY DESTINATION ${LIBDIR}
|
|
|
|
|
RUNTIME DESTINATION ${BINDIR}
|
|
|
|
|
)
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
<<<<<<< HEAD
|
2016-05-15 15:51:12 +02:00
|
|
|
endif()
|
2014-04-06 11:16:20 +00:00
|
|
|
|
2021-12-10 10:03:41 +01:00
|
|
|
if (ADD_COMMIT_SHA)
|
2021-09-09 09:43:28 +02:00
|
|
|
find_package (Git)
|
|
|
|
|
if (GIT_FOUND)
|
|
|
|
|
message("git found: ${GIT_EXECUTABLE} with version ${GIT_VERSION_STRING}")
|
|
|
|
|
execute_process(
|
2023-05-30 01:56:12 +02:00
|
|
|
COMMAND ${GIT_EXECUTABLE} branch -a --contains HEAD
|
2021-09-09 09:43:28 +02:00
|
|
|
OUTPUT_VARIABLE git_branches
|
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
|
)
|
2021-12-18 16:16:21 +01:00
|
|
|
string(REPLACE "\n" ";" git_branch_list "${git_branches}")
|
2021-09-09 09:43:28 +02:00
|
|
|
foreach(git_branch_candidate IN ITEMS ${git_branch_list})
|
2022-09-14 10:55:32 +02:00
|
|
|
string(REPLACE "*" "" git_branch_candidate_temp "${git_branch_candidate}")
|
|
|
|
|
string(STRIP "${git_branch_candidate_temp}" git_branch_candidate_2)
|
2021-12-18 16:16:21 +01:00
|
|
|
if (NOT git_branch_candidate_2 MATCHES "^HEAD$")
|
2023-05-30 01:56:12 +02:00
|
|
|
string(REPLACE "/" ";" git_branch_candidate_2_list "${git_branch_candidate_2}")
|
|
|
|
|
list(GET git_branch_candidate_2_list -1 git_branch)
|
2021-09-09 09:43:28 +02:00
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
execute_process(
|
|
|
|
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
|
|
|
|
OUTPUT_VARIABLE git_sha
|
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
|
)
|
2021-12-18 16:16:21 +01:00
|
|
|
message(STATUS "IfcOpenShell branch: \"${git_branch}\"")
|
|
|
|
|
message(STATUS "IfcOpenShell commit: \"${git_sha}\"")
|
2021-09-09 09:43:28 +02:00
|
|
|
add_definitions(-DIFCOPENSHELL_BRANCH=${git_branch})
|
|
|
|
|
add_definitions(-DIFCOPENSHELL_COMMIT=${git_sha})
|
|
|
|
|
endif()
|
2021-12-10 10:03:41 +01:00
|
|
|
endif()
|
2021-09-09 09:43:28 +02:00
|
|
|
|
2021-07-01 17:55:47 +01:00
|
|
|
# Documentation
|
2020-10-25 12:52:48 +01:00
|
|
|
IF(BUILD_DOCUMENTATION)
|
|
|
|
|
set(CMAKE_MODULE_PATH "../docs/cmake")
|
|
|
|
|
ADD_SUBDIRECTORY(../docs docs)
|
|
|
|
|
ENDIF()
|
2020-10-24 14:48:03 +02:00
|
|
|
|
2022-02-10 11:11:49 +03:00
|
|
|
IF(NOT MINIMAL_BUILD AND BUILD_IFCPYTHON)
|
2015-10-28 19:45:07 +02:00
|
|
|
ADD_SUBDIRECTORY(../src/ifcwrap ifcwrap)
|
|
|
|
|
ENDIF()
|
2011-08-24 12:21:07 +00:00
|
|
|
|
2015-10-28 19:45:07 +02:00
|
|
|
IF(BUILD_EXAMPLES)
|
|
|
|
|
ADD_SUBDIRECTORY(../src/examples examples)
|
|
|
|
|
ENDIF()
|
2012-01-11 13:57:00 +00:00
|
|
|
|
2022-02-10 11:11:49 +03:00
|
|
|
IF(NOT MINIMAL_BUILD AND BUILD_IFCMAX)
|
2016-02-19 22:53:09 +02:00
|
|
|
ADD_SUBDIRECTORY(../src/ifcmax ifcmax)
|
|
|
|
|
ENDIF()
|
2022-02-10 11:11:49 +03:00
|
|
|
if (NOT MINIMAL_BUILD)
|
2021-08-07 23:09:19 +02:00
|
|
|
ADD_SUBDIRECTORY(../src/svgfill svgfill)
|
2022-02-10 11:11:49 +03:00
|
|
|
endif()
|
2021-08-07 23:09:19 +02:00
|
|
|
|
2012-01-11 13:57:00 +00:00
|
|
|
# CMake installation targets
|
2021-07-01 17:55:47 +01:00
|
|
|
INSTALL(FILES ${IFCPARSE_H_FILES}
|
2016-06-09 10:48:43 +02:00
|
|
|
DESTINATION ${INCLUDEDIR}/ifcparse
|
|
|
|
|
)
|
|
|
|
|
|
2018-09-08 13:23:36 +02:00
|
|
|
INSTALL(TARGETS IfcParse
|
|
|
|
|
ARCHIVE DESTINATION ${LIBDIR}
|
|
|
|
|
LIBRARY DESTINATION ${LIBDIR}
|
|
|
|
|
RUNTIME DESTINATION ${BINDIR}
|
|
|
|
|
)
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
=======
|
|
|
|
|
>>>>>>> af84942e (cmake format and unify file)
|
2018-09-08 13:23:36 +02:00
|
|
|
if(BUILD_IFCGEOM)
|
2023-08-28 09:29:58 +02:00
|
|
|
install(FILES ${IFCGEOM_H_FILES}
|
|
|
|
|
DESTINATION ${INCLUDEDIR}/ifcgeom
|
|
|
|
|
)
|
2016-06-09 10:48:43 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
install(FILES ${SCHEMA_AGNOSTIC_H_FILES}
|
|
|
|
|
DESTINATION ${INCLUDEDIR}/ifcgeom_schema_agnostic
|
|
|
|
|
)
|
2018-01-24 17:09:04 +00:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
install(TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} IfcGeom
|
|
|
|
|
ARCHIVE DESTINATION ${LIBDIR}
|
|
|
|
|
LIBRARY DESTINATION ${LIBDIR}
|
|
|
|
|
RUNTIME DESTINATION ${BINDIR}
|
|
|
|
|
)
|
2018-09-08 13:23:36 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(BUILD_CONVERT)
|
2023-08-28 09:29:58 +02:00
|
|
|
install(TARGETS Serializers ${SERIALIZER_SCHEMA_LIBRARIES}
|
|
|
|
|
ARCHIVE DESTINATION ${LIBDIR}
|
|
|
|
|
LIBRARY DESTINATION ${LIBDIR}
|
|
|
|
|
RUNTIME DESTINATION ${BINDIR}
|
|
|
|
|
)
|
2018-09-08 13:23:36 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
install(FILES ${SERIALIZERS_FILES}
|
|
|
|
|
DESTINATION ${INCLUDEDIR}/serializers/
|
|
|
|
|
)
|
2018-09-08 13:23:36 +02:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
install(FILES ${SERIALIZERS_S_FILES}
|
|
|
|
|
DESTINATION ${INCLUDEDIR}/serializers/schema_dependent
|
|
|
|
|
)
|
2018-09-08 13:23:36 +02:00
|
|
|
endif()
|
2021-02-09 00:17:27 +00:00
|
|
|
|
2022-09-08 18:28:34 +02:00
|
|
|
if(BUILD_QTVIEWER)
|
2023-08-28 09:29:58 +02:00
|
|
|
add_subdirectory(../src/qtviewer qtviewer)
|
2022-04-23 16:35:25 +05:30
|
|
|
endif()
|
2021-02-09 00:17:27 +00:00
|
|
|
|
|
|
|
|
list(APPEND CPACK_SOURCE_IGNORE_FILES
|
2023-08-28 09:29:58 +02:00
|
|
|
.git
|
|
|
|
|
.gitignore
|
|
|
|
|
)
|
2021-02-09 00:17:27 +00:00
|
|
|
|
2022-09-13 16:18:06 +02:00
|
|
|
# Cmake uninstall target
|
|
|
|
|
if(NOT TARGET uninstall)
|
|
|
|
|
configure_file(
|
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
|
|
|
|
|
|
add_custom_target(uninstall
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-02-09 00:17:27 +00:00
|
|
|
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${EXTRA_VERSION}")
|
|
|
|
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}${EXTRA_VERSION}")
|
|
|
|
|
SET(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${EXTRA_VERSION}-${CMAKE_SYSTEM_NAME}")
|
|
|
|
|
set(CPACK_PACKAGE_DIRECTORY "${PROJECT_BINARY_DIR}/assets")
|
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IfcOpenShell")
|
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION "IfcOpenShell.")
|
|
|
|
|
set(CPACK_PACKAGE_VENDOR "Cemosis")
|
|
|
|
|
set(CPACK_PACKAGE_CONTACT "Christophe Prud'homme <christophe.prudhomme@cemosis.fr>")
|
|
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
|
|
|
|
|
|
|
|
|
set(CPACK_GENERATOR "TGZ;DEB")
|
|
|
|
|
set(CPACK_SOURCE_GENERATOR "TGZ")
|
2021-02-10 07:04:43 +00:00
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
foreach(COMPONENT IN ITEMS ${BOOST_COMPONENTS})
|
2021-02-09 15:08:22 +00:00
|
|
|
string(REPLACE "_" "-" COMP ${COMPONENT})
|
2022-08-31 20:48:36 +02:00
|
|
|
set(BOOST_DEPS "${BOOST_DEPS}, libboost-${COMP}-dev")
|
2021-02-09 15:08:22 +00:00
|
|
|
endforeach(COMPONENT)
|
2021-02-10 07:04:43 +00:00
|
|
|
|
2021-02-09 00:17:27 +00:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_NAME "${PROJECT_NAME}")
|
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_CONTACT}")
|
2023-03-23 09:05:39 +01:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3, libxml2, libocct-foundation-dev, libocct-modeling-algorithms-dev, libocct-modeling-data-dev, libocct-ocaf-dev, libocct-visualization-dev, libocct-data-exchange-dev, libhdf5-serial-dev, libpython3.8, python3-pytest ${BOOST_DEPS}")
|
2021-02-09 00:17:27 +00:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
|
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
|
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
|
|
|
|
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_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
|
|
|
|
|
2023-08-28 09:29:58 +02:00
|
|
|
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/debian/postinst")
|
2021-02-09 00:17:27 +00:00
|
|
|
include(CPack)
|