Some plug-in work

This commit is contained in:
Thomas Krijnen
2026-04-21 16:18:59 +02:00
parent 325db2e57f
commit b022ca7e70
8 changed files with 50 additions and 151 deletions
+1
View File
@@ -60,6 +60,7 @@ option(MSVC_PARALLEL_BUILD "Multi-threaded compilation in Microsoft Visual Studi
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)
option(CREATE_BUNDLE "Copy .so files and don't create RPATHS or SOVERSION symlinks" )
option(BUILD_IFCGEOM "Build IfcGeom." ON)
option(BUILD_IFCPYTHON "Build IfcPython." ON)
+1 -1
View File
@@ -1,7 +1,7 @@
# IfcConvert
add_executable(IfcConvert IfcConvert.cpp)
target_link_libraries(IfcConvert PRIVATE IfcGeom IfcParse ${OpenCASCADE_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(IfcConvert PRIVATE IfcGeom IfcParse ${Boost_LIBRARIES})
if(kernel_libraries OR mapping_libraries OR geometry_serializer_libraries OR document_serializer_libraries)
add_dependencies(IfcConvert ${kernel_libraries} ${mapping_libraries} ${geometry_serializer_libraries} ${document_serializer_libraries})
endif()
+2 -11
View File
@@ -40,12 +40,6 @@
#include "../ifcparse/utils.h"
#ifdef IFOPSH_WITH_OPENCASCADE
#include <Standard_Version.hxx>
#endif
#include <boost/program_options.hpp>
#include <boost/optional/optional_io.hpp>
#include <boost/make_shared.hpp>
@@ -174,11 +168,8 @@ std::vector<serializer_usage_line> document_serializer_usage_lines() {
void print_version()
{
cout_ << "IfcOpenShell IfcConvert " << IFCOPENSHELL_VERSION;
#ifdef IFOPSH_WITH_OPENCASCADE
cout_ << " (OCC " << OCC_VERSION_STRING_EXT << ")";
#endif
cout_ << "\n";
// @todo print plug-in versions
cout_ << "IfcOpenShell IfcConvert " << IFCOPENSHELL_VERSION << "\n";
}
void print_usage(bool suggest_help = true)
+4 -1
View File
@@ -12,7 +12,10 @@ set(SCHEMA_AGNOSTIC_FILES ${SCHEMA_AGNOSTIC_H_FILES} ${SCHEMA_AGNOSTIC_CPP_FILES
add_library(IfcGeom ${SCHEMA_AGNOSTIC_FILES})
add_library(geometry ALIAS IfcGeom)
set_target_properties(IfcGeom PROPERTIES COMPILE_FLAGS -DIFC_GEOM_EXPORTS VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
set_target_properties(IfcGeom PROPERTIES COMPILE_FLAGS -DIFC_GEOM_EXPORTS)
if (NOT CREATE_BUNDLE)
set_target_properties(IfcGeom PROPERTIES VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
endif()
target_compile_definitions(IfcGeom PRIVATE BOOST_DLL_USE_STD_FS SERIALIZERS_EXPORTS)
if(WITH_CGAL)
target_compile_definitions(IfcGeom PUBLIC IFOPSH_WITH_CGAL)
+4 -2
View File
@@ -43,8 +43,10 @@ if(WITH_ROCKSDB)
target_compile_definitions(IfcParse PUBLIC IFOPSH_WITH_ROCKSDB)
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_ROCKSDB PARENT_SCOPE)
endif()
set_target_properties(IfcParse PROPERTIES COMPILE_FLAGS -DIFC_PARSE_EXPORTS VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
set_target_properties(IfcParse PROPERTIES COMPILE_FLAGS -DIFC_PARSE_EXPORTS)
if (NOT CREATE_BUNDLE)
set_target_properties(IfcParse PROPERTIES VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
endif()
if(WASM_BUILD)
target_link_libraries(IfcParse plugin ${BCRYPT_LIBRARIES})
else()
+31 -12
View File
@@ -120,6 +120,10 @@ else()
endif()
target_link_libraries(ifcopenshell_wrapper PRIVATE Python::Module)
if(WITH_ROCKSDB)
message(STATUS TK)
target_link_libraries(ifcopenshell_wrapper PRIVATE document_serializer_rdb)
endif()
SET_PROPERTY(TARGET ifcopenshell_wrapper PROPERTY SWIG_DEPENDS ${IFCOPENSHELL_LIBRARIES})
if (WASM_BUILD)
# SIDE_MODULE=1 - add to .so all symbols from linked archives (default used by pyodide).
@@ -141,18 +145,7 @@ if (WASM_BUILD)
PRIVATE "SHELL:-s EXPORTED_FUNCTIONS=_PyInit__ifcopenshell_wrapper -s SIDE_MODULE=2"
)
endif()
if("$ENV{LDFLAGS}" MATCHES ".undefined.suppress")
# On osx there is some state in the python dylib. With `-Wl,undefined,suppress` we can ignore the missing symbols at compile time.
target_link_libraries(ifcopenshell_wrapper PRIVATE ${IFCOPENSHELL_LIBRARIES} ${OpenCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${LIBSVGFILL})
else()
target_link_libraries(ifcopenshell_wrapper PRIVATE ${IFCOPENSHELL_LIBRARIES} ${LIBSVGFILL})
endif()
if(geometry_serializer_libraries)
target_link_libraries(ifcopenshell_wrapper PRIVATE ${geometry_serializer_libraries})
endif()
if(TARGET document_serializer_rdb)
target_link_libraries(ifcopenshell_wrapper PRIVATE document_serializer_rdb)
endif()
target_link_libraries(ifcopenshell_wrapper PRIVATE IfcGeom IfcParse ${Boost_LIBRARIES} ${LIBSVGFILL})
if(kernel_libraries OR tree_libraries OR mapping_libraries OR geometry_serializer_libraries OR document_serializer_libraries)
add_dependencies(ifcopenshell_wrapper ${kernel_libraries} ${tree_libraries} ${mapping_libraries} ${geometry_serializer_libraries} ${document_serializer_libraries})
endif()
@@ -218,6 +211,32 @@ IF(Python_Interpreter_FOUND OR PYTHON_MODULE_INSTALL_DIR)
DESTINATION "${python_package_dir}/ifcopenshell")
INSTALL(TARGETS ifcopenshell_wrapper
DESTINATION "${python_package_dir}/ifcopenshell")
if (CREATE_BUNDLE)
set(_ifcopenshell_python_runtime_targets
IfcGeom
IfcParse
${kernel_libraries}
${tree_libraries}
${mapping_libraries}
${geometry_serializer_libraries}
${document_serializer_libraries}
)
list(REMOVE_DUPLICATES _ifcopenshell_python_runtime_targets)
if(_ifcopenshell_python_runtime_targets)
INSTALL(TARGETS ${_ifcopenshell_python_runtime_targets}
LIBRARY DESTINATION "${python_package_dir}/ifcopenshell"
RUNTIME DESTINATION "${python_package_dir}/ifcopenshell")
endif()
if(NOT WIN32 AND NOT WASM_BUILD)
set_target_properties(ifcopenshell_wrapper PROPERTIES
INSTALL_RPATH "$ORIGIN"
)
endif()
endif()
if (MSVC)
INSTALL(FILES $<TARGET_PDB_FILE:ifcopenshell_wrapper> DESTINATION bin OPTIONAL)
endif()
+1 -34
View File
@@ -265,15 +265,6 @@ namespace {
%include "../ifcgeom/taxonomy.h"
%include "../ifcgeom/function_item_evaluator.h"
%include "../serializers/SvgSerializer.h"
%include "../serializers/HdfSerializer.h"
%include "../serializers/WavefrontObjSerializer.h"
%include "../serializers/ColladaSerializer.h"
%include "../serializers/XmlSerializer.h"
%include "../serializers/GltfSerializer.h"
%include "../serializers/TtlWktSerializer.h"
%include "../serializers/JsonSerializer.h"
%extend ifcopenshell::geometry::taxonomy::style {
size_t instance_id() const {
if (!self->instance) {
@@ -916,31 +907,7 @@ ifcopenshell::geometry::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type
}
%}
#ifdef IFOPSH_WITH_OPENCASCADE
%inline %{
#include <BRepTools_ShapeSet.hxx>
express::Base serialise(ifcopenshell::file& f, const std::string& shape_str, bool advanced=true) {
std::stringstream stream(shape_str);
BRepTools_ShapeSet shapes;
shapes.Read(stream);
const TopoDS_Shape& shp = shapes.Shape(shapes.NbShapes());
return IfcGeom::serialise(f, shp, advanced);
}
express::Base tesselate(ifcopenshell::file& f, const std::string& shape_str, double d) {
std::stringstream stream(shape_str);
BRepTools_ShapeSet shapes;
shapes.Read(stream);
const TopoDS_Shape& shp = shapes.Shape(shapes.NbShapes());
return IfcGeom::tesselate(f, shp, d);
}
%}
#endif
// @todo bring back serialization OCCT -> IFC by means of opencascade_geometry_ifc_writer_registry
%template(OpaqueCoordinate_3) IfcGeom::OpaqueCoordinate<3>;
%template(OpaqueCoordinate_4) IfcGeom::OpaqueCoordinate<4>;
+6 -90
View File
@@ -198,49 +198,6 @@
#include "../ifcgeom/taxonomy.h"
#include "../ifcgeom/function_item_evaluator.h"
#include "../serializers/SvgSerializer.h"
#include "../serializers/WavefrontObjSerializer.h"
#include "../serializers/ColladaSerializer.h"
#include "../serializers/HdfSerializer.h"
#include "../serializers/RocksDbSerializer.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/schemas/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/schemas/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/schemas/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/schemas/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/schemas/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/schemas/Ifc4x3_rc2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc3
#include "../ifcparse/schemas/Ifc4x3_rc3.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc4
#include "../ifcparse/schemas/Ifc4x3_rc4.h"
#endif
#ifdef HAS_SCHEMA_4x3
#include "../ifcparse/schemas/Ifc4x3.h"
#endif
#ifdef HAS_SCHEMA_4x3_tc1
#include "../ifcparse/schemas/Ifc4x3_tc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_add1
#include "../ifcparse/schemas/Ifc4x3_add1.h"
#endif
#ifdef HAS_SCHEMA_4x3_add2
#include "../ifcparse/schemas/Ifc4x3_add2.h"
#endif
#include "../ifcparse/express.h"
#include "../ifcparse/file.h"
#include "../ifcparse/schema.h"
@@ -250,6 +207,9 @@
#include "../ifcgeom/ConversionResult.h"
#include "../svgfill/src/svgfill.h"
// @todo abstract into plug-in interface
#include "../serializers/RocksDbSerializer.h"
%}
// Create docstrings for generated python code.
@@ -271,53 +231,6 @@
#include "../ifcgeom/ConversionResult.h"
#include "../ifcgeom/hybrid_kernel.h"
#include "../serializers/SvgSerializer.h"
#include "../serializers/WavefrontObjSerializer.h"
#include "../serializers/ColladaSerializer.h"
#include "../serializers/HdfSerializer.h"
#include "../serializers/XmlSerializer.h"
#include "../serializers/GltfSerializer.h"
#include "../serializers/TtlWktSerializer.h"
#include "../serializers/RocksDbSerializer.h"
#include "../serializers/JsonSerializer.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/schemas/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/schemas/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/schemas/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/schemas/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/schemas/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/schemas/Ifc4x3_rc2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc3
#include "../ifcparse/schemas/Ifc4x3_rc3.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc4
#include "../ifcparse/schemas/Ifc4x3_rc4.h"
#endif
#ifdef HAS_SCHEMA_4x3
#include "../ifcparse/schemas/Ifc4x3.h"
#endif
#ifdef HAS_SCHEMA_4x3_tc1
#include "../ifcparse/schemas/Ifc4x3_tc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_add1
#include "../ifcparse/schemas/Ifc4x3_add1.h"
#endif
#ifdef HAS_SCHEMA_4x3_add2
#include "../ifcparse/schemas/Ifc4x3_add2.h"
#endif
#include "../ifcparse/express.h"
#include "../ifcparse/file.h"
#include "../ifcparse/schema.h"
@@ -327,6 +240,9 @@
#include "../ifcgeom/ConversionResult.h"
#include "../svgfill/src/svgfill.h"
// @todo abstract into plug-in interface
#include "../serializers/RocksDbSerializer.h"
%}
%include "IfcGeomWrapper.i"