Patch for MacOS (from SALOME forum)

This commit is contained in:
vsr 2017-01-20 15:45:41 +03:00
parent 84e542cbbe
commit 02b418c3b2
2 changed files with 40 additions and 20 deletions

View File

@ -257,13 +257,19 @@ GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName )
{
if ( !myGUIMap.contains( libraryName ) ) {
// try to load library if it is not loaded yet
#ifndef WIN32
QString dirs = getenv( "LD_LIBRARY_PATH" );
QString sep = ":";
#else
#if defined(WIN32)
QString dirs = getenv( "PATH" );
QString sep = ";";
#elif defined(__APPLE__)
QString dirs = getenv( "DYLD_LIBRARY_PATH" );
#else
QString dirs = getenv( "LD_LIBRARY_PATH" );
#endif
#if defined(WIN32)
QString sep = ";";
#else
QString sep = ":";
#endif
if ( !dirs.isEmpty() ) {
QStringList dirList = dirs.split(sep, QString::SkipEmptyParts ); // skip empty entries
QListIterator<QString> it( dirList ); it.toBack();
@ -301,13 +307,20 @@ GEOMPluginGUI* GeometryGUI::getPluginLibrary( const QString& libraryName )
{
if ( !myGUIMap.contains( libraryName ) ) {
// try to load library if it is not loaded yet
#ifndef WIN32
QString dirs = getenv( "LD_LIBRARY_PATH" );
QString sep = ":";
#else
#if defined(WIN32)
QString dirs = getenv( "PATH" );
QString sep = ";";
#elif defined(__APPLE__)
QString dirs = getenv( "DYLD_LIBRARY_PATH" );
#else
QString dirs = getenv( "LD_LIBRARY_PATH" );
#endif
#if defined(WIN32)
QString sep = ";";
#else
QString sep = ":";
#endif
if ( !dirs.isEmpty() ) {
QStringList dirList = dirs.split(sep, QString::SkipEmptyParts ); // skip empty entries
QListIterator<QString> it( dirList ); it.toBack();
@ -698,10 +711,12 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
GEOMPluginGUI* library = 0;
if ( !libName.isEmpty() ) {
#ifndef WIN32
libName = QString( "lib" ) + libName + ".so";
#else
#if defined(WIN32)
libName = libName + ".dll";
#elif defined(__APPLE__)
libName = QString( "lib" ) + libName + ".dylib";
#else
libName = QString( "lib" ) + libName + ".so";
#endif
library = getPluginLibrary( libName );
}
@ -727,10 +742,12 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
GEOMGUI* library = 0;
if ( !libName.isEmpty() ) {
#ifndef WIN32
libName = QString( "lib" ) + libName + ".so";
#else
#if defined(WIN32)
libName = libName + ".dll";
#elif defined(__APPLE__)
libName = QString( "lib" ) + libName + ".dylib";
#else
libName = QString( "lib" ) + libName + ".so";
#endif
library = getLibrary( libName );
}

View File

@ -2499,12 +2499,15 @@ GEOM::GEOM_IOperations_ptr GEOM_Gen_i::GetPluginOperations(CORBA::Long theStudyI
void GEOM_Gen_i::LoadPlugin(const std::string& theLibName)
{
std::string aPlatformLibName;
#ifdef WIN32
aPlatformLibName = theLibName;
aPlatformLibName += ".dll" ;
#else
#if !defined(WIN32)
aPlatformLibName = "lib";
#endif
aPlatformLibName += theLibName;
#if defined(WIN32)
aPlatformLibName += ".dll" ;
#elif defined(__APPLE__)
aPlatformLibName += ".dylib";
#else
aPlatformLibName += ".so";
#endif