Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions recipes/ifcopenshell/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sources:
"0.8.4.cci.20251222":
url: "https://github.com/IfcOpenShell/IfcOpenShell/archive/cc559212a3831d7cb68dca67be0cabdfd743f585.tar.gz"
sha256: "f814697bc400efa096e5f77f0a0226f79a66e1e7465d30356704f98efe378913"
patches:
"0.8.4.cci.20251222":
- patch_file: "patches/0001-Update-CMakeLists.txt.patch"
patch_type: "portability"
241 changes: 241 additions & 0 deletions recipes/ifcopenshell/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@

import os

from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches, rm, rmdir

required_conan_version = ">=2.1"

IFC_SCHEMAS = sorted(["2x3", "4", "4x1", "4x2", "4x3", "4x3_tc1", "4x3_add1", "4x3_add2"])

class IfcopenshellConan(ConanFile):
name = "ifcopenshell"
description = "Open source IFC library and geometry engine"
license = "LGPL-3.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/IfcOpenShell/IfcOpenShell"
topics = ("ifc", "bim", "building", "3d")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"build_ifcgeom": [True, False],
"build_ifcgeomserver": [True, False],
"build_convert": [True, False],
"build_convert_with_usd": [True, False],
"build_convert_with_proj": [True, False],
"ifcxml_support": [True, False],
"use_mmap": [True, False],
"with_cgal": [True, False],
"with_hdf5": [True, False],

"with_ifcpython": [True, False],
"with_examples": [True, False],
"with_collada_support": [True, False],
"build_qtviewer": [True, False],
}

options.update({f"schema_{schema}": [True, False] for schema in IFC_SCHEMAS})

default_options = {
"shared": False,
"fPIC": True,
"build_ifcgeom": True,
"build_ifcgeomserver": True,
"build_convert": True,
"build_convert_with_usd": False,
"build_convert_with_proj": True,
"ifcxml_support": True,
"use_mmap": True,
"with_cgal": True,
"with_hdf5": True,

"with_ifcpython": True,
"with_examples": True,
"with_collada_support": False,
"build_qtviewer": False,
}
# Limit the default set of schemas to the basic ones and the latest to limit the size of the build.
default_options.update({f"schema_{schema}": schema in ["2x3", "4", "4x3_add2"] for schema in IFC_SCHEMAS})
implements = ["auto_shared_fpic"]

@property
def _selected_ifc_schemas(self):
return [schema for schema in IFC_SCHEMAS if self.options.get_safe(f"schema_{schema}")]

def export_sources(self):
export_conandata_patches(self)

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
if not self.options.build_ifcgeom:
del self.options.with_cgal

def layout(self):
cmake_layout(self, src_folder="src")

def validate(self):
check_min_cppstd(self, 17)
if self.options.build_convert and not self.options.build_ifcgeom:
raise ConanInvalidConfiguration("build_convert requires build_ifcgeom to be enabled")

def requirements(self):
# Boost release fixed by cgal to avoid conflict
self.requires("boost/1.83.0", transitive_headers=True, transitive_libs=True)
if self.options.get_safe("with_hdf5"):
# Used in public serializers/HdfSerializer.h, ifcgeom/kernels/opencascade/IfcGeomTree.h
self.requires("hdf5/[^1.8]", transitive_headers=True, transitive_libs=True)
if self.options.build_ifcgeom:
self.requires("opencascade/[^7.8]", transitive_headers=True, transitive_libs=True)
# ifcgeom/taxonomy.h
self.requires("eigen/3.4.0", transitive_headers=True)
if self.options.get_safe("with_cgal"):
# Used in ifcgeom/kernels/cgal public headers
self.requires("cgal/5.6.3", transitive_headers=True, transitive_libs=True)
# TODO migrate cpp to be compatible with latest cgal to avoid compilation errors on src/src/ifcconvert/validate_space_boundaries.cpp:
# https://c3i.jfrog.io/artifactory/cci-build-logs/cci/prod/PR-27623/84/package_build_logs/build_log_ifcopenshell_0_8_3_cci_20250613_f8f37b5967ba18eef190cb0e92b6b561_9f5b6011d7ba49ff30af97cb4929b54a80903d97.txt
# self.requires("cgal/[>=5.6]", transitive_headers=True, transitive_libs=True)
if self.options.get_safe("with_cgal") or self.options.ifcxml_support:
self.requires("libxml2/[^2.12.5]")
if self.options.build_convert:
if self.options.build_convert_with_usd:
# See https://github.com/conan-io/conan-center-index/pull/24506
self.requires("openusd/[^25.02]")
if self.options.build_convert_with_proj:
self.requires("proj/[^9.6.0]")
if self.options.with_collada_support:
self.requires("opencollada/[^1.6.68]")
if self.options.build_qtviewer:
self.requires("qt/6.8.3")
self.requires("openscenegraph/3.6.5")

def build_requirements(self):
self.tool_requires("cmake/[>=3.21 <5]")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["SCHEMA_VERSIONS"] = ";".join(self._selected_ifc_schemas)

tc.cache_variables["BUILD_IFCGEOM"] = self.options.build_ifcgeom
tc.cache_variables["BUILD_GEOMSERVER"] = self.options.build_ifcgeomserver
tc.cache_variables["BUILD_CONVERT"] = self.options.build_convert
# validate_space_boundaries.cpp:106:57: error: no matching function for call to 'IfcEntityInstanceData::toString() const
# See https://c3i.jfrog.io/artifactory/cci-build-logs/cci/prod/PR-27623/86/package_build_logs/build_log_ifcopenshell_0_8_3_cci_20250613_855f5322a78c6ae836318b516e5c29ba_b8f0ca9f77a4d376fb7cb9ba9f229be5f13244f9.txt
# tc.cache_variables["WITH_RELATIONSHIP_VALIDATION"] = self.options.build_convert
tc.cache_variables["USD_SUPPORT"] = self.options.build_convert and self.options.build_convert_with_usd
tc.cache_variables["WITH_PROJ"] = self.options.build_convert and self.options.build_convert_with_proj
tc.cache_variables["IFCXML_SUPPORT"] = self.options.ifcxml_support
tc.cache_variables["USE_MMAP"] = self.options.use_mmap
tc.cache_variables["WITH_OPENCASCADE"] = self.options.build_ifcgeom
tc.cache_variables["WITH_CGAL"] = self.options.get_safe("with_cgal", False)
tc.cache_variables["HDF5_SUPPORT"] = self.options.get_safe("with_hdf5", False)
tc.cache_variables["COLLADA_SUPPORT"] = self.options.with_collada_support

tc.cache_variables["BUILD_QTVIEWER"] = self.options.build_qtviewer

tc.cache_variables["BUILD_IFCPYTHON"] = False
tc.cache_variables["BUILD_EXAMPLES"] = True

tc.generate()

deps = CMakeDeps(self)
deps.generate()

def build(self):
apply_conandata_patches(self)
rm(self, "*.cmake", os.path.join(self.source_folder, "cmake"))
cmake = CMake(self)
cmake.configure(build_script_folder="cmake")
# cmake.build()
cmake.build(cli_args=["--verbose"], build_tool_args=["-j", "2"])

def package(self):
copy(self, "COPYING*", self.source_folder, os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))


def package_info(self):
# No official CMake or .pc config exported. Based on CPack values for consistency.
self.cpp_info.set_property("cmake_file_name", "IfcOpenShell")

def _add_component(name, requires=None):
component = self.cpp_info.components[name]
component.set_property("cmake_target_name", name)
component.libs = [name]
component.requires = requires or []
return component

ifcparse = _add_component("IfcParse", requires=[
"boost::system",
"boost::program_options",
"boost::regex",
"boost::thread",
"boost::date_time",
])
if self.options.use_mmap:
ifcparse.requires.extend(["boost::iostreams", "boost::filesystem",])
ifcparse.defines.append("USE_MMAP")
if self.options.ifcxml_support:
ifcparse.requires.append("libxml2::libxml2")
ifcparse.defines.append("WITH_IFCXML")
ifcparse.defines.append(f"SCHEMA_SEQ=({')('.join(self._selected_ifc_schemas)})")
for schema in self._selected_ifc_schemas:
ifcparse.defines.append(f"HAS_SCHEMA_{schema}")
if self.options.shared:
ifcparse.defines.append("IFC_SHARED_BUILD")
if self.settings.os in ["Linux", "FreeBSD"]:
ifcparse.system_libs = ["m", "dl"]

if self.options.build_ifcgeom:
ifcgeom = _add_component("IfcGeom", requires=["IfcParse", "eigen::eigen"])
if self.settings.os in ["Linux", "FreeBSD"]:
ifcgeom.system_libs.append("pthread")
# When kernels, mappings and geometry_serializers are built as OBJECT target, we define conan dependencies directly to IfcGeom
if self.options.get_safe("with_cgal"):
# ifcgeom.requires.append("geometry_kernel_cgal")
ifcgeom.defines.append("IFOPSH_WITH_CGAL")
ifcgeom.requires += ["cgal::cgal", "eigen::eigen"]
ifcgeom.requires += [
"opencascade::occt_tkernel",
"opencascade::occt_tkmath",
"opencascade::occt_tkbrep",
"opencascade::occt_tkgeombase",
"opencascade::occt_tkgeomalgo",
"opencascade::occt_tkg3d",
"opencascade::occt_tkg2d",
"opencascade::occt_tkshhealing",
"opencascade::occt_tktopalgo",
"opencascade::occt_tkmesh",
"opencascade::occt_tkprim",
"opencascade::occt_tkbool",
"opencascade::occt_tkbo",
"opencascade::occt_tkfillet",
"opencascade::occt_tkxsbase",
"opencascade::occt_tkoffset",
"opencascade::occt_tkhlr",
"eigen::eigen",
]
ifcgeom.defines.append("IFOPSH_WITH_OPENCASCADE")
if self.options.with_hdf5:
ifcgeom.requires.append("hdf5::hdf5_cpp")

if self.options.build_convert:
serializers = _add_component("Serializers", requires=["IfcGeom"])
if self.options.with_hdf5:
serializers.requires.append("hdf5::hdf5_cpp")
if self.options.build_convert_with_usd:
serializers.requires.append("openusd::openusd")
if self.options.build_convert_with_proj:
serializers.requires.append("proj::proj")
if self.options.with_collada_support:
serializers.requires.append("opencollada::opencollada")
122 changes: 122 additions & 0 deletions recipes/ifcopenshell/all/patches/0001-Update-CMakeLists.txt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
From 28c543faaac76935b0666ee6ac38e44abf4efb85 Mon Sep 17 00:00:00 2001
From: Esteban DUGUEPEROUX <[email protected]>
Date: Tue, 23 Dec 2025 20:05:40 +0100
Subject: [PATCH] Update CMakeLists.txt

---
cmake/CMakeLists.txt | 37 +-----------------------------
src/ifcgeom/kernels/CMakeLists.txt | 4 ++--
src/svgfill/CMakeLists.txt | 2 +-
3 files changed, 4 insertions(+), 39 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 43b9ba891..fb7e782b8 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -54,9 +54,6 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()

-# Include utility macros and functions
-include(utilities.cmake)
-
# use extra version to make pre-release using eg semver
if(NOT DEFINED EXTRA_VERSION)
set(EXTRA_VERSION "-alpha.3")
@@ -198,22 +195,6 @@ if(BUILD_SHARED_LIBS)
endif()
endif()

-UNIFY_ENVVARS_AND_CACHE(BOOST_ROOT)
-
-if(NOT MINIMAL_BUILD)
- UNIFY_ENVVARS_AND_CACHE(PYTHON_INCLUDE_DIR)
- UNIFY_ENVVARS_AND_CACHE(PYTHON_LIBRARY)
- UNIFY_ENVVARS_AND_CACHE(PYTHON_EXECUTABLE)
-endif()
-
-# 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(BUILD_IFCGEOM AND WITH_OPENCASCADE)
find_package(OpenCASCADE REQUIRED)
add_definitions(-DIFOPSH_WITH_OPENCASCADE)
@@ -334,7 +315,7 @@ endif()
# Otherwise it will find components needed for CGAL and we might some libraries.
if(WITH_CGAL)
find_package(CGAL REQUIRED)
- set(CGAL_LIBRARIES IFCOPENSHELL_CGAL)
+ set(CGAL_LIBRARIES CGAL::CGAL)
list(APPEND GEOMETRY_KERNELS cgal)
endif()

@@ -680,18 +661,6 @@ if(BUILD_QTVIEWER)
add_subdirectory(../src/qtviewer qtviewer)
endif()

-# 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()
-
# Packaging
list(APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.git" "/build/" "/.pytest_cache/" "/__pycache__/")
set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR}/..;/")
@@ -734,7 +703,3 @@ set(CPACK_DEBIAN_PACKAGE_VERSION
)
set(CPACK_DEBIAN_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/debian/postinst")
-
-include(CPack)
-
-include(package_export.cmake)
diff --git a/src/ifcgeom/kernels/CMakeLists.txt b/src/ifcgeom/kernels/CMakeLists.txt
index c9c8c549c..245dc2dc0 100644
--- a/src/ifcgeom/kernels/CMakeLists.txt
+++ b/src/ifcgeom/kernels/CMakeLists.txt
@@ -23,7 +23,7 @@ foreach(kernel ${GEOMETRY_KERNELS})

if(${kernel} STREQUAL "cgal")
find_package(CGAL REQUIRED)
- target_link_libraries(${KERNEL_TARGET} IFCOPENSHELL_CGAL)
+ target_link_libraries(${KERNEL_TARGET} CGAL::CGAL)
set_property(TARGET ${KERNEL_TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS " -DCGAL_HAS_THREADS")

set(KERNEL_TARGET_SIMPLE "${KERNEL_TARGET}_simple")
@@ -34,7 +34,7 @@ foreach(kernel ${GEOMETRY_KERNELS})
)
list(APPEND kernel_libraries ${KERNEL_TARGET_SIMPLE})
target_link_libraries(${KERNEL_TARGET_SIMPLE} ${${KERNEL_UPPER}_LIBRARIES} Eigen3::Eigen)
- target_link_libraries(${KERNEL_TARGET_SIMPLE} IFCOPENSHELL_CGAL)
+ target_link_libraries(${KERNEL_TARGET_SIMPLE} CGAL::CGAL)
install(TARGETS ${KERNEL_TARGET_SIMPLE} EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
elseif(${kernel} STREQUAL "opencascade")
target_link_libraries(${KERNEL_TARGET} ${OpenCASCADE_LIBRARIES})
diff --git a/src/svgfill/CMakeLists.txt b/src/svgfill/CMakeLists.txt
index f2f8c1a06..9f2111d2b 100644
--- a/src/svgfill/CMakeLists.txt
+++ b/src/svgfill/CMakeLists.txt
@@ -42,7 +42,7 @@ file(GLOB LIB_H_FILES src/*.h)
file(GLOB LIB_CPP_FILES src/svgfill.cpp src/arrange_polygons.cpp)
set(LIB_SRC_FILES ${LIB_H_FILES} ${LIB_CPP_FILES})
add_library(svgfill ${LIB_SRC_FILES})
-target_link_libraries(svgfill ${Boost_LIBRARIES} ${BCRYPT_LIBRARIES} LibXml2::LibXml2 IFCOPENSHELL_CGAL)
+target_link_libraries(svgfill ${Boost_LIBRARIES} ${BCRYPT_LIBRARIES} LibXml2::LibXml2 CGAL::CGAL)
set_target_properties(svgfill PROPERTIES PUBLIC_HEADER "${LIB_H_FILES}")

add_executable(svgfill_exe src/main.cpp)
--
2.43.0

11 changes: 11 additions & 0 deletions recipes/ifcopenshell/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)

find_package(IfcOpenShell CONFIG REQUIRED)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE
IfcParse
# IfcGeom
# geometry_serializer
)
Loading