mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Cmake install config fixes
This commit is contained in:
+10
-1
@@ -208,6 +208,8 @@ endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(IFCOPENSHELL_EXPORT_TARGETS "${PROJECT_NAME}Targets")
|
||||
|
||||
if(NOT INCLUDEDIR)
|
||||
set(INCLUDEDIR include)
|
||||
endif()
|
||||
@@ -317,6 +319,8 @@ if (WITH_ROCKSDB)
|
||||
find_package(zstd CONFIG REQUIRED)
|
||||
message(STATUS "zstd: found at '${zstd_DIR}'.")
|
||||
endif()
|
||||
|
||||
install(TARGETS IFCOPENSHELL_RocksDB EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
endif()
|
||||
|
||||
# Find Boost: On win32 the (hardcoded) default is to use static libraries and
|
||||
@@ -734,7 +738,10 @@ if(BUILD_IFCGEOM)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
install(TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} ${kernel_libraries} IfcGeom)
|
||||
install(
|
||||
TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} ${kernel_libraries} IfcGeom
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
)
|
||||
endif(BUILD_IFCGEOM)
|
||||
if(BUILD_BONSAIVIEWER)
|
||||
# IfcViewer is the unified scene + render lib since the wgpu/ifcviewer
|
||||
@@ -797,3 +804,5 @@ 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)
|
||||
|
||||
@@ -75,8 +75,14 @@ macro(build_example exe_name)
|
||||
endmacro()
|
||||
|
||||
macro(build_schema_example exe_name schema)
|
||||
build_example(${exe_name} ${ARGN})
|
||||
if(NOT STANDALONE_PROJECT)
|
||||
build_example(${exe_name} ${schema} ${ARGN})
|
||||
if(STANDALONE_PROJECT)
|
||||
target_link_libraries(${exe_name} IfcOpenShell::parse_schema_ifc${schema})
|
||||
target_compile_definitions(
|
||||
${exe_name}
|
||||
PRIVATE IFCOPENSHELL_EXAMPLE_PLUGIN_PATH="$<TARGET_FILE_DIR:IfcOpenShell::parse_schema_ifc${schema}>"
|
||||
)
|
||||
else()
|
||||
target_link_libraries(${exe_name} parse_schema_ifc${schema})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
|
||||
|
||||
#include "ifcparse/hierarchy_helper.h"
|
||||
#include "plugin/plugin.h"
|
||||
|
||||
#include "../ifcgeom/Serialization/Serialization.h"
|
||||
|
||||
@@ -62,6 +63,10 @@ void createGroundShape(TopoDS_Shape& shape);
|
||||
|
||||
int main() {
|
||||
|
||||
#ifdef IFCOPENSHELL_EXAMPLE_PLUGIN_PATH
|
||||
ifcopenshell::plugin::set_search_paths({IFCOPENSHELL_EXAMPLE_PLUGIN_PATH});
|
||||
#endif
|
||||
|
||||
// The hierarchy_helper is a subclass of the regular file that provides several
|
||||
// convenience functions for working with geometry in IFC files.
|
||||
hierarchy_helper<IfcSchema> file;
|
||||
@@ -99,8 +104,8 @@ int main() {
|
||||
auto building_shape = IfcGeom::serialise(file, building_shell, false).as<IfcSchema::IfcProductDefinitionShape>();
|
||||
|
||||
file.add_entity(building_shape);
|
||||
auto rep = building_shape.Representations().begin();
|
||||
rep->setContextOfItems(file.getRepresentationContext("model"));
|
||||
auto building_representations = building_shape.Representations();
|
||||
building_representations.front().setContextOfItems(file.getRepresentationContext("model"));
|
||||
|
||||
building.setRepresentation(building_shape);
|
||||
|
||||
|
||||
@@ -39,4 +39,4 @@ if((NOT WIN32) AND BUILD_SHARED_LIBS AND NOT WASM_BUILD AND NOT CREATE_BUNDLE AN
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(TARGETS IfcConvert)
|
||||
install(TARGETS IfcConvert EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
|
||||
@@ -14,6 +14,10 @@ add_library(IfcGeom ${SCHEMA_AGNOSTIC_FILES})
|
||||
set_target_properties(IfcGeom PROPERTIES
|
||||
OUTPUT_NAME "ifcopenshell.geometry"
|
||||
)
|
||||
target_include_directories(IfcGeom PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
if((NOT WIN32) AND BUILD_SHARED_LIBS AND NOT WASM_BUILD AND NOT CREATE_BUNDLE AND NOT CMAKE_INSTALL_RPATH AND COMMAND SET_INSTALL_SELF_RPATH)
|
||||
SET_INSTALL_SELF_RPATH(IfcGeom)
|
||||
|
||||
@@ -3,6 +3,13 @@ set(geometry_serialization_plugin_runtime_dir "${CMAKE_CURRENT_BINARY_DIR}/$<CON
|
||||
add_subdirectory(schema)
|
||||
|
||||
add_library(geometry_serializer Serialization.cpp opencascade_geometry_ifc_writer_plugin.cpp)
|
||||
target_include_directories(geometry_serializer PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../..>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
if((NOT WIN32) AND BUILD_SHARED_LIBS AND NOT WASM_BUILD AND NOT CREATE_BUNDLE AND NOT CMAKE_INSTALL_RPATH AND COMMAND SET_INSTALL_SELF_RPATH)
|
||||
SET_INSTALL_SELF_RPATH(geometry_serializer)
|
||||
endif()
|
||||
set_target_properties(geometry_serializer PROPERTIES
|
||||
OUTPUT_NAME "ifcopenshell.geometry.writer"
|
||||
COMPILE_FLAGS "-DIFC_GEOMSERIALIZATION_EXPORTS"
|
||||
@@ -18,6 +25,9 @@ install(FILES Serialization.h
|
||||
DESTINATION ${INCLUDEDIR}/ifcgeom/Serialization
|
||||
)
|
||||
|
||||
install(TARGETS geometry_serializer ${geometry_serializer_libraries})
|
||||
install(
|
||||
TARGETS geometry_serializer ${geometry_serializer_libraries}
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
)
|
||||
|
||||
set(geometry_serializer_libraries ${geometry_serializer_libraries} PARENT_SCOPE)
|
||||
|
||||
@@ -28,7 +28,7 @@ PLUGIN_API std::filesystem::path add_search_paths_or_default(manager& manager, s
|
||||
}
|
||||
|
||||
namespace {
|
||||
constexpr const char* opencascade_geometry_ifc_writer_plugin_prefix = "geometry.serialization.";
|
||||
constexpr const char* opencascade_geometry_ifc_writer_plugin_prefix = "geometry.writer.";
|
||||
}
|
||||
|
||||
const char* IfcGeom::opencascade_geometry_ifc_writer_plugin_registration_symbol() {
|
||||
|
||||
@@ -22,6 +22,9 @@ foreach(kernel ${GEOMETRY_KERNELS})
|
||||
|
||||
set(KERNEL_TARGET "geometry_kernel_${kernel}")
|
||||
add_library(${KERNEL_TARGET} SHARED ${IFCGEOM_FILES})
|
||||
if((NOT WIN32) AND NOT WASM_BUILD AND NOT CREATE_BUNDLE AND NOT CMAKE_INSTALL_RPATH AND COMMAND SET_INSTALL_SELF_RPATH)
|
||||
SET_INSTALL_SELF_RPATH(${KERNEL_TARGET})
|
||||
endif()
|
||||
|
||||
if(${kernel} STREQUAL "opencascade")
|
||||
ifcopenshell_wasm_plugin_link_options(${KERNEL_TARGET} ifcopenshell_register_kernel_plugin_v1 OPTIMIZATION -O0)
|
||||
@@ -45,6 +48,9 @@ foreach(kernel ${GEOMETRY_KERNELS})
|
||||
|
||||
set(KERNEL_TARGET_SIMPLE "${KERNEL_TARGET}_simple")
|
||||
add_library(${KERNEL_TARGET_SIMPLE} SHARED ${IFCGEOM_FILES})
|
||||
if((NOT WIN32) AND NOT CREATE_BUNDLE AND NOT CMAKE_INSTALL_RPATH AND COMMAND SET_INSTALL_SELF_RPATH)
|
||||
SET_INSTALL_SELF_RPATH(${KERNEL_TARGET_SIMPLE})
|
||||
endif()
|
||||
|
||||
ifcopenshell_wasm_plugin_link_options(${KERNEL_TARGET_SIMPLE} ifcopenshell_register_kernel_plugin_v1)
|
||||
|
||||
@@ -74,6 +80,9 @@ foreach(kernel ${GEOMETRY_KERNELS})
|
||||
${kernel}/tree_${tree_backend}_plugin.cpp
|
||||
${kernel}/tree_backends.h
|
||||
)
|
||||
if((NOT WIN32) AND NOT CREATE_BUNDLE AND NOT CMAKE_INSTALL_RPATH AND COMMAND SET_INSTALL_SELF_RPATH)
|
||||
SET_INSTALL_SELF_RPATH(${TREE_TARGET})
|
||||
endif()
|
||||
set_target_properties(${TREE_TARGET} PROPERTIES
|
||||
COMPILE_FLAGS "-DIFC_GEOMLIBRARY_EXPORTS"
|
||||
OUTPUT_NAME "ifcopenshell.geometry.tree.opencascade.${tree_backend}"
|
||||
|
||||
@@ -37,7 +37,7 @@ foreach(schema ${SCHEMA_VERSIONS})
|
||||
|
||||
list(APPEND mapping_libraries geometry_mapping_ifc${schema})
|
||||
|
||||
install(TARGETS geometry_mapping_ifc${schema})
|
||||
install(TARGETS geometry_mapping_ifc${schema} EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
endforeach()
|
||||
|
||||
set(mapping_libraries ${mapping_libraries} PARENT_SCOPE)
|
||||
|
||||
@@ -18,13 +18,13 @@ list(REMOVE_ITEM IFCPARSE_CPP_FILES
|
||||
|
||||
message(STATUS "SCHEMA_VERSIONS from ifcparse: ${SCHEMA_VERSIONS}")
|
||||
foreach(schema ${SCHEMA_VERSIONS})
|
||||
list(APPEND IFCPARSE_H_FILES
|
||||
list(APPEND IFCPARSE_SCHEMA_H_FILES
|
||||
schemas/Ifc${schema}.h
|
||||
schemas/Ifc${schema}-definitions.h
|
||||
)
|
||||
endforeach()
|
||||
|
||||
list(APPEND IFCPARSE_H_FILES
|
||||
list(APPEND IFCPARSE_SCHEMA_H_FILES
|
||||
schemas/Header_section_schema.h
|
||||
)
|
||||
list(APPEND IFCPARSE_CPP_FILES
|
||||
@@ -32,12 +32,16 @@ list(APPEND IFCPARSE_CPP_FILES
|
||||
schemas/Header_section_schema-schema.cpp
|
||||
)
|
||||
|
||||
set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES})
|
||||
set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES} ${IFCPARSE_SCHEMA_H_FILES})
|
||||
|
||||
add_library(IfcParse ${IFCPARSE_FILES})
|
||||
set_target_properties(IfcParse PROPERTIES
|
||||
OUTPUT_NAME "ifcopenshell.parse"
|
||||
)
|
||||
target_include_directories(IfcParse PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
if((NOT WIN32) AND BUILD_SHARED_LIBS AND NOT WASM_BUILD AND NOT CREATE_BUNDLE AND NOT CMAKE_INSTALL_RPATH AND COMMAND SET_INSTALL_SELF_RPATH)
|
||||
SET_INSTALL_SELF_RPATH(IfcParse)
|
||||
@@ -107,6 +111,13 @@ install(FILES ${IFCPARSE_H_FILES}
|
||||
DESTINATION ${INCLUDEDIR}/ifcparse
|
||||
)
|
||||
|
||||
install(TARGETS IfcParse ${schema_libraries})
|
||||
install(FILES ${IFCPARSE_SCHEMA_H_FILES}
|
||||
DESTINATION ${INCLUDEDIR}/ifcparse/schemas
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS IfcParse ${schema_libraries}
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
)
|
||||
|
||||
set(schema_libraries ${schema_libraries} PARENT_SCOPE)
|
||||
|
||||
@@ -5,6 +5,10 @@ add_library(plugin ${PLUGIN_CPP_FILES} ${PLUGIN_H_FILES})
|
||||
set_target_properties(plugin PROPERTIES
|
||||
OUTPUT_NAME "ifcopenshell.plugin"
|
||||
COMPILE_FLAGS "-DPLUGIN_EXPORTS")
|
||||
target_include_directories(plugin PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
if (NOT CREATE_BUNDLE)
|
||||
set_target_properties(plugin PROPERTIES
|
||||
@@ -20,7 +24,7 @@ target_compile_definitions(plugin PRIVATE
|
||||
|
||||
target_link_libraries(plugin PRIVATE ${Boost_LIBRARIES})
|
||||
|
||||
install(TARGETS plugin)
|
||||
install(TARGETS plugin EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
|
||||
install(FILES ${PLUGIN_H_FILES}
|
||||
DESTINATION ${INCLUDEDIR}/plugin
|
||||
|
||||
@@ -153,9 +153,6 @@ namespace {
|
||||
|
||||
namespace ifcopenshell {
|
||||
namespace plugin {
|
||||
PLUGIN_API void set_search_paths(const std::vector<std::string>& paths);
|
||||
PLUGIN_API std::vector<std::string> search_paths();
|
||||
PLUGIN_API void clear_search_paths();
|
||||
PLUGIN_API std::filesystem::path add_search_paths_or_default(manager& manager, std::filesystem::path (*default_search_path)());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,9 @@ private:
|
||||
PLUGIN_API abi_info host_abi();
|
||||
PLUGIN_API void validate_abi(const abi_info& abi);
|
||||
PLUGIN_API std::filesystem::path module_directory(const void* symbol);
|
||||
PLUGIN_API void set_search_paths(const std::vector<std::string>& paths);
|
||||
PLUGIN_API std::vector<std::string> search_paths();
|
||||
PLUGIN_API void clear_search_paths();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user