diff --git a/src/osgDB/CMakeLists.txt b/src/osgDB/CMakeLists.txt index 7d7ad1682..df3ca645c 100644 --- a/src/osgDB/CMakeLists.txt +++ b/src/osgDB/CMakeLists.txt @@ -84,6 +84,8 @@ IF(OPENVRML_FOUND) ENDIF(OPENVRML_FOUND) +ADD_DEFINITIONS(-DOSG_PLUGIN_EXTENSION=${CMAKE_SHARED_LIBRARY_SUFFIX}) + LINK_INTERNAL(${LIB_NAME} osg OpenThreads diff --git a/src/osgDB/PluginQuery.cpp b/src/osgDB/PluginQuery.cpp index 93133fd8b..becaff0a7 100644 --- a/src/osgDB/PluginQuery.cpp +++ b/src/osgDB/PluginQuery.cpp @@ -10,6 +10,7 @@ */ #include +#include #include #include @@ -19,6 +20,7 @@ using namespace osgDB; FileNameList osgDB::listAllAvailablePlugins() { FileNameList pluginFiles; + std::string validExtension = ADDQUOTES(OSG_PLUGIN_EXTENSION); std::string pluginDirectoryName = std::string("osgPlugins-")+std::string(osgGetVersion()); std::string fullPath = osgDB::findLibraryFile(pluginDirectoryName); @@ -30,10 +32,16 @@ FileNameList osgDB::listAllAvailablePlugins() ++itr) { std::string::size_type pos = itr->find("osgdb_"); - if (pos!=std::string::npos) + if (pos==std::string::npos) { - pluginFiles.push_back(fullPath + std::string("/")+*itr); + continue; } + std::string ext = getFileExtensionIncludingDot(*itr); + if (ext != validExtension) + { + continue; + } + pluginFiles.push_back(fullPath + std::string("/")+*itr); } } diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 62d3ac393..650661686 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -39,8 +39,10 @@ using std::tolower; #endif -#ifndef OSG_DEBUG_POSTFIX -#define OSG_DEBUG_POSTFIX "d" +#ifdef OSG_DEBUG_POSTFIX + #define OSG_DEBUG_POSTFIX_WITH_QUOTES ADDQUOTES(OSG_DEBUG_POSTFIX) +#else + #define OSG_DEBUG_POSTFIX_WITH_QUOTES "d" #endif using namespace osg; @@ -623,7 +625,7 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext) #if defined(__CYGWIN__) #ifdef _DEBUG - return prepend+"cygwin_"+"osgdb_"+lowercase_ext+OSG_DEBUG_POSTFIX+".dll"; + return prepend+"cygwin_"+"osgdb_"+lowercase_ext+OSG_DEBUG_POSTFIX_WITH_QUOTES+".dll"; #else return prepend+"cygwin_"+"osgdb_"+lowercase_ext+".dll"; #endif @@ -631,7 +633,7 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext) return prepend+"mingw_"+"osgdb_"+lowercase_ext+".dll"; #elif defined(WIN32) #ifdef _DEBUG - return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX +".dll"; + return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX_WITH_QUOTES +".dll"; #else return prepend+"osgdb_"+lowercase_ext+".dll"; #endif @@ -642,8 +644,8 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext) return prepend+"osgdb_"+lowercase_ext+".sl"; #else #ifdef _DEBUG -#pragma message(OSG_DEBUG_POSTFIX) - return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX + ".so"; +#pragma message(OSG_DEBUG_POSTFIX_WITH_QUOTES) + return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX_WITH_QUOTES + ".so"; #else return prepend+"osgdb_"+lowercase_ext+".so"; #endif @@ -659,7 +661,7 @@ std::string Registry::createLibraryNameForNodeKit(const std::string& name) return "lib"+name+".dll"; #elif defined(WIN32) #ifdef _DEBUG - return name+OSG_DEBUG_POSTFIX +".dll"; + return name+OSG_DEBUG_POSTFIX_WITH_QUOTES +".dll"; #else return name+".dll"; #endif @@ -670,7 +672,7 @@ std::string Registry::createLibraryNameForNodeKit(const std::string& name) return "lib"+name+".sl"; #else #ifdef _DEBUG - return "lib"+name+OSG_DEBUG_POSTFIX +".so"; + return "lib"+name+OSG_DEBUG_POSTFIX_WITH_QUOTES +".so"; #else return "lib"+name+".so"; #endif