]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
SALOME 9.1.0 Windows version
authorrnv <rnv@opencascade.com>
Wed, 29 Aug 2018 11:24:36 +0000 (14:24 +0300)
committervsr <vsr@opencascade.com>
Fri, 7 Sep 2018 11:08:46 +0000 (14:08 +0300)
14 files changed:
src/Basics/Basics_Utils.hxx
src/Communication_SWIG/CMakeLists.txt
src/DSC/DSC_Python/CMakeLists.txt
src/Launcher/Launcher_Job.cxx
src/Launcher/Launcher_Job_Command.cxx
src/Launcher/Launcher_Job_SALOME.cxx
src/LifeCycleCORBA_SWIG/CMakeLists.txt
src/NOTIFICATION_SWIG/CMakeLists.txt
src/Notification/NOTIFICATION.cxx
src/SALOMEDS/SALOMEDS_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx
src/SALOMELocalTrace/utilities.h
src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.cxx
src/Utils/Utils_ExceptHandlers.cxx

index 3468d205e80714726843952ef4929f8009684318..f4a90c69e8a4229f69461b97b4b32112fa791f4d 100644 (file)
@@ -56,10 +56,10 @@ namespace Kernel_Utils
     ObjectdID       //!< Global usage object identifier ID
   };
 
-  const wchar_t* decode(const char* encoded);
-  const wchar_t* decode_s(std::string encoded);
-  const char* encode(const wchar_t* decoded);
-  std::string encode_s(const wchar_t* decoded);
+  BASICS_EXPORT const wchar_t* decode(const char* encoded);
+  BASICS_EXPORT const wchar_t* decode_s(std::string encoded);
+  BASICS_EXPORT const char* encode(const wchar_t* decoded);
+  BASICS_EXPORT std::string encode_s(const wchar_t* decoded);
 
   //! Get predefined GUID
   BASICS_EXPORT std::string GetGUID( GUIDtype );
index 9396baf818612f157621430677ed7b427e04729f..745048574414a8648f69adb18d8c91bcddcbe69b 100755 (executable)
@@ -49,8 +49,11 @@ IF(SALOME_USE_MPI)
     ${MPI_CXX_LIBRARIES}
   )
 ENDIF(SALOME_USE_MPI)
-
-SWIG_ADD_MODULE(libSALOME_Comm python libSALOME_Comm.i)
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") 
+  SWIG_ADD_MODULE(libSALOME_Comm python libSALOME_Comm.i)
+ELSE()
+  SWIG_ADD_LIBRARY(libSALOME_Comm LANGUAGE python SOURCES libSALOME_Comm.i)
+ENDIF()
 SWIG_LINK_LIBRARIES(libSALOME_Comm ${_libSALOME_Comm_LIBS})
 
 IF(${MACHINE} STREQUAL WINDOWS)
index eb5369a43e18d67c2769c0c766ed5f0345cdb640..5a10adea12b95f2544b97e5c9f8906fc163a7edd 100755 (executable)
@@ -59,7 +59,12 @@ SET(_calcium_LIBS
   ${OMNIORB_LIBRARIES}
 )
 
-SWIG_ADD_MODULE(calcium python calcium.i)
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") 
+  SWIG_ADD_MODULE(calcium python calcium.i)
+ELSE()
+  SWIG_ADD_LIBRARY(calcium LANGUAGE python SOURCES calcium.i)
+ENDIF()
+
 SWIG_LINK_LIBRARIES(calcium ${_calcium_LIBS})
 INSTALL(TARGETS _calcium DESTINATION ${SALOME_INSTALL_PYTHON})
 
index cbe54ef9797becbedbabfe260898cdfecc735c35..ac015eb7fbb2f64de9cda248459a097ec7fb23f2 100644 (file)
@@ -31,6 +31,7 @@
 #include <sstream>
 #ifdef WIN32
   static const char SEPARATOR = '\\';
+#include <process.h>
 #else
   static const char SEPARATOR = '/';
 #endif
@@ -631,7 +632,11 @@ Launcher::Job::common_job_params()
     {
       std::string date_dir = std::string("/job_") + date;
       std::ostringstream str_pid;
+#ifdef WIN32
+         str_pid << _getpid();
+#else
       str_pid << ::getpid();
+#endif
       std::string job_dir = date_dir + "-" + str_pid.str();
 
       _work_directory = _resource_definition.working_directory + job_dir;
index b71d7373534db4fc3b575fbfd68c411c3c06476b..88da9cd6b52040f7894b55feb30ce83cf6c318d1 100644 (file)
@@ -29,6 +29,7 @@
 #ifdef WIN32
 #include <io.h>
 #define _chmod chmod
+#include <process.h>
 #endif
 
 #include <sstream>
@@ -62,7 +63,11 @@ Launcher::Job_Command::buildCommandScript(Batch::Parametre params, std::string l
   // File name
   std::string launch_date_port_file = launch_date;
   std::ostringstream str_pid;
+#ifdef WIN32
+  str_pid << _getpid();
+#else
   str_pid << ::getpid();
+#endif
   std::string launch_script = Kernel_Utils::GetTmpDir() + "runCommand_"
                               + _job_file_name + "_" + launch_date + "-"
                               + str_pid.str();
index 17e7e1766056bc5a68cc16a6a7d42fb2cdf4e5f2..4bcb397724820c67bfa95ef73ea8508a488312c5 100644 (file)
@@ -29,6 +29,7 @@
 #ifdef WIN32
 #include <io.h>
 #define _chmod chmod
+#include <process.h>
 #endif
 
 #include <sstream>
@@ -66,7 +67,11 @@ Launcher::Job_SALOME::buildSalomeScript(Batch::Parametre params)
   // parameters
   std::string work_directory = params[Batch::WORKDIR].str();
   std::ostringstream str_pid;
+#ifdef WIN32
+  str_pid << _getpid();
+#else
   str_pid << ::getpid();
+#endif
   std::string launch_script = Kernel_Utils::GetTmpDir() + "runSalome_" + _job_file_name + "_" + _launch_date + "-" + str_pid.str() + ".sh";
   std::ofstream launch_script_stream;
   launch_script_stream.open(launch_script.c_str(),
index 4a8decb55341075c918891ddc0d807d54a9e435b..96233ea18582e58740e3d573ddeac16fe4f5d9f4 100755 (executable)
@@ -39,7 +39,12 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_BINARY_DIR}/idl
   )
 
-SWIG_ADD_MODULE(libSALOME_LifeCycleCORBA python libSALOME_LifeCycleCORBA.i)
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") 
+  SWIG_ADD_MODULE(libSALOME_LifeCycleCORBA python libSALOME_LifeCycleCORBA.i)  
+ELSE()
+  SWIG_ADD_LIBRARY(libSALOME_LifeCycleCORBA LANGUAGE python SOURCES libSALOME_LifeCycleCORBA.i)  
+ENDIF()
+
 SWIG_LINK_LIBRARIES(libSALOME_LifeCycleCORBA ${PYTHON_LIBRARIES} SalomeLifeCycleCORBA)
 TARGET_LINK_LIBRARIES(_libSALOME_LifeCycleCORBA ${PLATFORM_LIBS})
 
index d041a89a6a3e73fd6cb635c61ee1cf6fb7619728..209d8a702f57d738f453ac02c2814427a01c70aa 100755 (executable)
@@ -24,7 +24,7 @@ SET_SOURCE_FILES_PROPERTIES(NOTIFICATION.i PROPERTIES SWIG_FLAGS "-py3")
 SET_SOURCE_FILES_PROPERTIES(NOTIFICATIONPYTHON_wrap.cxx PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} -DHAVE_CONFIG_H")
 
 INCLUDE_DIRECTORIES(
-  ${PYTHON_INCLUDE_DIRS}
+  ${PYTHON_INCLUDE_DIRS} 
   ${PTHREAD_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}
@@ -37,7 +37,13 @@ INCLUDE_DIRECTORIES(
 # SWIG module name differs from file name - avoid unnecessary rebuild: 
 SET_SOURCE_FILES_PROPERTIES(NOTIFICATION.i PROPERTIES SWIG_MODULE_NAME libNOTIFICATION)
 
-SWIG_ADD_MODULE(libNOTIFICATION python NOTIFICATION.i NOTIFICATION_Swig.cxx)
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") 
+  SWIG_ADD_MODULE(libNOTIFICATION python NOTIFICATION.i NOTIFICATION_Swig.cxx)
+ELSE()
+  SWIG_ADD_LIBRARY(libNOTIFICATION LANGUAGE python SOURCES NOTIFICATION.i NOTIFICATION_Swig.cxx)
+ENDIF()
+
+
 SWIG_LINK_LIBRARIES(libNOTIFICATION ${PYTHON_LIBRARIES} SalomeNotification)
 ADD_DEFINITIONS(${OMNIORB_DEFINITIONS})
 
index 00ce49298e11623782d5c145a0be6448cd7a57f8..5a50f9acfced6f36fe8a22a7bd7f1addcd368455 100644 (file)
@@ -88,11 +88,16 @@ static char Mois[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug
 static char NOTIFICATION_DATE[50];
 
 char* NOTIFICATION_date() {
+#ifndef WIN32
     time_t aTime;
     time(&aTime);
     struct tm* temps = localtime(&aTime);
 
     sprintf(NOTIFICATION_DATE, "%4d %3d %3s %2d %3s %02d:%02d:%02d", 1900+temps->tm_year, temps->tm_mon+1, Mois[temps->tm_mon], temps->tm_mday, JourSemaine[temps->tm_wday], temps->tm_hour, temps->tm_min, temps->tm_sec);
-
+#else 
+       SYSTEMTIME    st;
+       GetLocalTime(&st);
+       sprintf(NOTIFICATION_DATE, "%4d %3d %3s %2d %3s %02d:%02d:%02d", st.wYear, st.wMonth, Mois[st.wMonth-1], st.wDay, JourSemaine[st.wDay], st.wHour, st.wMinute, st.wSecond);
+#endif
     return(NOTIFICATION_DATE);
 }
index f7ea3dc15b94d6e510a04c9e7d423f2b2125fd63..337fe6c5162948d005210e0401479dd44366b915 100644 (file)
@@ -86,7 +86,7 @@ SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy)
 
   pthread_mutex_init( &SALOMEDS_StudyBuilder::_remoteBuilderMutex, 0 );
 
-  long addr = theStudy->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
+  CORBA::LongLong addr = theStudy->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
   if(_isLocal) {
     _local_impl = reinterpret_cast<SALOMEDSImpl_Study*>(addr);
     _corba_impl = SALOMEDS::Study::_duplicate(theStudy);
index 16cbbaf57f9c59bbc8fbcae478f9c9a7f3f1f296..9a58128492a6cff89c1332d4cba2b1a5aad3975c 100644 (file)
 #include <vector>
 #include "DF_Label.hxx"
 
+#ifdef WIN32
+# undef GetUserName
+#endif
+
 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_Tool
 {
 
index e2d34fd4fc4b3198b8a44d52c0c9497401ff0422..221034e6fb5829cb5291cbe4cc183fee5e256327 100644 (file)
@@ -90,6 +90,8 @@
 #define COMPILER                "pgCC" 
 #elif defined ( __alpha )
 #define COMPILER                "cxx" 
+#elif defined ( _MSC_VER )
+#define COMPILER                "cl.exe" 
 #else
 #define COMPILER                "undefined" 
 #endif
index d1aa74dee260b51b734a0d1150279f33e7fd0174..a3261bc8399b62e013b03d841bb0da643b5d94d2 100644 (file)
@@ -29,7 +29,8 @@
 #include <iostream>
 #include <ctime>
 
-#ifdef WIN32
+
+#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1900
 #include <omnithread/pthread_nt.h>
 #endif
 
index 1e96fd0fe25f2035effa01c5cc01aea4c730a7e5..34d29e13ca448897838f7545c83c62eb43998390 100644 (file)
 #include "Utils_SALOME_Exception.hxx"
 
 #include <sstream>
+#ifdef WIN32
+#include "DbgHelp.h"
+#include <WinBase.h>
+#pragma comment(lib, "Dbghelp.lib")
+#else
 #include <execinfo.h>
 #include <dlfcn.h>
 #include <cxxabi.h>
+#endif
 
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SALOME_Exception)
 
 //#define NBLINES_BACKTRACE 64
+#ifdef WIN32
+void printBacktrace(std::stringstream& txt)
+{
+       typedef USHORT(WINAPI *CaptureStackBackTraceType)(__in ULONG, __in ULONG, __out PVOID*, __out_opt PULONG);
+       CaptureStackBackTraceType func = (CaptureStackBackTraceType)(GetProcAddress(LoadLibrary("kernel32.dll"), "RtlCaptureStackBackTrace"));
+
+       if (func == NULL)
+               return;
+       const int kMaxCallers = 128;
+
+       void         * callers_stack[kMaxCallers];
+       unsigned short frames;
+       SYMBOL_INFO  * symbol;
+       HANDLE         process;
+       process = GetCurrentProcess();
+       SymInitialize(process, NULL, TRUE);
+       frames = (func)(0, kMaxCallers, callers_stack, NULL);
+       symbol = (SYMBOL_INFO *)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1);
+       symbol->MaxNameLen = 255;
+       symbol->SizeOfStruct = sizeof(SYMBOL_INFO);
 
+       const unsigned short  MAX_CALLERS_SHOWN = 64;
+       frames = frames < MAX_CALLERS_SHOWN ? frames : MAX_CALLERS_SHOWN;
+       for (unsigned int i = 0; i < frames; i++)
+       {
+               SymFromAddr(process, (DWORD64)(callers_stack[i]), 0, symbol);
+               txt << "*** " << i << ": " << callers_stack[i] << " " << symbol->Name << " - 0x" << symbol->Address << std::endl;
+       }
+
+       free(symbol);
+}
+#else
 void printBacktrace(void **stacklines, int nbLines, std::stringstream& txt)
 {
   char **stackSymbols = backtrace_symbols(stacklines, nbLines);
@@ -74,26 +111,36 @@ void printBacktrace(void **stacklines, int nbLines, std::stringstream& txt)
     }
   free(stackSymbols);
 }
+#endif
 
 void SalomeException ()
 {
+  std::stringstream txt;
+  txt << "Salome Exception" << std::endl;
+#ifdef WIN32
+  printBacktrace(txt);
+#else
   void *stacklines[64];
   size_t nbLines;
   nbLines = backtrace(stacklines, 64);
-  std::stringstream txt;
-  txt << "Salome Exception" << std::endl;
   printBacktrace(stacklines, nbLines, txt);
+#endif
   throw SALOME_Exception(txt.str().c_str());
 }
 
 void SALOME_SalomeException()
 {
+  std::stringstream txt;
+#ifdef WIN32
+  txt << "INTERNAL_ERROR, backtrace stack:" << std::endl;
+  printBacktrace(txt);
+#else
   void *stacklines[64];
   size_t nbLines;
   nbLines = backtrace(stacklines, 64);
-  std::stringstream txt;
   txt << "INTERNAL_ERROR, backtrace stack:" << nbLines << std::endl;
   printBacktrace(stacklines, nbLines, txt);
+#endif
   THROW_SALOME_CORBA_EXCEPTION(txt.str().c_str(), SALOME::INTERNAL_ERROR);
 }