Salome HOME
Patch for MacOS (from SALOME forum)
authorvsr <vsr@opencascade.com>
Fri, 20 Jan 2017 12:54:32 +0000 (15:54 +0300)
committervsr <vsr@opencascade.com>
Fri, 20 Jan 2017 12:54:32 +0000 (15:54 +0300)
src/bases/DynLibLoaderGNU.cxx
src/bases/chrono.cxx
src/bases/chrono.hxx
src/pmml/Test/BasicMainTest.hxx
src/runtime/CppContainer.cxx
src/runtime/RuntimeSALOME.cxx
src/runtime/RuntimeSALOME.hxx
src/runtime/XMLNode.cxx
src/yacsloader/driver.cxx
src/yacsloader/pmml/BasicMainTest.hxx

index e622138868a0b8a44fc32fd191e7e9e53313963b..b3e6072093f23bfe4038ffd0f0baf58c54c8f993 100644 (file)
 
 using namespace YACS::BASES;
 
+#if defined(__APPLE__)
+const char DynLibLoaderGNU::_extForDynLib[]=".dylib";
+#else
 const char DynLibLoaderGNU::_extForDynLib[]=".so";
+#endif
 
 DynLibLoaderGNU::DynLibLoaderGNU(const std::string& libNameWithoutExtension):_libName(libNameWithoutExtension),
                                                                              _handleOnLoadedLib(0)
index 5bceee79c3a338e4f19c23d225e2b1816e639f17..7182b35b930bac4d89048a3b8a119747b97fbafd 100644 (file)
@@ -62,20 +62,20 @@ void counters::stats()
 
 
 
-chrono::chrono(int i) : _ctr(i), _run(true)
+salome_chrono::salome_chrono(int i) : _ctr(i), _run(true)
 {
-  //DEBTRACE("chrono::chrono " << _ctr << " " << _run);
+  //DEBTRACE("salome_chrono::salome_chrono " << _ctr << " " << _run);
   _start = clock();    
 }
 
-chrono::~chrono()
+salome_chrono::~salome_chrono()
 {
   if (_run) stop();
 }
 
-void chrono::stop()
+void salome_chrono::stop()
 {
-  //DEBTRACE("chrono::stop " << _ctr << " " << _run);
+  //DEBTRACE("salome_chrono::stop " << _ctr << " " << _run);
   if (_run)
     {
       _run = false;
index e16fb3ec37027ed0e34804e2a2502a3b50c1da40..9f6e8f4da6e45e9e5752d61d696c3bf0cb572a51 100644 (file)
@@ -50,11 +50,11 @@ protected:
   int _nbChrono;
 };
 
-class YACSBASES_EXPORT chrono
+class YACSBASES_EXPORT salome_chrono
 {
 public:
-  chrono(int i);
-  ~chrono();
+  salome_chrono(int i);
+  ~salome_chrono();
   void stop();
 protected:
   bool _run;
@@ -79,7 +79,7 @@ static timeval tv;
 #ifdef CHRONODEF
 #define CHRONO(i) counters::_ctrs[i]._ctrNames = (char *)__FILE__; \
   counters::_ctrs[i]._ctrLines = __LINE__; \
-  chrono aChrono##i(i);
+  salome_chrono aChrono##i(i);
 
 #define CHRONOSTOP(i) aChrono##i.stop();
 
index cf007a4b352f91bdf908847369123219ee4a15d8..0ab9abe3fa02807a897860508012c805965b9b28 100755 (executable)
@@ -32,7 +32,7 @@
 #include <iostream>
 #include <fstream>
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
 #include <fpu_control.h>
 #endif
 
@@ -45,7 +45,7 @@
 
 int main(int argc, char* argv[])
 {
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
   fpu_control_t cw = _FPU_DEFAULT & ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM);
   _FPU_SETCW(cw);
 #endif
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
   controller.addListener( &result );        
 
   // ---  Add a listener that print dots as test run.
-#ifdef WIN32
+#if !defined WIN32 && !defined __APPLE__
   CPPUNIT_NS::TextTestProgressListener progress;
 #else
   CPPUNIT_NS::BriefTestProgressListener progress;
index af5aec92ac6ecb97b2a6ace9ab8da26ea109aedd..d3e8b5015e58b21b5fbf217b9a793d5f1f51c9ab 100644 (file)
@@ -324,7 +324,11 @@ LocalLibrary  LocalContainer::loadComponentLibrary(const std::string & aCompName
     }
   
 #ifndef WIN32
+#ifdef __APPLE__
+  std::string impl_name = std::string ("lib") + aCompName + std::string("Local.dylib");
+#else
   std::string impl_name = std::string ("lib") + aCompName + std::string("Local.so");
+#endif
   if(sprefix != "")
     impl_name = sprefix + std::string("/") + impl_name;
 #else
index 7fbeb28d38ca8bc25633b0c89da3c76c3e9629d4..31985cf2f7c8a706dbe86fe68fab83cf78ea44fc 100644 (file)
@@ -139,8 +139,8 @@ void RuntimeSALOME::setRuntime(long flags, int argc, char* argv[]) // singleton
 
 RuntimeSALOME* YACS::ENGINE::getSALOMERuntime()
 {
-  YASSERT(Runtime::_singleton);
-  return dynamic_cast< RuntimeSALOME* >(Runtime::_singleton);
+  YASSERT(RuntimeSALOME::getSingleton());
+  return dynamic_cast< RuntimeSALOME* >(RuntimeSALOME::getSingleton());
 }
 
 /**
index c34b9594a953c39c5e7a54a0e1ca35fd38c51f6f..d9ba31c2360d0b410c163edce99cb604223a62db 100644 (file)
@@ -74,6 +74,8 @@ namespace YACS
 
     class YACSRUNTIMESALOME_EXPORT RuntimeSALOME: public Runtime
     {
+      static Runtime* getSingleton() { return Runtime::_singleton; }
+
     public:
       
       enum 
index b562d26106f27d4923670d287bfa7a8cc210b2bb..856df28e4687d933af62b9258b2d8417db6d9e26 100644 (file)
@@ -37,6 +37,9 @@
 #include <io.h>
 #define chmod _chmod
 #endif
+#ifdef __APPLE__
+#include <unistd.h> // for mkdtemp
+#endif
 
 //#define _DEVDEBUG_
 #include "YacsTrace.hxx"
index 7d377c8cc3fff7d6bf9749a0cc37539b9cafe3c9..2a898e860d152367b62d799f86f4d3f37e163e2f 100644 (file)
@@ -41,7 +41,7 @@
 #include <signal.h>
 #include <list>
 
-#ifdef WIN32
+#if defined WIN32 || defined __APPLE__
 #else
 #include <argp.h>
 #endif
@@ -58,7 +58,7 @@ const char *argp_program_bug_address ="<nepal@nepal.edf.fr>";
 static char doc[] ="driver -- a SALOME YACS graph executor";
 static char args_doc[] = "graph.xml";
 
-#ifdef WIN32
+#if defined WIN32 || defined __APPLE__
 #else
 static struct argp_option options[] =
   {
@@ -157,14 +157,14 @@ void UnLoadObserversPluginIfAny()
 #endif
 }
 
-#ifdef WIN32
+#if defined WIN32 || defined __APPLE__
 static int
 #else
 static error_t
 #endif
 parse_opt (int key, char *arg, struct argp_state *state)
 {
-#ifdef WIN32
+#if defined WIN32 || defined __APPLE__
 #else
   // Get the input argument from argp_parse, which we
   // know is a pointer to our arguments structure. 
@@ -242,14 +242,14 @@ parse_opt (int key, char *arg, struct argp_state *state)
 }
 
 // Our argp parser.
-#ifdef WIN32
+#if defined WIN32 || defined __APPLE__
 #else
 static struct argp argp = { options, parse_opt, args_doc, doc };
 #endif
 
 void timer(std::string msg)
 {
-#ifdef WIN32
+#if defined WIN32 || defined __APPLE__
 #else
   struct timeval tv;
   gettimeofday(&tv,NULL);
@@ -367,7 +367,7 @@ int main (int argc, char* argv[])
   myArgs.init_ports.clear();
 
   // Parse our arguments; every option seen by parse_opt will be reflected in arguments.
-#ifdef WIN32
+#if defined WIN32 || defined __APPLE__
 #else
   argp_parse (&argp, argc, argv, 0, 0, &myArgs);
   std::cerr << "graph = " << myArgs.args[0];
index cf007a4b352f91bdf908847369123219ee4a15d8..26038678c1b4b4d4389fd5c74009a73b35c5b011 100755 (executable)
@@ -32,7 +32,7 @@
 #include <iostream>
 #include <fstream>
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
 #include <fpu_control.h>
 #endif
 
@@ -45,7 +45,7 @@
 
 int main(int argc, char* argv[])
 {
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
   fpu_control_t cw = _FPU_DEFAULT & ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM);
   _FPU_SETCW(cw);
 #endif
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
   controller.addListener( &result );        
 
   // ---  Add a listener that print dots as test run.
-#ifdef WIN32
+#if defined WIN32 || defined __APPLE__
   CPPUNIT_NS::TextTestProgressListener progress;
 #else
   CPPUNIT_NS::BriefTestProgressListener progress;