diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71fd58d84f..ce1534d439 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -212,6 +212,8 @@ jobs: ./IfcParseExamples "../IfcParseExamples_test.ifc" ./IfcOpenHouse ./IfcAdvancedHouse + ./IfcAlignment + ./IfcSimplifiedAlignment - name: Test ifcopenshell-python run: | diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 6c49648bcf..8e421b13b6 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -88,14 +88,26 @@ if(STANDALONE_PROJECT OR SCHEMA_VERSIONS MATCHES "2x3") endif() endif() -if(NOT STANDALONE_PROJECT AND SCHEMA_VERSIONS MATCHES "4x3_add2") +if(STANDALONE_PROJECT OR SCHEMA_VERSIONS MATCHES "4x3_add2") add_executable(IfcAlignment IfcAlignment.cpp) - target_link_libraries(IfcAlignment ${IFCOPENSHELL_LIBRARIES}) - set_target_properties(IfcAlignment PROPERTIES FOLDER Examples) - add_executable(IfcSimplifiedAlignment IfcSimplifiedAlignment.cpp) - target_link_libraries(IfcSimplifiedAlignment ${IFCOPENSHELL_LIBRARIES}) - set_target_properties(IfcSimplifiedAlignment PROPERTIES FOLDER Examples) + add_library(IfcAlignmentInterface INTERFACE) + + if(STANDALONE_PROJECT) + target_include_directories(IfcAlignmentInterface INTERFACE "${IfcOpenShell_DIR}/../../../include") + target_include_directories(IfcAlignmentInterface INTERFACE ${Boost_INCLUDE_DIRS}) + target_compile_definitions(IfcAlignmentInterface INTERFACE HAS_SCHEMA_4x3_add2 IFOPSH_WITH_ROCKSDB) + target_link_libraries(IfcAlignment PRIVATE IfcOpenShell::IfcParse) + target_link_libraries(IfcSimplifiedAlignment PRIVATE IfcOpenShell::IfcParse) + else() + target_include_directories(IfcAlignmentInterface INTERFACE "${CMAKE_SOURCE_DIR}/../src") + target_link_libraries(IfcAlignmentInterface INTERFACE ${IFCOPENSHELL_LIBRARIES}) + set_target_properties(IfcAlignment PROPERTIES FOLDER Examples) + set_target_properties(IfcSimplifiedAlignment PROPERTIES FOLDER Examples) + endif() + + target_link_libraries(IfcAlignment PRIVATE IfcAlignmentInterface) + target_link_libraries(IfcSimplifiedAlignment PRIVATE IfcAlignmentInterface) install(TARGETS IfcAlignment IfcSimplifiedAlignment) endif() diff --git a/src/examples/IfcAlignment.cpp b/src/examples/IfcAlignment.cpp index 450bb8e5cb..d4e3ed0348 100644 --- a/src/examples/IfcAlignment.cpp +++ b/src/examples/IfcAlignment.cpp @@ -30,8 +30,8 @@ // Disable warnings coming from IfcOpenShell #pragma warning(disable : 4018 4267 4250 4984 4985) -#include "../ifcparse/Ifc4x3_add2.h" -#include "../ifcparse/IfcHierarchyHelper.h" +#include "ifcparse/Ifc4x3_add2.h" +#include "ifcparse/IfcHierarchyHelper.h" #include #include diff --git a/src/examples/IfcSimplifiedAlignment.cpp b/src/examples/IfcSimplifiedAlignment.cpp index 4f4086f85d..bde0e59b61 100644 --- a/src/examples/IfcSimplifiedAlignment.cpp +++ b/src/examples/IfcSimplifiedAlignment.cpp @@ -30,8 +30,8 @@ // Disable warnings coming from IfcOpenShell #pragma warning(disable : 4018 4267 4250 4984 4985) -#include "../ifcparse/Ifc4x3_add2.h" -#include "../ifcparse/IfcAlignmentHelper.h" +#include "ifcparse/Ifc4x3_add2.h" +#include "ifcparse/IfcAlignmentHelper.h" #include diff --git a/src/examples/README.md b/src/examples/README.md index fe309ed653..e2eb238b23 100644 --- a/src/examples/README.md +++ b/src/examples/README.md @@ -1,5 +1,5 @@ -Example of building IfcParseExamples outside of the IfcOpenShell build tree. +Example of building examples outside of the IfcOpenShell build tree. ```powershell $IFCOPENSHELL_ROOT="L:\Projects\Github\IfcOpenShell" @@ -9,6 +9,13 @@ $PREFIX_PATH+=";$IFCOPENSHELL_ROOT\_deps-vs2022-x64-installed\rocksdb" $PREFIX_PATH+=";$IFCOPENSHELL_ROOT\_deps-vs2022-x64-installed\zstd" $PREFIX_PATH+=";L:\Software\usr\libxml2" +# + Support for IfcHouse and IfcAlignment examples. +$PREFIX_PATH+=";L:\Software\usr\eigen-3.3.9" +$PREFIX_PATH+=";L:\Projects\Github\IfcOpenShell\_deps-vs2022-x64-installed\cgal" +$PREFIX_PATH+=";L:\Projects\Github\IfcOpenShell\_deps-vs2022-x64-installed\mpir" +$PREFIX_PATH+=";L:\Projects\Github\IfcOpenShell\_deps-vs2022-x64-installed\mpfr" +$PREFIX_PATH+=";L:\Projects\Github\IfcOpenShell\_deps-vs2022-x64-installed\opencascade-7.8.1-new-layout" + cmake .. -G Ninja -DCMAKE_PREFIX_PATH="$PREFIX_PATH" -DCMAKE_BUILD_TYPE=Release ninja -v ./IfcParseExamples.exe "../IfcParseExamples_test.ifc"