From f93b8b08ccd334047001a08cfeac645d465b6c38 Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 17 Nov 2011 13:27:56 +0000 Subject: [PATCH] rnv: Prepare SALOME-6.4.0 version for Win32 platform. --- src/SMESH_I/SMESH_Gen_i.cxx | 4 +- src/Tools/padder/meshjob/impl/Makefile.am | 2 +- .../padder/meshjob/impl/MeshJobManager_i.cxx | 62 +++++++++++++++++-- 3 files changed, 59 insertions(+), 9 deletions(-) diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 9a562756a..fe51eac07 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -297,7 +297,7 @@ SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr orb, SALOME::Session_var session = SALOME::Session::_narrow( obj ) ; if ( !session->_is_nil() ) { - CORBA::String_var s_host = session->getHostname(); + CORBA::String_var str_host = session->getHostname(); CORBA::Long s_pid = session->getPID(); string my_host = Kernel_Utils::GetHostname(); #ifdef WNT @@ -305,7 +305,7 @@ SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr orb, #else long my_pid = (long) getpid(); #endif - SetEmbeddedMode( s_pid == my_pid && my_host == s_host.in() ); + SetEmbeddedMode( s_pid == my_pid && my_host == str_host.in() ); } } } diff --git a/src/Tools/padder/meshjob/impl/Makefile.am b/src/Tools/padder/meshjob/impl/Makefile.am index a21fb9889..a1cc70129 100644 --- a/src/Tools/padder/meshjob/impl/Makefile.am +++ b/src/Tools/padder/meshjob/impl/Makefile.am @@ -25,7 +25,7 @@ libMeshJobManagerEngine_la_CXXFLAGS = \ libMeshJobManagerEngine_la_FFLAGS = -fexceptions libMeshJobManagerEngine_la_LDFLAGS = \ $(top_builddir)/src/Tools/padder/meshjob/idl/libSalomeIDLSPADDER.la \ - @KERNEL_LDFLAGS@ -lSalomeContainer -lSalomeKernelHelpers \ + @KERNEL_LDFLAGS@ -lSalomeContainer -lSalomeKernelHelpers -lSalomeLifeCycleCORBA \ @LIBXML_LIBS@ # ============================================================= diff --git a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx index 4825d8f3d..1ab8683d3 100644 --- a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx +++ b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx @@ -18,6 +18,13 @@ // // Authors : Guillaume Boulant (EDF) - 01/03/2011 +#ifdef WIN32 +#include +#include +#else +#include +#endif + #include "MeshJobManager_i.hxx" #include @@ -33,16 +40,19 @@ // General purpose helper functions (to put elsewhere at least) // ==================================================================== // -#include + /*! * This function must be used to associate a datetime tag to a job */ + +#ifndef WIN32 static long timetag() { timeval tv; gettimeofday(&tv,0); long tag = tv.tv_usec + tv.tv_sec*1000000; return tag; } +#endif /*! * This function returns true if the string text starts with the string @@ -93,9 +103,15 @@ MeshJobManager_i::~MeshJobManager_i() { // ==================================================================== // #include // to get the file streams +#ifdef WNT +#include // to get _splitpath +#include // to get _mkdir +#else +#include // to get basename #include // to get mkdir #include // to get mkdir options -#include // to get basename +#endif + #include // to get system and getenv static std::string OUTPUTFILE("output.med"); @@ -117,8 +133,11 @@ static std::string REMOTE_WORKDIR("/tmp/spadder.remote.workdir."+USER); */ const char * MeshJobManager_i::_writeDataFile(std::vector listConcreteMesh, std::vector listSteelBarMesh) { - +#ifdef WIN32 + _mkdir(LOCAL_INPUTDIR.c_str()); +#else mkdir(LOCAL_INPUTDIR.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +#endif // Make it static so that it's allocated once (constant name) static std::string * dataFilename = new std::string(LOCAL_INPUTDIR+"/"+DATAFILE); @@ -126,7 +145,14 @@ const char * MeshJobManager_i::_writeDataFile(std::vectorc_str()); script << "#!/bin/sh" << std::endl; script << "here=$(dirname $0)" << std::endl; script << ". " << envpath << std::endl; - script << binpath << " $here/" << basename(dataFileName) << std::endl; + script << binpath << " $here/" << bname << std::endl; // Note that we use the basename of the datafile because all data // files are supposed to have been copied in the REMOTE_WORKDIR. script.close(); @@ -233,7 +279,11 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobParameterList & m // We initiate here a datetime to tag the files and folder // associated to this job. +#ifdef WIN32 + DWORD jobDatetimeTag = timeGetTime(); +#else long jobDatetimeTag = timetag(); +#endif // And a MESHJOB::MeshJobPaths structure to hold the directories // where to find data MESHJOB::MeshJobPaths * jobPaths = new MESHJOB::MeshJobPaths(); -- 2.39.2