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 );
${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)
${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})
#include <sstream>
#ifdef WIN32
static const char SEPARATOR = '\\';
+#include <process.h>
#else
static const char SEPARATOR = '/';
#endif
{
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;
#ifdef WIN32
#include <io.h>
#define _chmod chmod
+#include <process.h>
#endif
#include <sstream>
// 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();
#ifdef WIN32
#include <io.h>
#define _chmod chmod
+#include <process.h>
#endif
#include <sstream>
// 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(),
${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})
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}
# 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})
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);
}
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);
#include <vector>
#include "DF_Label.hxx"
+#ifdef WIN32
+# undef GetUserName
+#endif
+
class SALOMEDSIMPL_EXPORT SALOMEDSImpl_Tool
{
#define COMPILER "pgCC"
#elif defined ( __alpha )
#define COMPILER "cxx"
+#elif defined ( _MSC_VER )
+#define COMPILER "cl.exe"
#else
#define COMPILER "undefined"
#endif
#include <iostream>
#include <ctime>
-#ifdef WIN32
+
+#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1900
#include <omnithread/pthread_nt.h>
#endif
#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);
}
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);
}