Salome HOME
bos #41337 [CEA][Windows] YACS compilation broken bos/41337 7/head
authorNabil Ghodbane <nabil.ghodbane@cea.fr>
Tue, 12 Mar 2024 14:16:25 +0000 (15:16 +0100)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Tue, 12 Mar 2024 14:16:25 +0000 (15:16 +0100)
src/runtime_swig/CMakeLists.txt
src/runtime_swig/SALOMERuntime.i
src/runtime_swig/ThreadLauncher.cxx

index 1b0316b2ba2ec051df27168dd4140e63dba8be1d..90efb777f50b70b6b4f6c3ff39063d11ef56e433 100644 (file)
@@ -57,6 +57,7 @@ ADD_DEFINITIONS(
   )
 
 ADD_LIBRARY(YACSRuntimePython ThreadLauncher.cxx)
+TARGET_LINK_LIBRARIES(YACSRuntimePython YACSRuntimeSALOME ${PYTHON_LIBRARIES} )
 INSTALL(TARGETS YACSRuntimePython EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 # libraries to link to
index 7e99d48278048d92ea91b2c73ca2d47c06b858d1..e8a5df23e42b5eb063181cb1792a45f06f238d8d 100644 (file)
@@ -104,6 +104,23 @@ static PyObject *convertContainer2(YACS::ENGINE::Container *cont, int owner=0)
 }
 %}
 
+%{
+#include "Proc.hxx"
+
+#include <thread>
+#include <memory>
+#include <string>
+using namespace YACS::ENGINE;
+class ThreadDumpState
+{
+ public:
+   ThreadDumpState(Proc *proc, int nbSeconds, const std::string& dumpFile, const std::string& lockFile);
+   ~ThreadDumpState();
+   void start();
+   void join();
+};
+%}
+
 // ----------------------------------------------------------------------------
 
 #ifdef SWIGPYTHON
@@ -252,17 +269,3 @@ namespace YACS
   }
 }
 
-namespace YACS
-{
-  namespace ENGINE
-  {
-    class YACSLIBENGINE_EXPORT ThreadDumpState
-    {
-    public:
-      ThreadDumpState(Proc *proc, int nbSeconds, const std::string& dumpFile, const std::string& lockFile);
-      ~ThreadDumpState();
-      void start();
-      void join();
-    };
-  }
-}
index ff5b83c2ecb375fdb25d273dc2ef6a605eb5df63..5e3de2bfe2fd6a7a00b09eea462de4dea1a2413d 100644 (file)
@@ -42,13 +42,18 @@ void ThreadDumpState::run()
   {
 #ifdef WIN32
     Sleep(_nb_seconds);
+       std::string cmd = "COPY /b " + _lock_file + " +,,";
 #else 
     sleep(_nb_seconds);
-#endif
     std::string cmd = "touch " + _lock_file;
+#endif
     system(cmd.c_str());
     schemaSaveStateUnsafe(_proc,_dump_file);
+#ifdef WIN32
+    cmd = "DEL /Q /F " + _lock_file;
+#else
     cmd = "rm -f " + _lock_file;
+#endif
     system(cmd.c_str());
     state = _proc->getEffectiveState();
   }