From 4c9780471496140a71d2faf4e57202671bc286c4 Mon Sep 17 00:00:00 2001 From: Nabil Ghodbane Date: Tue, 12 Mar 2024 15:16:25 +0100 Subject: [PATCH] bos #41337 [CEA][Windows] YACS compilation broken --- src/runtime_swig/CMakeLists.txt | 1 + src/runtime_swig/SALOMERuntime.i | 31 ++++++++++++++++------------- src/runtime_swig/ThreadLauncher.cxx | 7 ++++++- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/runtime_swig/CMakeLists.txt b/src/runtime_swig/CMakeLists.txt index 1b0316b2b..90efb777f 100644 --- a/src/runtime_swig/CMakeLists.txt +++ b/src/runtime_swig/CMakeLists.txt @@ -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 diff --git a/src/runtime_swig/SALOMERuntime.i b/src/runtime_swig/SALOMERuntime.i index 7e99d4827..e8a5df23e 100644 --- a/src/runtime_swig/SALOMERuntime.i +++ b/src/runtime_swig/SALOMERuntime.i @@ -104,6 +104,23 @@ static PyObject *convertContainer2(YACS::ENGINE::Container *cont, int owner=0) } %} +%{ +#include "Proc.hxx" + +#include +#include +#include +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(); - }; - } -} diff --git a/src/runtime_swig/ThreadLauncher.cxx b/src/runtime_swig/ThreadLauncher.cxx index ff5b83c2e..5e3de2bfe 100644 --- a/src/runtime_swig/ThreadLauncher.cxx +++ b/src/runtime_swig/ThreadLauncher.cxx @@ -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(); } -- 2.39.2