fix for OS Windows

This commit is contained in:
Viktor Uzlov 2021-03-24 16:11:51 +03:00
parent ccce4dbe25
commit 20e2c0f2d7
3 changed files with 24 additions and 2 deletions

View File

@ -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} )

View File

@ -33,7 +33,12 @@
#include <Utils_SALOME_Exception.hxx>
#ifndef WIN32
#include <unistd.h> // getpid()
#else
#include <process.h>
#endif
#include <array>
#include <memory> // 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 <FILE, decltype(&_pclose)> pipe(_wopen(cmd, "r"), _pclose );
#else
std::unique_ptr <FILE, decltype(&_pclose)> pipe(_popen(cmd, "r"), _pclose );
#endif
#else
std::unique_ptr <FILE, decltype(&pclose)> 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());

View File

@ -26,6 +26,8 @@
#include <vector>
#include <set>
#include "SMESH_SMESH.hxx"
namespace MEDCoupling
{
class MEDFileMesh;
@ -54,7 +56,7 @@ struct MgAdaptHypothesisData
};
class MgAdapt
class SMESH_EXPORT MgAdapt
{
public: