From Ralf Habacker and Robert Osfield, added search for plugins with OS specific file plugin extensions

This commit is contained in:
Robert Osfield 2008-09-22 14:55:19 +00:00
parent 48fe06fec3
commit 8f4335825b
3 changed files with 22 additions and 10 deletions

View File

@ -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

View File

@ -10,6 +10,7 @@
*/
#include <osgDB/FileUtils>
#include <osgDB/FileNameUtils>
#include <osg/Version>
#include <osgDB/PluginQuery>
@ -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);
}
}

View File

@ -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