Salome HOME
Patch for MacOS (from SALOME forum)
authorvsr <vsr@opencascade.com>
Fri, 20 Jan 2017 12:45:41 +0000 (15:45 +0300)
committervsr <vsr@opencascade.com>
Fri, 20 Jan 2017 12:45:41 +0000 (15:45 +0300)
src/GEOMGUI/GeometryGUI.cxx
src/GEOM_I/GEOM_Gen_i.cc

index eb9c53f879c314f653c3dd68340c1bb25afeeb9b..153d10f01c7d70085923805018f38fd88b6e903b 100644 (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" );
+#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" );
+#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 );
   }
index aac522ccc1e88900bd8dc5f3fdf432ebd210e126..78212462407efdcbea25351051e5b8359daf157f 100644 (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