From 5b86eedb26f04d3950cede9ee46426feea6e1779 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 20 Feb 2026 14:40:37 +0500 Subject: [PATCH] cmake - fix ifc geom mapping not linking against IfcGeom library --- src/ifcgeom/mapping/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/mapping/CMakeLists.txt b/src/ifcgeom/mapping/CMakeLists.txt index 4e185b9fa9..6369b98b60 100644 --- a/src/ifcgeom/mapping/CMakeLists.txt +++ b/src/ifcgeom/mapping/CMakeLists.txt @@ -1,12 +1,21 @@ find_package(Eigen3 REQUIRED) +# When using `ENABLE_BUILD_OPTIMIZATIONS``/GL` compilation flags makes resulting mapping libs huge (e.g. 1.5GB each) +# and combining them together to a single IfcGeom won't be possible due to 4GB file size limit. +# So in this case we have to ensure each mapping is built as separate libs instead of .obj files to be linked together. +if(ENABLE_BUILD_OPTIMIZATIONS AND MSVC) + set(mapping_library_type "STATIC") +else() + set(mapping_library_type "OBJECT") +endif() + foreach(schema ${SCHEMA_VERSIONS}) file(GLOB IFCGEOM_I_FILES *.i) file(GLOB IFCGEOM_H_FILES *.h) file(GLOB IFCGEOM_CPP_FILES *.cpp) set(IFCGEOM_FILES ${IFCGEOM_CPP_FILES} ${IFCGEOM_H_FILES} ${IFCGEOM_I_FILES}) - add_library(geometry_mapping_ifc${schema} OBJECT ${IFCGEOM_FILES}) + add_library(geometry_mapping_ifc${schema} ${mapping_library_type} ${IFCGEOM_FILES}) set_target_properties( geometry_mapping_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}"