tree and document plug-ins

This commit is contained in:
Thomas Krijnen
2026-04-17 11:24:09 +02:00
parent 3824e7b449
commit d2cc66fdf0
60 changed files with 2207 additions and 766 deletions
+1 -30
View File
@@ -19,12 +19,6 @@
#include "kernel_plugin.h"
#ifndef _WIN32
#include <dlfcn.h>
#else
#include <windows.h>
#endif
#include <stdexcept>
namespace {
@@ -43,30 +37,7 @@ ifcopenshell::plugin::metadata ifcopenshell::geometry::kernels::kernel_plugin_me
}
std::filesystem::path ifcopenshell::geometry::kernels::kernel_plugin_directory() {
#ifdef _WIN32
HMODULE module_handle = nullptr;
if (!GetModuleHandleExW(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
reinterpret_cast<LPCWSTR>(&ifcopenshell::geometry::kernels::load_kernel_plugins),
&module_handle)) {
throw std::runtime_error("Unable to resolve IfcGeom module path");
}
wchar_t buffer[MAX_PATH];
const DWORD length = GetModuleFileNameW(module_handle, buffer, MAX_PATH);
if (length == 0) {
throw std::runtime_error("Unable to read IfcGeom module filename");
}
return std::filesystem::path(std::wstring(buffer, length)).parent_path();
#else
Dl_info info;
if (dladdr(reinterpret_cast<const void*>(&ifcopenshell::geometry::kernels::load_kernel_plugins), &info) == 0 || !info.dli_fname) {
throw std::runtime_error("Unable to resolve IfcGeom module path");
}
return std::filesystem::path(info.dli_fname).parent_path();
#endif
return plugin::module_directory(reinterpret_cast<const void*>(&ifcopenshell::geometry::kernels::load_kernel_plugins));
}
void ifcopenshell::geometry::kernels::load_kernel_plugins(kernel_registry& registry) {