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/>. #
# #
################################################################################
2024-06-07 23:48:39 +10:00
cmake_minimum_required ( VERSION 3.21 )
2025-06-17 14:38:15 +05:00
if ( NOT DEFINED CMAKE_CXX_STANDARD )
set ( CMAKE_CXX_STANDARD 17 )
endif ( )
if ( CMAKE_CXX_STANDARD LESS 17 )
message ( FATAL_ERROR "C++17 or newer is required." )
endif ( )
2023-08-28 09:29:58 +02:00
set ( CMAKE_CXX_STANDARD_REQUIRED ON ) # not necessary, but encouraged
2024-06-07 23:48:39 +10:00
set ( CMAKE_EXPORT_COMPILE_COMMANDS ON )
2015-10-28 19:45:07 +02:00
2026-07-06 22:06:42 +03:00
# The VERSION file in the repository root is the single source of truth for the
# release version. Read it unconditionally so a plain source build reports the
# real version through buildinfo.cpp instead of the stale hardcoded 0.8.0
# fallback (see #8164). VERSION_OVERRIDE still controls the branch name used
# when ADD_COMMIT_SHA embeds a commit sha.
file ( READ "../VERSION" "RELEASE_VERSION_" )
string ( STRIP "${RELEASE_VERSION_}" RELEASE_VERSION )
message ( STATUS "Detected version '${RELEASE_VERSION}'" )
2025-12-07 23:35:05 +01:00
2024-10-10 16:48:30 +02:00
add_definitions ( -D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR )
2025-10-03 09:04:43 +02:00
if ( POLICY CMP0141 ) # 3.25+
cmake_policy ( SET CMP0141 NEW ) # Support for `CMAKE_MSVC_DEBUG_INFORMATION_FORMAT`.
endif ( )
2025-08-14 12:13:44 +05:00
if ( POLICY CMP0144 ) # 3.27
2024-06-07 23:48:39 +10:00
cmake_policy ( SET CMP0144 NEW ) # find_package() uses upper-case <PACKAGENAME>_ROOT variables.
2024-02-19 09:26:18 +01:00
endif ( )
2025-08-14 12:13:44 +05:00
if ( POLICY CMP0167 ) # 3.30
cmake_policy ( SET CMP0167 OLD )
endif ( )
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 ( )
2024-06-07 23:48:39 +10:00
# Include utility macros and functions
include ( utilities.cmake )
2021-07-01 17:55:47 +01:00
# use extra version to make pre-release using eg semver
2024-06-08 22:54:23 +01:00
if ( NOT DEFINED EXTRA_VERSION )
set ( EXTRA_VERSION "-alpha.3" )
endif ( )
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 )
2023-09-04 20:54:29 +02:00
option ( WASM_BUILD "Build a WebAssembly binary." OFF )
2023-08-28 09:29:58 +02:00
option ( ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF )
2026-04-18 21:32:32 +02:00
option ( BUILD_SHARED_LIBS "Build IfcOpenShell as shared libraries (required)." ON )
2023-09-04 20:54:29 +02:00
option ( MSVC_PARALLEL_BUILD "Multi-threaded compilation in Microsoft Visual Studio (/MP)" OFF )
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 ( NO_WARN "Disable all warnings" OFF )
2026-04-21 16:18:59 +02:00
option ( CREATE_BUNDLE "Copy .so files and don't create RPATHS or SOVERSION symlinks" )
2023-09-04 20:54:29 +02:00
2023-08-28 09:29:58 +02:00
option ( BUILD_IFCGEOM "Build IfcGeom." ON )
option ( BUILD_IFCPYTHON "Build IfcPython." ON )
2026-03-31 20:51:46 +02:00
option ( BUILD_IFCPARSE_EXPERIMENTAL_WRAPPER "Build the experimental Clang-generated ifcparse Python wrapper." OFF )
2023-09-04 20:54:29 +02:00
option ( BUILD_CONVERT "Build IfcConvert executable." ON )
option ( BUILD_DOCUMENTATION "Build IfcOpenShell Documentation." OFF )
2023-08-28 09:29:58 +02:00
option ( BUILD_EXAMPLES "Build example applications." ON )
2025-08-12 14:42:20 +05:00
option ( BUILD_GEOMSERVER "Build IfcGeomServer executable (Open CASCADE is required)." ON )
2023-09-04 20:54:29 +02:00
option ( BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." OFF )
option ( BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer" OFF ) # QtViewer requires Qt6
2026-06-01 17:38:33 +10:00
option ( BUILD_IFCMODEL_UI "Build minimal Qt IFC model UI prototype" OFF )
2026-05-20 16:11:44 +10:00
option ( BUILD_BONSAIVIEWER "Build Bonsai Viewer" OFF ) # Requires Qt6 + OpenGL 4.5
2026-07-07 10:53:16 +02:00
option ( BUILD_IFCOPENSHELL_PARSE_TESTS "Build C++ unit tests for IfcParse (fetches Catch2 v3)" OFF )
option ( BUILD_IFCOPENSHELL_GEOMETRY_TESTS "Build C++ unit tests for IfcGeom (fetches Catch2 v3)" OFF )
2026-05-20 16:11:44 +10:00
option ( BUILD_BONSAIVIEWER_TESTS "Build unit tests for Bonsai Viewer core (fetches Catch2 v3)" OFF )
2026-05-27 12:23:23 +10:00
option ( BUILD_BONSAIVIEWER_WGPU "Build the experimental wgpu backend (fetches wgpu-native binary release)" OFF )
2026-06-01 17:38:33 +10:00
# IfcViewer (the GL static lib) now links against IfcViewerWgpu because
# SceneLoader drives the wgpu viewport. Auto-enable the wgpu subproject
# whenever BUILD_BONSAIVIEWER is on so the link target exists.
if ( BUILD_BONSAIVIEWER AND NOT BUILD_BONSAIVIEWER_WGPU )
message ( STATUS "BUILD_BONSAIVIEWER implies BUILD_BONSAIVIEWER_WGPU "
2026-06-04 11:11:14 +10:00
"(SceneLoader uses ViewportWindow); auto-enabling." )
2026-06-01 17:38:33 +10:00
set ( BUILD_BONSAIVIEWER_WGPU ON )
endif ( )
2023-09-04 20:54:29 +02:00
option ( BUILD_PACKAGE "" OFF )
2026-07-19 08:30:48 +01:00
option (
BUILD_FUZZERS
"Build libFuzzer security-fuzzing harnesses. Requires a Clang toolchain configured with -fsanitize=fuzzer (typically also address,undefined) via CMAKE_CXX_FLAGS."
OFF
)
2026-05-08 10:12:57 +02:00
option (
IFCOPENSHELL_DEPLOY_QT_RUNTIME
"Deploy Qt runtime dependencies for installed Qt applications."
ON
)
option (
IFCOPENSHELL_DEPLOY_QT_TRANSLATIONS
"Deploy Qt translation catalogs with installed Qt applications."
OFF
)
2024-06-07 23:48:39 +10:00
option ( WITH_OPENCASCADE "Enable geometry interpretation using Open CASCADE" ON )
option ( WITH_CGAL "Enable geometry interpretation using CGAL" ON )
2026-04-07 15:47:58 +02:00
option ( WITH_MANIFOLD "Enable geometry interpretation using Manifold" OFF )
2023-09-04 20:54:29 +02:00
option ( COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON )
option ( GLTF_SUPPORT "Build IfcConvert with glTF support (requires json.hpp)." OFF )
2023-10-03 21:26:00 +02:00
option ( WITH_PROJ "Enable output of Earth-Centered Earth-Fixed glTF output using the PROJ library" OFF )
2023-09-04 20:54:29 +02:00
option ( USD_SUPPORT "Build IfcConvert with USD support (requires pixar's USD library)." OFF )
2025-02-21 16:14:01 +01:00
option ( WITH_ROCKSDB "Support a RocksDB key-value store as a file backend in IfcOpenShell" OFF )
2025-09-03 11:11:55 +02:00
option ( WITH_ZSTD "Use Zstd compression in RocksDB writes" OFF )
2023-08-28 09:29:58 +02:00
2023-09-04 20:54:29 +02:00
option ( USERSPACE_PYTHON_PREFIX "Installs IfcPython for the current user only instead of system-wide." OFF )
2025-12-02 11:40:21 +05:00
option ( USE_DEBUG_PYTHON "Use debug binaries when building Debug IfcPython on Windows." OFF )
2025-10-03 09:04:43 +02:00
option ( ADD_COMMIT_SHA "Add commit sha and branch in version number, requires git" OFF )
option ( VERSION_OVERRIDE "Override the version defined in buildinfo.cpp with the file VERSION in the repository root" OFF )
2024-06-25 11:40:42 +02:00
2025-08-13 18:01:31 +05:00
set (
PYTHON_MODULE_INSTALL_DIR
"" CACHE PATH
"Directory to install IfcPython package to. By default package is installed in found Python's site-packages."
)
2024-06-25 11:40:42 +02:00
if ( VERSION_OVERRIDE )
file ( READ "../VERSION" "RELEASE_VERSION_" )
string ( STRIP "${RELEASE_VERSION_}" RELEASE_VERSION )
message ( STATUS "Detected version '${RELEASE_VERSION}'" )
else ( )
set ( RELEASE_VERSION "0.8.0" )
endif ( )
project ( IfcOpenShell VERSION ${ RELEASE_VERSION } )
2023-08-28 09:29:58 +02:00
2025-10-04 22:51:51 +02:00
# Make sure CMake modules in this project are found first
list ( PREPEND CMAKE_MODULE_PATH ${ PROJECT_SOURCE_DIR } )
2026-07-07 10:53:16 +02:00
# Catch2 is fetched only when an explicit C++ test family is enabled, so the
# default build remains offline-capable.
if ( BUILD_IFCOPENSHELL_PARSE_TESTS OR BUILD_IFCOPENSHELL_GEOMETRY_TESTS OR BUILD_BONSAIVIEWER_TESTS )
include ( FetchContent )
FetchContent_Declare (
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.5.4
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable ( Catch2 )
list ( APPEND CMAKE_MODULE_PATH ${ catch2_SOURCE_DIR } /extras )
include ( CTest )
include ( Catch )
enable_testing ( )
endif ( )
2023-09-04 20:54:29 +02:00
if ( MINIMAL_BUILD )
message ( STATUS "Setting options for minimal build" )
set ( BUILD_GEOMSERVER OFF )
set ( BUILD_IFCPYTHON OFF )
2024-06-07 23:48:39 +10:00
set ( WITH_CGAL OFF )
2023-09-04 20:54:29 +02:00
set ( COLLADA_SUPPORT OFF )
set ( GLTF_SUPPORT OFF )
set ( USD_SUPPORT OFF )
2019-07-10 14:35:56 +02:00
endif ( )
2019-04-03 15:08:14 +02:00
2023-09-04 20:54:29 +02:00
if ( ( BUILD_CONVERT OR BUILD_GEOMSERVER OR BUILD_IFCPYTHON ) AND(NOT BUILD_IFCGEOM ) )
message ( STATUS "'IfcGeom' is required with current outputs" )
set ( BUILD_IFCGEOM ON )
endif ( )
2022-03-19 19:32:42 +00:00
2025-10-16 11:09:59 +05:00
find_program ( CCACHE_FOUND ccache )
2025-10-03 09:04:43 +02:00
if ( CCACHE_FOUND )
2025-10-16 11:09:59 +05:00
message ( STATUS "`ccache` is found, using it as a compiler launcher." )
2025-10-06 12:56:21 +05:00
set_property ( GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}" )
2025-10-03 09:04:43 +02:00
if ( MSVC )
# By default Visual Studio generators will use /Zi which is not compatible
# with ccache, so tell Visual Studio to use /Z7 instead.
set ( CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>" )
# Not needed for Ninja.
if ( CMAKE_GENERATOR MATCHES "Visual Studio" )
file ( COPY_FILE
${ CCACHE_FOUND } ${ CMAKE_BINARY_DIR } /cl.exe
ONLY_IF_DIFFERENT )
set ( CMAKE_VS_GLOBALS
"CLToolExe=cl.exe"
"CLToolPath=${CMAKE_BINARY_DIR}"
"UseMultiToolTask=true"
)
endif ( )
endif ( )
endif ( )
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 ( )
2021-02-09 12:54:05 +00:00
include ( GNUInstallDirs )
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
2026-04-15 18:07:28 +02:00
if ( MSVC )
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'
# There will be couple hundreds of these so suppress them away, https://msdn.microsoft.com/en-us/library/esew7y1w.aspx
add_definitions ( -wd4251 )
2016-05-30 00:59:06 +03:00
endif ( )
2016-05-15 15:47:21 +02:00
2022-09-13 16:20:30 +02:00
UNIFY_ENVVARS_AND_CACHE ( BOOST_ROOT )
UNIFY_ENVVARS_AND_CACHE ( BOOST_LIBRARYDIR )
2023-08-28 09:29:58 +02:00
if ( NOT MINIMAL_BUILD )
2025-10-06 16:29:09 +05:00
UNIFY_ENVVARS_AND_CACHE ( PYTHON_INCLUDE_DIR )
UNIFY_ENVVARS_AND_CACHE ( PYTHON_LIBRARY )
2023-08-28 09:29:58 +02:00
UNIFY_ENVVARS_AND_CACHE ( PYTHON_EXECUTABLE )
endif ( )
2024-06-07 23:48:39 +10:00
# Get a list of all OPTION flags from the CMakeLists.txt
get_all_option_flags ( option_flags )
# Loop through the list of OPTION flags and convert the corresponding environment variables
foreach ( option_flag IN LISTS option_flags )
convert_env_var_to_bool ( "${option_flag}" )
endforeach ( )
if ( WITH_CGAL )
2025-11-09 08:26:33 +01:00
find_package ( CGAL REQUIRED )
2024-06-07 23:48:39 +10:00
set ( SWIG_DEFINES ${ SWIG_DEFINES } -DIFOPSH_WITH_CGAL )
list ( APPEND GEOMETRY_KERNELS cgal )
endif ( )
2025-12-02 17:59:45 +05:00
if ( BUILD_IFCGEOM AND WITH_OPENCASCADE )
2025-11-15 20:31:13 +01:00
find_package ( OpenCASCADE REQUIRED )
2025-12-02 17:58:35 +05:00
# Map OpenCASCADE_LIBRARIES variable from OpenCASCADEConfig.cmake to OpenCASCADE_LIBRARIES used by kernel generic cmake file
set ( OpenCASCADE_LIBRARIES ${ OpenCASCADE_LIBRARIES } )
2024-06-07 23:48:39 +10:00
set ( SWIG_DEFINES ${ SWIG_DEFINES } -DIFOPSH_WITH_OPENCASCADE )
list ( APPEND GEOMETRY_KERNELS opencascade )
endif ( )
2026-04-07 15:47:58 +02:00
message ( STATUS "BUILD_IFCGEOM WITH_MANIFOLD: ${BUILD_IFCGEOM} ${WITH_MANIFOLD}" )
if ( BUILD_IFCGEOM AND WITH_MANIFOLD )
find_package ( manifold CONFIG REQUIRED )
if ( TARGET manifold::manifold )
set ( MANIFOLD_LIBRARIES manifold::manifold )
elseif ( TARGET manifold )
set ( MANIFOLD_LIBRARIES manifold )
else ( )
message ( FATAL_ERROR "Unable to determine manifold target" )
endif ( )
list ( APPEND GEOMETRY_KERNELS manifold )
endif ( )
2026-04-09 17:17:53 +02:00
if ( BUILD_IFCGEOM )
list ( APPEND GEOMETRY_KERNELS passthrough )
endif ( )
2025-11-13 13:56:21 +01:00
if ( GLTF_SUPPORT )
2026-04-19 12:32:18 +02:00
find_package ( nlohmann_json REQUIRED )
2019-05-07 17:06:45 +02:00
endif ( )
2025-08-12 12:49:20 +05:00
# Add USD support to serializers
2023-09-04 20:54:29 +02:00
if ( USD_SUPPORT )
2025-11-19 19:30:54 +05:00
find_package ( USD REQUIRED )
2024-06-07 23:48:39 +10:00
endif ( USD_SUPPORT )
2016-05-15 15:47:21 +02:00
2025-02-21 16:14:01 +01:00
if ( WITH_ROCKSDB )
2025-10-03 09:04:43 +02:00
# Temporaily mess with CMAKE_FIND_PACKAGE_PREFER_CONFIG to help RocksDB
# find it's zstd dependency on Windows.
# Only do it on Windows, otherwise it might create problems as
# findzstd and zstd-config target names do not match.
if ( WIN32 )
set ( TEMP CMAKE_FIND_PACKAGE_PREFER_CONFIG )
set ( CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE )
2025-09-22 15:01:06 +05:00
endif ( )
2025-10-03 09:04:43 +02:00
find_package ( RocksDB CONFIG REQUIRED )
if ( WIN32 )
set ( CMAKE_FIND_PACKAGE_PREFER_CONFIG ${ TEMP } )
2025-09-22 15:01:06 +05:00
endif ( )
2025-09-19 18:43:27 +05:00
2025-10-03 09:04:43 +02:00
message ( STATUS "RocksDB: found at '${RocksDB_DIR}'." )
2025-12-12 17:35:11 +05:00
add_library ( IFCOPENSHELL_RocksDB INTERFACE )
2026-07-09 13:30:48 +02:00
set ( IFCOPENSHELL_ROCKSDB_TARGET IFCOPENSHELL_RocksDB )
2025-12-12 17:35:11 +05:00
set ( ROCKSDB_LIBRARIES "IFCOPENSHELL_RocksDB" )
target_compile_definitions ( IFCOPENSHELL_RocksDB INTERFACE IFOPSH_WITH_ROCKSDB )
2025-09-03 11:11:55 +02:00
set ( SWIG_DEFINES ${ SWIG_DEFINES } -DIFOPSH_WITH_ROCKSDB )
2026-06-04 22:31:02 +01:00
# See https://github.com/facebook/rocksdb/issues/981.
if ( TARGET RocksDB::rocksdb )
2026-06-04 22:31:02 +01:00
target_link_libraries ( IFCOPENSHELL_RocksDB INTERFACE RocksDB::rocksdb )
2026-06-04 22:31:02 +01:00
elseif ( TARGET RocksDB::rocksdb-shared )
2026-06-04 22:31:02 +01:00
target_link_libraries ( IFCOPENSHELL_RocksDB INTERFACE RocksDB::rocksdb-shared )
2026-06-04 22:31:02 +01:00
else ( )
message ( FATAL_ERROR "RocksDB found but neither RocksDB::rocksdb nor RocksDB::rocksdb-shared target exists" )
endif ( )
2025-09-03 11:11:55 +02:00
if ( WITH_ZSTD )
2025-09-11 13:53:44 +02:00
# @todo do we actually need the zstd include dir or rather just pass
# the libzstd.a along with the rocksdb library when needed and feature
# detect based on rocksdb API?
2025-10-03 09:04:43 +02:00
find_package ( zstd CONFIG REQUIRED )
message ( STATUS "zstd: found at '${zstd_DIR}'." )
2025-09-03 11:11:55 +02:00
endif ( )
2025-02-21 16:14:01 +01:00
endif ( )
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
2024-06-07 23:48:39 +10:00
if ( WASM_BUILD )
2023-08-28 14:50:58 +02:00
set ( BOOST_COMPONENTS )
else ( )
# @todo review this, shouldn't this be all possible header-only now?
# ... or rewritten using C++17 features?
2026-04-11 16:27:06 +10:00
# set(BOOST_COMPONENTS system program_options regex thread date_time iostreams)
set ( BOOST_COMPONENTS program_options regex thread date_time iostreams )
2023-08-28 14:50:58 +02:00
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 ( )
endif ( )
2023-08-28 10:23:16 +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}" )
2025-11-20 16:48:48 +05:00
if ( COLLADA_SUPPORT )
find_package ( OpenCOLLADA REQUIRED )
2025-08-29 12:30:05 +05: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 ( )
2024-02-12 14:23:21 +05:00
else ( )
2024-06-07 23:48:39 +10:00
# @tfk I commented this out as this kind of defeats the purpose of RelWithDebInfo. For the
# best debugging experience simply use Debug. Note that in MSVC you can selectively toggle
# optimization on a specific file if you're investigating a specific issue.
# if(MSVC)
# set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od")
# endif()
endif ( ENABLE_BUILD_OPTIMIZATIONS )
2015-10-28 19:45:07 +02:00
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
2024-06-07 23:48:39 +10: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()
add_definitions ( -D_ENABLE_EXTENDED_ALIGNED_STORAGE )
2024-09-11 21:48:29 +05:00
# See #5158.
if ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.40 )
add_definitions ( -D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR )
endif ( )
2023-08-28 09:29:58 +02:00
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 ( )
2024-06-07 23:48:39 +10:00
endif ( MSVC )
2011-05-08 11:04:32 +00:00
2026-04-19 12:32:18 +02:00
include_directories ( ${ INCLUDE_DIRECTORIES }
2026-05-08 16:20:26 +02:00
${ Boost_INCLUDE_DIRS }
2026-04-19 12:32:18 +02:00
${ CGAL_INCLUDE_DIR } ${ GMP_INCLUDE_DIR } ${ MPFR_INCLUDE_DIR }
2011-08-24 12:21:07 +00:00
)
2015-10-28 19:45:07 +02:00
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
2025-09-14 11:38:33 +02:00
set ( SCHEMA_VERSIONS "2x3" "4" "4x3_add2" )
2022-11-25 13:16:36 +01:00
else ( )
2024-06-07 23:48:39 +10:00
set ( SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3" "4x3_tc1" "4x3_add1" "4x3_add2" )
2022-11-25 13:16:36 +01:00
endif ( )
2021-07-10 21:10:03 +02:00
endif ( )
2019-06-26 13:50:46 +02:00
2024-02-06 14:16:52 +05:00
message ( STATUS "IFC SCHEMA_VERSIONS that will be used for the build: ${SCHEMA_VERSIONS}." )
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 10:23:16 +02:00
foreach ( schema ${ SCHEMA_VERSIONS } )
if ( "${COMPILED_SCHEMA_NAME}" STREQUAL "${schema}" )
list ( REMOVE_ITEM IFC_RELEASE_NOT_USED "${schema}" )
2023-08-28 09:29:58 +02:00
endif ( )
endforeach ( )
2024-06-07 23:48:39 +10:00
endif ( COMPILE_SCHEMA )
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 ( )
2026-04-14 13:50:23 +02:00
add_subdirectory ( ../src/plugin plugin )
2025-11-09 08:26:33 +01:00
add_subdirectory ( ../src/ifcparse ifcparse )
2019-05-28 12:04:13 +02:00
set ( IFCOPENSHELL_LIBRARIES IfcParse )
2026-07-07 10:53:16 +02:00
if ( BUILD_IFCOPENSHELL_PARSE_TESTS )
add_subdirectory ( ../src/ifcparse/tests ifcparse/tests )
endif ( )
2024-06-07 23:48:39 +10:00
2026-07-03 13:27:26 +02:00
if ( BUILD_EXAMPLES OR BUILD_BONSAIVIEWER )
add_subdirectory ( ../src/helpers helpers )
endif ( )
2026-03-31 20:51:46 +02:00
if ( BUILD_IFCPARSE_EXPERIMENTAL_WRAPPER )
add_subdirectory ( ../src/wrappergen wrappergen )
endif ( )
2023-08-28 09:29:58 +02:00
if ( BUILD_IFCGEOM )
2025-10-03 09:04:43 +02:00
# CGAL::CGAL target already has dependencies resolved.
if ( WITH_CGAL AND CGAL_DIR )
set ( CGAL_LIBRARIES CGAL::CGAL )
message ( STATUS "Using found CGAL package at '${CGAL_DIR}'" )
elseif ( WITH_CGAL AND NOT CGAL_DIR )
2024-06-07 23:48:39 +10:00
find_library ( libGMP NAMES gmp mpir PATHS ${ GMP_LIBRARY_DIR } NO_DEFAULT_PATH )
find_library ( libMPFR NAMES mpfr PATHS ${ MPFR_LIBRARY_DIR } NO_DEFAULT_PATH )
if ( NOT libGMP )
message ( FATAL_ERROR "Unable to find GMP library files, aborting" )
endif ( )
if ( NOT libMPFR )
message ( FATAL_ERROR "Unable to find MPFR library files, aborting" )
endif ( )
2016-06-22 14:54:55 +02:00
2024-06-07 23:48:39 +10:00
list ( APPEND CGAL_LIBRARIES "${libMPFR}" )
list ( APPEND CGAL_LIBRARIES "${libGMP}" )
endif ( )
2025-11-11 07:21:18 +01:00
add_subdirectory ( ../src/ifcgeom ifcgeom )
2026-07-07 10:53:16 +02:00
if ( BUILD_IFCOPENSHELL_GEOMETRY_TESTS )
add_subdirectory ( ../src/ifcgeom/tests ifcgeom/tests )
endif ( )
elseif ( BUILD_IFCOPENSHELL_GEOMETRY_TESTS )
message ( FATAL_ERROR "BUILD_IFCOPENSHELL_GEOMETRY_TESTS requires BUILD_IFCGEOM=ON." )
2018-09-08 13:23:36 +02:00
endif ( BUILD_IFCGEOM )
2026-05-20 16:11:44 +10:00
if ( BUILD_CONVERT OR BUILD_IFCPYTHON OR BUILD_BONSAIVIEWER )
2025-11-15 21:13:05 +01:00
add_subdirectory ( ../src/serializers serializers )
2026-05-20 16:11:44 +10:00
endif ( BUILD_CONVERT OR BUILD_IFCPYTHON OR BUILD_BONSAIVIEWER )
2022-07-06 16:06:16 +02:00
2023-08-28 09:29:58 +02:00
if ( BUILD_CONVERT )
2025-11-10 23:04:42 +01:00
add_subdirectory ( ../src/ifcconvert ifcconvert )
2018-09-08 13:23:36 +02:00
endif ( BUILD_CONVERT )
2015-10-28 19:45:07 +02:00
# IfcGeomServer
2023-09-04 20:54:29 +02:00
if ( BUILD_GEOMSERVER )
2025-11-10 21:21:52 +01:00
add_subdirectory ( ../src/ifcgeomserver ifcgeomserver )
2024-06-07 23:48:39 +10:00
endif ( BUILD_GEOMSERVER )
2023-08-28 09:29:58 +02:00
if ( ADD_COMMIT_SHA )
find_package ( Git )
2025-10-03 09:04:43 +02:00
if ( NOT GIT_FOUND )
message ( FATAL_ERROR "Failed to find Git for ADD_COMMIT_SHA option." )
endif ( )
2023-08-28 09:29:58 +02:00
if ( GIT_FOUND )
2024-06-25 11:40:42 +02:00
if ( VERSION_OVERRIDE )
set ( git_branch ${ RELEASE_VERSION } )
else ( )
message ( "git found: ${GIT_EXECUTABLE} with version ${GIT_VERSION_STRING}" )
execute_process (
COMMAND ${ GIT_EXECUTABLE } branch -a --contains HEAD
2025-01-17 13:57:14 +01:00
WORKING_DIRECTORY ${ CMAKE_CURRENT_SOURCE_DIR }
2024-06-25 11:40:42 +02:00
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 ( REPLACE "*" "" git_branch_candidate_temp "${git_branch_candidate}" )
string ( STRIP "${git_branch_candidate_temp}" git_branch_candidate_2 )
if ( NOT git_branch_candidate_2 MATCHES "^HEAD$" )
string ( REPLACE "/" ";" git_branch_candidate_2_list "${git_branch_candidate_2}" )
list ( GET git_branch_candidate_2_list -1 git_branch )
endif ( )
endforeach ( )
endif ( )
2018-09-08 13:23:36 +02:00
2023-08-28 09:29:58 +02:00
execute_process (
2025-01-17 13:57:14 +01:00
COMMAND ${ GIT_EXECUTABLE } rev-parse --short HEAD
WORKING_DIRECTORY ${ CMAKE_CURRENT_SOURCE_DIR }
2023-08-28 09:29:58 +02:00
OUTPUT_VARIABLE git_sha
OUTPUT_STRIP_TRAILING_WHITESPACE
)
2025-01-17 13:57:14 +01:00
2023-08-28 09:29:58 +02:00
message ( STATUS "IfcOpenShell branch: \" ${ git_branch } \"")
message(STATUS "IfcOpenShell commit: \" ${ git_sha } \"")
2025-01-17 13:57:14 +01:00
if ( "${git_branch}" STREQUAL "" OR "${git_sha}" STREQUAL "" )
message(FATAL_ERROR "Unable to determine commit sha and/or branch" )
endif ( )
2025-10-03 09:04:43 +02:00
target_compile_definitions ( IfcParse PRIVATE
-DIFCOPENSHELL_BRANCH= ${ git_branch }
-DIFCOPENSHELL_COMMIT= ${ git_sha }
)
2023-08-28 09:29:58 +02:00
endif ( )
2024-06-07 23:48:39 +10:00
endif ( ADD_COMMIT_SHA )
2026-07-06 09:09:11 +03:00
# Always expose the release version (from the VERSION file) to buildinfo.cpp so
# that a build without commit-sha info reports the correct version instead of a
# stale hardcoded fallback. See #8164.
target_compile_definitions ( IfcParse PRIVATE IFCOPENSHELL_VERSION_STRING= ${ RELEASE_VERSION } )
2024-06-07 23:48:39 +10:00
if ( MSVC )
# @todo still needs to be understood better, but the cgal and cgal-simple kernel cause multiply defined boost lambda placeholders _1 ... _3
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /FORCE:MULTIPLE" )
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /FORCE:MULTIPLE" )
set ( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /FORCE:MULTIPLE" )
2023-08-28 09:29:58 +02:00
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 ( BUILD_EXAMPLES )
add_subdirectory ( ../src/examples examples )
endif ( )
2023-09-04 14:37:59 +02:00
if ( BUILD_IFCMAX )
add_subdirectory ( ../src/ifcmax ifcmax )
2023-08-28 09:29:58 +02:00
endif ( )
2025-11-28 18:50:46 +01:00
if ( BUILD_IFCPYTHON AND WITH_CGAL )
2025-08-12 12:49:20 +05:00
add_subdirectory ( ../src/svgfill svgfill )
2023-08-28 09:29:58 +02:00
endif ( )
2026-04-21 21:46:56 +02:00
if ( BUILD_IFCPYTHON )
add_subdirectory ( ../src/ifcwrap ifcwrap )
endif ( )
2023-08-28 10:23:16 +02:00
if ( BUILD_QTVIEWER )
add_subdirectory ( ../src/qtviewer qtviewer )
2022-02-10 11:11:49 +03:00
endif ( )
2021-08-07 23:09:19 +02:00
2026-06-01 17:38:33 +10:00
if ( BUILD_IFCMODEL_UI )
add_subdirectory ( ../src/ifcmodel-ui ifcmodel-ui )
endif ( )
2018-09-08 13:23:36 +02:00
if ( BUILD_IFCGEOM )
2024-11-24 15:12:44 +01: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 }
2024-11-24 15:12:44 +01:00
DESTINATION ${ INCLUDEDIR } /ifcgeom
2023-08-28 09:29:58 +02:00
)
2018-01-24 17:09:04 +00:00
2025-10-03 09:04:43 +02:00
file ( GLOB SERIALIZATION_H_FILES ../src/ifcgeom/serialization/*.h )
install ( FILES ${ SERIALIZATION_H_FILES }
DESTINATION ${ INCLUDEDIR } /ifcgeom/serialization
)
2024-11-24 15:12:44 +01:00
foreach ( kernel ${ GEOMETRY_KERNELS } )
file ( GLOB IFCGEOM_H_FILES ../src/ifcgeom/kernels/ ${ kernel } /*.h )
install ( FILES ${ IFCGEOM_H_FILES }
DESTINATION ${ INCLUDEDIR } /ifcgeom/kernels/ ${ kernel }
)
endforeach ( )
2025-11-28 16:45:40 +01:00
install ( TARGETS ${ IFCGEOM_SCHEMA_LIBRARIES } ${ kernel_libraries } IfcGeom )
2024-06-07 23:48:39 +10:00
endif ( BUILD_IFCGEOM )
2026-06-01 17:53:41 +10:00
if ( BUILD_BONSAIVIEWER )
2026-06-04 11:11:14 +10:00
# IfcViewer is the unified scene + render lib since the wgpu/ifcviewer
# merge — wgpu-native is fetched inside its CMakeLists.txt.
add_subdirectory ( ../src/ifcviewer ifcviewer )
2026-06-01 17:38:33 +10:00
if ( BUILD_BONSAIVIEWER_WGPU )
2026-06-04 11:11:14 +10:00
add_subdirectory ( ../src/ifcviewer-minimal ifcviewer-minimal )
2026-06-01 17:38:33 +10:00
endif ( )
2026-05-20 09:38:10 +10:00
add_subdirectory ( ../src/bonsaiviewer bonsaiviewer )
2026-04-11 16:30:10 +10:00
endif ( )
2018-09-08 13:23:36 +02:00
2026-07-19 08:30:48 +01:00
if ( BUILD_FUZZERS )
add_subdirectory ( ../src/ifcfuzz ifcfuzz )
endif ( )
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 ( )
2023-08-28 10:23:16 +02:00
# Packaging
list ( APPEND CPACK_SOURCE_IGNORE_FILES
2024-06-08 22:54:23 +01:00
"/\\\\.git"
"/build/"
2025-06-13 09:11:09 +01:00
"/.pytest_cache/"
"/__pycache__/"
2023-08-28 10:23:16 +02:00
)
2024-06-08 22:54:23 +01:00
set ( CPACK_SOURCE_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR}/..;/" )
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}" )
2026-05-08 16:20:26 +02: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, libpython3-dev, 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")
2024-06-07 23:48:39 +10:00
2021-02-09 00:17:27 +00:00
include ( CPack )