diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afdbc4d6fb..71fd58d84f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -210,6 +210,8 @@ jobs: cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . ./IfcParseExamples "../IfcParseExamples_test.ifc" + ./IfcOpenHouse + ./IfcAdvancedHouse - name: Test ifcopenshell-python run: | diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 00929f7269..6c49648bcf 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -27,6 +27,7 @@ if(STANDALONE_PROJECT) cmake_minimum_required(VERSION 3.21) project(IfcOpenShellExamples) + set(CMAKE_CXX_STANDARD 17) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_RUNTIME OFF) set(Boost_USE_MULTITHREADED ON) @@ -56,15 +57,33 @@ if(STANDALONE_PROJECT OR SCHEMA_VERSIONS MATCHES "2x3") endif() install(TARGETS IfcParseExamples) - if(NOT STANDALONE_PROJECT AND WITH_OPENCASCADE) + if(STANDALONE_PROJECT OR WITH_OPENCASCADE) add_executable(IfcOpenHouse IfcOpenHouse.cpp) - target_link_libraries(IfcOpenHouse ${IFCOPENSHELL_LIBRARIES} ${OpenCASCADE_LIBRARIES}) - set_target_properties(IfcOpenHouse PROPERTIES FOLDER Examples) - add_executable(IfcAdvancedHouse IfcAdvancedHouse.cpp) - target_link_libraries(IfcAdvancedHouse ${IFCOPENSHELL_LIBRARIES} ${OpenCASCADE_LIBRARIES}) - set_target_properties(IfcAdvancedHouse PROPERTIES FOLDER Examples) + add_library(IfcHouseInterface INTERFACE) + if (STANDALONE_PROJECT) + find_package(Eigen3 CONFIG REQUIRED) + find_package(CGAL CONFIG REQUIRED) + find_package(OpenCASCADE CONFIG REQUIRED) + add_library(CGAL::CGAL_INTERFACE INTERFACE IMPORTED) + target_link_libraries(CGAL::CGAL_INTERFACE INTERFACE CGAL::CGAL) + + target_include_directories(IfcHouseInterface INTERFACE "${IfcOpenShell_DIR}/../../../include") + target_include_directories(IfcHouseInterface INTERFACE ${Boost_INCLUDE_DIRS}) + target_link_libraries(IfcHouseInterface + INTERFACE ${OpenCASCADE_LIBRARIES} RocksDB::rocksdb + IfcOpenShell::IfcParse IfcOpenShell::geometry_serializer + ) + target_compile_definitions(IfcHouseInterface INTERFACE "SCHEMA_SEQ=(2x3)" HAS_SCHEMA_2x3 IFOPSH_WITH_ROCKSDB) + else() + target_include_directories(IfcHouseInterface INTERFACE "${CMAKE_SOURCE_DIR}/../src") + target_link_libraries(IfcHouseInterface INTERFACE ${IFCOPENSHELL_LIBRARIES} ${OpenCASCADE_LIBRARIES}) + set_target_properties(IfcOpenHouse PROPERTIES FOLDER Examples) + set_target_properties(IfcAdvancedHouse PROPERTIES FOLDER Examples) + endif() + target_link_libraries(IfcOpenHouse PRIVATE IfcHouseInterface) + target_link_libraries(IfcAdvancedHouse PRIVATE IfcHouseInterface) install(TARGETS IfcOpenHouse IfcAdvancedHouse) endif() endif() diff --git a/src/examples/IfcAdvancedHouse.cpp b/src/examples/IfcAdvancedHouse.cpp index ad238a22fd..9b680bd79b 100644 --- a/src/examples/IfcAdvancedHouse.cpp +++ b/src/examples/IfcAdvancedHouse.cpp @@ -39,12 +39,12 @@ #include #define IfcSchema Ifc2x3 -#include "../ifcparse/macros.h" -#include "../ifcparse/Ifc2x3.h" -#include "../ifcparse/IfcBaseClass.h" -#include "../ifcparse/IfcHierarchyHelper.h" +#include "ifcparse/macros.h" +#include "ifcparse/Ifc2x3.h" +#include "ifcparse/IfcBaseClass.h" +#include "ifcparse/IfcHierarchyHelper.h" -#include "../ifcgeom/Serialization/Serialization.h" +#include "ifcgeom/Serialization/Serialization.h" #if USE_VLD #include diff --git a/src/examples/IfcOpenHouse.cpp b/src/examples/IfcOpenHouse.cpp index accac737fb..24654adca7 100644 --- a/src/examples/IfcOpenHouse.cpp +++ b/src/examples/IfcOpenHouse.cpp @@ -36,12 +36,12 @@ #include #define IfcSchema Ifc2x3 -#include "../ifcparse/macros.h" -#include "../ifcparse/Ifc2x3.h" -#include "../ifcparse/IfcBaseClass.h" -#include "../ifcparse/IfcHierarchyHelper.h" +#include "ifcparse/macros.h" +#include "ifcparse/Ifc2x3.h" +#include "ifcparse/IfcBaseClass.h" +#include "ifcparse/IfcHierarchyHelper.h" -#include "../ifcgeom/Serialization/Serialization.h" +#include "ifcgeom/Serialization/Serialization.h" #if USE_VLD #include