From: Viktor Uzlov Date: Wed, 24 Mar 2021 13:11:51 +0000 (+0300) Subject: fix for OS Windows X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=20e2c0f2d7a334dd2fa53e8aac05bb0a1a5687bf;p=modules%2Fsmesh.git fix for OS Windows --- diff --git a/src/SMESH/CMakeLists.txt b/src/SMESH/CMakeLists.txt index 55b8da584..3233847b9 100644 --- a/src/SMESH/CMakeLists.txt +++ b/src/SMESH/CMakeLists.txt @@ -114,7 +114,8 @@ SET(SMESHimpl_SOURCES ADD_LIBRARY(SMESHimpl ${SMESHimpl_SOURCES}) IF(WIN32) - TARGET_COMPILE_OPTIONS(SMESHimpl PRIVATE /bigobj) + TARGET_COMPILE_OPTIONS(SMESHimpl PRIVATE /bigobj) + ADD_DEFINITIONS(-DNOMINMAX) ENDIF(WIN32) TARGET_LINK_LIBRARIES(SMESHimpl ${_link_LIBRARIES} ) diff --git a/src/SMESH/MG_ADAPT.cxx b/src/SMESH/MG_ADAPT.cxx index 6282a600d..a691836d4 100644 --- a/src/SMESH/MG_ADAPT.cxx +++ b/src/SMESH/MG_ADAPT.cxx @@ -33,7 +33,12 @@ #include +#ifndef WIN32 #include // getpid() +#else +#include +#endif +#include #include // unique_ptr typedef SMESH_Comment ToComment; @@ -859,7 +864,17 @@ void MgAdapt::execCmd( const char* cmd, int& err) } std::ostream logStream(buf); + +#if defined(WIN32) +#if defined(INICODE) + std::unique_ptr pipe(_wopen(cmd, "r"), _pclose ); +#else + std::unique_ptr pipe(_popen(cmd, "r"), _pclose ); +#endif +#else std::unique_ptr pipe(popen(cmd, "r"), pclose ); +#endif + if(!pipe) { throw std::runtime_error("popen() failed!"); @@ -1084,7 +1099,11 @@ std::string MgAdapt::getFileName() const SMESH_Comment aGenericName( aTmpDir ); aGenericName << "MgAdapt_"; +#ifndef WIN32 aGenericName << getpid(); +#else +aGenericName << _getpid(); +#endif aGenericName << "_"; aGenericName << std::abs((int)(long) aGenericName.data()); diff --git a/src/SMESH/MG_ADAPT.hxx b/src/SMESH/MG_ADAPT.hxx index 9d11a5888..fd7cbada0 100644 --- a/src/SMESH/MG_ADAPT.hxx +++ b/src/SMESH/MG_ADAPT.hxx @@ -26,6 +26,8 @@ #include #include +#include "SMESH_SMESH.hxx" + namespace MEDCoupling { class MEDFileMesh; @@ -54,7 +56,7 @@ struct MgAdaptHypothesisData }; -class MgAdapt +class SMESH_EXPORT MgAdapt { public: