From 02b418c3b20546854152b3ff5b85b61ae87c9a63 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 20 Jan 2017 15:45:41 +0300 Subject: [PATCH] Patch for MacOS (from SALOME forum) --- src/GEOMGUI/GeometryGUI.cxx | 45 +++++++++++++++++++++++++------------ src/GEOM_I/GEOM_Gen_i.cc | 11 +++++---- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index eb9c53f87..153d10f01 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -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" ); +#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 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" ); +#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 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 ); } diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index aac522ccc..782124624 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -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 -- 2.39.2