From 3d1e157ff1834cbd3341e6a23c5e4e915a376980 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Fri, 31 Jul 2026 07:17:36 +0200 Subject: [PATCH] Even more plug-in workarounds --- src/plugin/CMakeLists.txt | 1 + src/plugin/plugin.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/plugin/CMakeLists.txt b/src/plugin/CMakeLists.txt index 0976e25fc1..974d5b47ae 100644 --- a/src/plugin/CMakeLists.txt +++ b/src/plugin/CMakeLists.txt @@ -20,6 +20,7 @@ endif() target_compile_definitions(plugin PRIVATE BOOST_DLL_USE_STD_FS PLUGIN_IFCOPENSHELL_VERSION="${PROJECT_VERSION}" + IFCOPENSHELL_INSTALL_PLUGIN_DIRECTORY="${CMAKE_INSTALL_FULL_LIBDIR}" ) target_link_libraries(plugin PRIVATE ${Boost_LIBRARIES}) diff --git a/src/plugin/plugin.cpp b/src/plugin/plugin.cpp index 78754e8e2b..268d078418 100644 --- a/src/plugin/plugin.cpp +++ b/src/plugin/plugin.cpp @@ -357,6 +357,17 @@ PLUGIN_API std::filesystem::path ifcopenshell::plugin::add_search_paths_or_defau manager.add_search_path(lib); } } + + // A static IfcParse/IfcGeom embedded in a Python extension resolves to the + // extension's site-packages directory, while plug-ins retain CMake's normal + // install location. This also covers Python installations outside the CMake + // prefix, such as GitHub Actions' hosted Python. +#ifdef IFCOPENSHELL_INSTALL_PLUGIN_DIRECTORY + const auto install_plugin_directory = std::filesystem::path(IFCOPENSHELL_INSTALL_PLUGIN_DIRECTORY); + if (install_plugin_directory != path && std::filesystem::exists(install_plugin_directory)) { + manager.add_search_path(install_plugin_directory); + } +#endif #endif // Bundle-aware fallback search paths. The primary search path is