diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 1c553e855e..7e422506ad 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -46,17 +46,10 @@ list (APPEND COMPONENT_FILES "${OpenMW_BINARY_DIR}/${VERSION_CPP_FILE}") # OSG plugin checker # Helpfully, OSG doesn't export this to its CMake config as it doesn't have one -set(OSG_PLUGIN_PREFIX "") -if (CYGWIN) - SET(OSG_PLUGIN_PREFIX "cygwin_") -elseif(MINGW) - SET(OSG_PLUGIN_PREFIX "mingw_") -endif() -list(TRANSFORM USED_OSG_PLUGINS PREPEND "${OSG_PLUGIN_PREFIX}" OUTPUT_VARIABLE USED_OSG_PLUGIN_FILENAMES) -list(TRANSFORM USED_OSG_PLUGIN_FILENAMES APPEND "${CMAKE_SHARED_MODULE_SUFFIX}") -list(TRANSFORM USED_OSG_PLUGIN_FILENAMES PREPEND "\"" OUTPUT_VARIABLE USED_OSG_PLUGIN_FILENAMES_FORMATTED) -list(TRANSFORM USED_OSG_PLUGIN_FILENAMES_FORMATTED APPEND "\"") -list(JOIN USED_OSG_PLUGIN_FILENAMES_FORMATTED ", " USED_OSG_PLUGIN_FILENAMES_FORMATTED) +list(TRANSFORM USED_OSG_PLUGINS REPLACE "^osgdb_" "" OUTPUT_VARIABLE USED_OSG_PLUGIN_NAMES) +list(TRANSFORM USED_OSG_PLUGIN_NAMES PREPEND "\"" OUTPUT_VARIABLE USED_OSG_PLUGIN_NAMES_FORMATTED) +list(TRANSFORM USED_OSG_PLUGIN_NAMES_FORMATTED APPEND "\"") +list(JOIN USED_OSG_PLUGIN_NAMES_FORMATTED ", " USED_OSG_PLUGIN_NAMES_FORMATTED) set(OSG_PLUGIN_CHECKER_CPP_FILE "components/misc/osgpluginchecker.cpp") configure_file("${OpenMW_SOURCE_DIR}/${OSG_PLUGIN_CHECKER_CPP_FILE}.in" "${OpenMW_BINARY_DIR}/${OSG_PLUGIN_CHECKER_CPP_FILE}") diff --git a/components/misc/osgpluginchecker.cpp.in b/components/misc/osgpluginchecker.cpp.in index f519447752..81ae73f9e3 100644 --- a/components/misc/osgpluginchecker.cpp.in +++ b/components/misc/osgpluginchecker.cpp.in @@ -30,7 +30,7 @@ namespace Misc namespace { - constexpr auto USED_OSG_PLUGIN_FILENAMES = std::to_array({${USED_OSG_PLUGIN_FILENAMES_FORMATTED}}); + constexpr auto USED_OSG_PLUGIN_NAMES = std::to_array({${USED_OSG_PLUGIN_NAMES_FORMATTED}}); } bool checkRequiredOSGPluginsArePresent() @@ -62,7 +62,7 @@ namespace Misc auto availableOSGPlugins = osgDB::listAllAvailablePlugins(); bool haveAllPlugins = true; - for (std::string_view plugin : USED_OSG_PLUGIN_FILENAMES) + for (std::string_view plugin : USED_OSG_PLUGIN_NAMES) { if (std::find_if(availableOSGPlugins.begin(), availableOSGPlugins.end(), [&](std::string_view availablePlugin) { @@ -71,7 +71,10 @@ namespace Misc #else std::filesystem::path pluginPath {availablePlugin}; #endif - return pluginPath.filename() == plugin; + return pluginPath.filename() + == std::filesystem::path( + osgDB::Registry::instance()->createLibraryNameForExtension(std::string{ plugin })) + .filename(); }) == availableOSGPlugins.end()) {