#include "components/misc/osgpluginchecker.hpp" #include #include #include #include #include #include #include #include namespace Misc { #ifdef OSG_LIBRARY_STATIC bool checkRequiredOSGPluginsArePresent() { // assume they were linked in at build time and CMake would have failed if they were missing return true; } #else namespace { constexpr auto USED_OSG_PLUGIN_FILENAMES = std::to_array({${USED_OSG_PLUGIN_FILENAMES_FORMATTED}}); } bool checkRequiredOSGPluginsArePresent() { auto availableOSGPlugins = osgDB::listAllAvailablePlugins(); bool haveAllPlugins = true; for (std::string_view plugin : USED_OSG_PLUGIN_FILENAMES) { if (std::find_if(availableOSGPlugins.begin(), availableOSGPlugins.end(), [&](std::string_view availablePlugin) { #ifdef OSG_USE_UTF8_FILENAME std::filesystem::path pluginPath {stringToU8String(availablePlugin)}; #else std::filesystem::path pluginPath {availablePlugin}; #endif return pluginPath.filename() == plugin; }) == availableOSGPlugins.end()) { Log(Debug::Error) << "Missing OSG plugin: " << plugin; haveAllPlugins = false; } } return haveAllPlugins; } #endif }