From Ralf Habacker and Robert Osfield, added search for plugins with OS specific file plugin extensions
This commit is contained in:
parent
48fe06fec3
commit
8f4335825b
@ -84,6 +84,8 @@ IF(OPENVRML_FOUND)
|
|||||||
ENDIF(OPENVRML_FOUND)
|
ENDIF(OPENVRML_FOUND)
|
||||||
|
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(-DOSG_PLUGIN_EXTENSION=${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
|
|
||||||
LINK_INTERNAL(${LIB_NAME}
|
LINK_INTERNAL(${LIB_NAME}
|
||||||
osg
|
osg
|
||||||
OpenThreads
|
OpenThreads
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <osgDB/FileUtils>
|
#include <osgDB/FileUtils>
|
||||||
|
#include <osgDB/FileNameUtils>
|
||||||
#include <osg/Version>
|
#include <osg/Version>
|
||||||
|
|
||||||
#include <osgDB/PluginQuery>
|
#include <osgDB/PluginQuery>
|
||||||
@ -19,6 +20,7 @@ using namespace osgDB;
|
|||||||
FileNameList osgDB::listAllAvailablePlugins()
|
FileNameList osgDB::listAllAvailablePlugins()
|
||||||
{
|
{
|
||||||
FileNameList pluginFiles;
|
FileNameList pluginFiles;
|
||||||
|
std::string validExtension = ADDQUOTES(OSG_PLUGIN_EXTENSION);
|
||||||
|
|
||||||
std::string pluginDirectoryName = std::string("osgPlugins-")+std::string(osgGetVersion());
|
std::string pluginDirectoryName = std::string("osgPlugins-")+std::string(osgGetVersion());
|
||||||
std::string fullPath = osgDB::findLibraryFile(pluginDirectoryName);
|
std::string fullPath = osgDB::findLibraryFile(pluginDirectoryName);
|
||||||
@ -30,10 +32,16 @@ FileNameList osgDB::listAllAvailablePlugins()
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
std::string::size_type pos = itr->find("osgdb_");
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,10 @@
|
|||||||
using std::tolower;
|
using std::tolower;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OSG_DEBUG_POSTFIX
|
#ifdef OSG_DEBUG_POSTFIX
|
||||||
#define OSG_DEBUG_POSTFIX "d"
|
#define OSG_DEBUG_POSTFIX_WITH_QUOTES ADDQUOTES(OSG_DEBUG_POSTFIX)
|
||||||
|
#else
|
||||||
|
#define OSG_DEBUG_POSTFIX_WITH_QUOTES "d"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace osg;
|
using namespace osg;
|
||||||
@ -623,7 +625,7 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext)
|
|||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
#ifdef _DEBUG
|
#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
|
#else
|
||||||
return prepend+"cygwin_"+"osgdb_"+lowercase_ext+".dll";
|
return prepend+"cygwin_"+"osgdb_"+lowercase_ext+".dll";
|
||||||
#endif
|
#endif
|
||||||
@ -631,7 +633,7 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext)
|
|||||||
return prepend+"mingw_"+"osgdb_"+lowercase_ext+".dll";
|
return prepend+"mingw_"+"osgdb_"+lowercase_ext+".dll";
|
||||||
#elif defined(WIN32)
|
#elif defined(WIN32)
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX +".dll";
|
return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX_WITH_QUOTES +".dll";
|
||||||
#else
|
#else
|
||||||
return prepend+"osgdb_"+lowercase_ext+".dll";
|
return prepend+"osgdb_"+lowercase_ext+".dll";
|
||||||
#endif
|
#endif
|
||||||
@ -642,8 +644,8 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext)
|
|||||||
return prepend+"osgdb_"+lowercase_ext+".sl";
|
return prepend+"osgdb_"+lowercase_ext+".sl";
|
||||||
#else
|
#else
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#pragma message(OSG_DEBUG_POSTFIX)
|
#pragma message(OSG_DEBUG_POSTFIX_WITH_QUOTES)
|
||||||
return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX + ".so";
|
return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX_WITH_QUOTES + ".so";
|
||||||
#else
|
#else
|
||||||
return prepend+"osgdb_"+lowercase_ext+".so";
|
return prepend+"osgdb_"+lowercase_ext+".so";
|
||||||
#endif
|
#endif
|
||||||
@ -659,7 +661,7 @@ std::string Registry::createLibraryNameForNodeKit(const std::string& name)
|
|||||||
return "lib"+name+".dll";
|
return "lib"+name+".dll";
|
||||||
#elif defined(WIN32)
|
#elif defined(WIN32)
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
return name+OSG_DEBUG_POSTFIX +".dll";
|
return name+OSG_DEBUG_POSTFIX_WITH_QUOTES +".dll";
|
||||||
#else
|
#else
|
||||||
return name+".dll";
|
return name+".dll";
|
||||||
#endif
|
#endif
|
||||||
@ -670,7 +672,7 @@ std::string Registry::createLibraryNameForNodeKit(const std::string& name)
|
|||||||
return "lib"+name+".sl";
|
return "lib"+name+".sl";
|
||||||
#else
|
#else
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
return "lib"+name+OSG_DEBUG_POSTFIX +".so";
|
return "lib"+name+OSG_DEBUG_POSTFIX_WITH_QUOTES +".so";
|
||||||
#else
|
#else
|
||||||
return "lib"+name+".so";
|
return "lib"+name+".so";
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user