IfcConvert Plug-in discovery for info print

This commit is contained in:
Thomas Krijnen
2026-04-19 12:32:10 +02:00
parent 6ee05b646b
commit 9e19735275
25 changed files with 1423 additions and 53 deletions
+7 -7
View File
@@ -5,10 +5,10 @@ file(GLOB SERIALIZERS_H_FILES *.h)
file(GLOB SERIALIZERS_S_H_FILES schema_dependent/*.h)
function(add_document_serializer_plugin target output_name)
cmake_parse_arguments(PLUGIN "" "" "SOURCES;LIBRARIES" ${ARGN})
cmake_parse_arguments(PLUGIN "" "" "SOURCES;LIBRARIES;DEFINITIONS" ${ARGN})
add_library(${target} SHARED ${PLUGIN_SOURCES})
target_compile_definitions(${target} PRIVATE SERIALIZERS_EXPORTS BOOST_DLL_USE_STD_FS)
target_compile_definitions(${target} PRIVATE SERIALIZERS_EXPORTS BOOST_DLL_USE_STD_FS ${PLUGIN_DEFINITIONS})
target_link_libraries(${target} PRIVATE plugin IfcGeom IfcParse ${PLUGIN_LIBRARIES})
set_target_properties(${target} PROPERTIES
OUTPUT_NAME "${output_name}"
@@ -21,10 +21,10 @@ function(add_document_serializer_plugin target output_name)
endfunction()
function(add_geometry_serializer_plugin target output_name)
cmake_parse_arguments(PLUGIN "" "" "SOURCES;LIBRARIES" ${ARGN})
cmake_parse_arguments(PLUGIN "" "" "SOURCES;LIBRARIES;DEFINITIONS" ${ARGN})
add_library(${target} SHARED ${PLUGIN_SOURCES})
target_compile_definitions(${target} PRIVATE SERIALIZERS_EXPORTS BOOST_DLL_USE_STD_FS)
target_compile_definitions(${target} PRIVATE SERIALIZERS_EXPORTS BOOST_DLL_USE_STD_FS ${PLUGIN_DEFINITIONS})
target_link_libraries(${target} PRIVATE plugin IfcGeom IfcParse ${PLUGIN_LIBRARIES})
if(WITH_PROJ)
find_package(proj REQUIRED)
@@ -59,15 +59,15 @@ add_geometry_serializer_plugin(geometry_serializer_obj "geometry.obj" SOURCES ge
add_geometry_serializer_plugin(geometry_serializer_ttl "geometry.ttl" SOURCES geometry_ttl_plugin.cpp TtlWktSerializer.cpp LIBRARIES ${ttl_geometry_serializer_libraries})
if(OPENCOLLADA_FOUND)
add_geometry_serializer_plugin(geometry_serializer_dae "geometry.dae" SOURCES geometry_dae_plugin.cpp ColladaSerializer.cpp LIBRARIES ${OPENCOLLADA_LIBRARIES})
add_geometry_serializer_plugin(geometry_serializer_dae "geometry.dae" SOURCES geometry_dae_plugin.cpp ColladaSerializer.cpp LIBRARIES OpenCOLLADA::OpenCOLLADA DEFINITIONS WITH_OPENCOLLADA)
endif()
if(GLTF_SUPPORT)
add_geometry_serializer_plugin(geometry_serializer_glb "geometry.glb" SOURCES geometry_glb_plugin.cpp GltfSerializer.cpp)
add_geometry_serializer_plugin(geometry_serializer_glb "geometry.glb" SOURCES geometry_glb_plugin.cpp GltfSerializer.cpp LIBRARIES nlohmann_json::nlohmann_json DEFINITIONS WITH_GLTF)
endif()
if(USD_SUPPORT)
add_geometry_serializer_plugin(geometry_serializer_usd "geometry.usd" SOURCES geometry_usd_plugin.cpp USDSerializer.cpp LIBRARIES ${USD_LIBRARIES})
add_geometry_serializer_plugin(geometry_serializer_usd "geometry.usd" SOURCES geometry_usd_plugin.cpp USDSerializer.cpp LIBRARIES pxr::USD)
endif()
if(WITH_OPENCASCADE)
+2
View File
@@ -51,6 +51,8 @@ plugin::metadata plugin_metadata() {
void register_plugin(document_serializer_registry& registry, const plugin::module& module) {
document_serializer_info info;
info.format = "rdb";
info.name = "RocksDB";
info.description = "RocksDB key-value store serialization of IFC data.";
info.supports_ifc_file = false;
info.supports_input_filename = true;
info.writes_final_output = true;
@@ -65,6 +65,12 @@ void ifcopenshell::serializers::document_serializer_registry::bind(const documen
entry entry;
entry.info_ = info;
entry.info_.format = document_serializer_key(entry.info_.format);
if (entry.info_.name.empty() && !entry.info_.format.empty()) {
entry.info_.name = boost::to_upper_copy(entry.info_.format);
}
if (entry.info_.description.empty()) {
entry.info_.description = entry.info_.name;
}
entry.info_.schema_name = document_serializer_schema_key(entry.info_.schema_name);
entry.create_ = create;
entry.module_ = module.meta().id.empty() ? plugin::module(document_serializer_plugin_metadata(entry.info_.format, entry.info_.schema_name)) : module;
@@ -38,6 +38,8 @@ namespace serializers {
struct SERIALIZERS_API document_serializer_info {
std::string format;
std::string name;
std::string description;
std::string schema_name;
bool supports_ifc_file = true;
bool supports_input_filename = false;
+2
View File
@@ -44,6 +44,8 @@ boost::shared_ptr<GeometrySerializer> create_serializer(const geometry_serialize
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
geometry_serializer_info info;
info.format = "dae";
info.name = "Collada";
info.description = "Digital Assets Exchange.";
info.extensions = { ".dae" };
info.supports_triangulation = true;
info.supports_user_element_hierarchy = true;
+2
View File
@@ -44,6 +44,8 @@ boost::shared_ptr<GeometrySerializer> create_serializer(const geometry_serialize
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
geometry_serializer_info info;
info.format = "glb";
info.name = "glTF";
info.description = "Binary glTF v2.0.";
info.extensions = { ".glb" };
info.supports_triangulation = true;
info.supports_user_element_hierarchy = true;
+2
View File
@@ -48,6 +48,8 @@ void configure_serializer(geometry_serializer_context& context) {
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
geometry_serializer_info info;
info.format = "hdf";
info.name = "HDF";
info.description = "Hierarchical Data Format storing positions, normals and indices.";
info.extensions = { ".h5" };
info.kernel_ids = { "opencascade" };
info.supports_triangulation = true;
+2
View File
@@ -58,6 +58,8 @@ void configure_serializer(geometry_serializer_context& context) {
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
geometry_serializer_info info;
info.format = "igs";
info.name = "IGES";
info.description = "Initial Graphics Exchange Specification.";
info.extensions = { ".igs" };
info.kernel_ids = { "opencascade" };
info.supports_brep = true;
+2
View File
@@ -60,6 +60,8 @@ void configure_serializer(geometry_serializer_context& context) {
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
geometry_serializer_info info;
info.format = "obj";
info.name = "WaveFront OBJ";
info.description = "A .mtl file is also created.";
info.extensions = { ".obj" };
info.supports_triangulation = true;
registry.bind(info, create_serializer, configure_serializer, module);
@@ -59,6 +59,12 @@ void ifcopenshell::serializers::geometry_serializer_registry::bind(const geometr
entry entry;
entry.info_ = info;
entry.info_.format = boost::to_lower_copy(entry.info_.format);
if (entry.info_.name.empty() && !entry.info_.format.empty()) {
entry.info_.name = boost::to_upper_copy(entry.info_.format);
}
if (entry.info_.description.empty()) {
entry.info_.description = entry.info_.name;
}
entry.create_ = create;
entry.configure_ = configure;
entry.module_ = module.meta().id.empty() ? plugin::module(geometry_serializer_plugin_metadata(entry.info_.format)) : module;
@@ -37,6 +37,8 @@ namespace serializers {
struct SERIALIZERS_API geometry_serializer_info {
std::string format;
std::string name;
std::string description;
std::vector<std::string> extensions;
std::vector<std::string> kernel_ids;
bool supports_triangulation = false;
+2
View File
@@ -49,6 +49,8 @@ void configure_serializer(geometry_serializer_context& context) {
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
geometry_serializer_info info;
info.format = "stp";
info.name = "STEP";
info.description = "Standard for the Exchange of Product Data.";
info.extensions = { ".stp" };
info.kernel_ids = { "opencascade" };
info.supports_brep = true;
+2
View File
@@ -49,6 +49,8 @@ void configure_serializer(geometry_serializer_context& context) {
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
geometry_serializer_info info;
info.format = "svg";
info.name = "SVG";
info.description = "Scalable Vector Graphics (2D floor plan).";
info.extensions = { ".svg" };
info.kernel_ids = { "opencascade" };
info.supports_brep = true;
+2
View File
@@ -49,6 +49,8 @@ void configure_serializer(geometry_serializer_context& context) {
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
geometry_serializer_info info;
info.format = "ttl";
info.name = "TTL/WKT";
info.description = "RDF Turtle with Well-Known Text geometry.";
info.extensions = { ".ttl" };
info.supports_triangulation = true;
info.supports_brep = true;
+2
View File
@@ -44,6 +44,8 @@ boost::shared_ptr<GeometrySerializer> create_serializer(const geometry_serialize
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
geometry_serializer_info info;
info.format = "usd";
info.name = "USD";
info.description = "Universal Scene Description.";
info.extensions = { ".usd", ".usda", ".usdc" };
info.supports_triangulation = true;
info.supports_user_element_hierarchy = true;
@@ -3,7 +3,7 @@ foreach(schema ${SCHEMA_VERSIONS})
target_compile_definitions(document_serializer_xml_ifc${schema} PRIVATE IfcSchema=Ifc${schema})
if(GLTF_SUPPORT)
add_document_serializer_plugin(document_serializer_json_ifc${schema} "document.json.ifc${schema}" SOURCES JsonSerializer.cpp json_plugin.cpp)
add_document_serializer_plugin(document_serializer_json_ifc${schema} "document.json.ifc${schema}" SOURCES JsonSerializer.cpp json_plugin.cpp LIBRARIES nlohmann_json::nlohmann_json DEFINITIONS WITH_GLTF)
target_compile_definitions(document_serializer_json_ifc${schema} PRIVATE IfcSchema=Ifc${schema})
endif()
endforeach()
@@ -53,6 +53,8 @@ plugin::metadata plugin_metadata() {
void register_plugin(document_serializer_registry& registry, const plugin::module& module) {
document_serializer_info info;
info.format = "json";
info.name = "JSON";
info.description = "Property definitions and decomposition tree in xeokit JSON format.";
info.schema_name = STRINGIFY(IfcSchema);
registry.bind(info, create_serializer, module);
}
@@ -48,6 +48,8 @@ plugin::metadata plugin_metadata() {
void register_plugin(document_serializer_registry& registry, const plugin::module& module) {
document_serializer_info info;
info.format = "xml";
info.name = "XML";
info.description = "Property definitions and decomposition tree.";
info.schema_name = STRINGIFY(IfcSchema);
registry.bind(info, create_serializer, module);
}