From 67310f04cb592d0ff03edf5ce1a48c6c1cb3a3af Mon Sep 17 00:00:00 2001 From: rnv Date: Wed, 29 Aug 2018 14:47:50 +0300 Subject: [PATCH] SALOME 9.1.0 Windows version --- src/MEDWrapper/MED_Factory.cxx | 15 ++++++++++++- src/SMDS/SMDS_Position.hxx | 2 +- src/SMESH/CMakeLists.txt | 4 ++++ src/SMESH/SMESH_Gen.cxx | 12 +++++++++- src/SMESH/SMESH_subMesh.hxx | 2 +- src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx | 2 +- src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx | 2 +- src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx | 12 +++++++++- src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx | 2 +- src/SMESHGUI/SMESHGUI_MeshEditPreview.h | 8 +++---- src/SMESHUtils/SMESH_File.cxx | 23 +++++++++++++++++--- src/SMESH_I/SMESH_2smeshpy.cxx | 4 ++-- src/SMESH_I/SMESH_Gen_i.cxx | 14 +++++++++++- src/SMESH_SWIG_WITHIHM/CMakeLists.txt | 7 +++++- src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx | 5 +++-- src/Tools/MeshCut/MeshCut_Utils.cxx | 3 ++- 16 files changed, 94 insertions(+), 23 deletions(-) diff --git a/src/MEDWrapper/MED_Factory.cxx b/src/MEDWrapper/MED_Factory.cxx index 51fe44ce3..dbe60c051 100644 --- a/src/MEDWrapper/MED_Factory.cxx +++ b/src/MEDWrapper/MED_Factory.cxx @@ -37,12 +37,25 @@ extern "C" } #include +#ifdef WIN32 +#include +#endif + + namespace MED { bool exists(const std::string& fileName) { #ifdef WIN32 - return (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES); +#ifdef UNICODE + size_t length = strlen(fileName.c_str()) + sizeof(char); + wchar_t* path = new wchar_t[length]; + memset(path, '\0', length); + mbstowcs(path, fileName.c_str(), length); +#else + cosnt char* path = xmlPath.c_str(); +#endif + return (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES); #else return (access(fileName.c_str(), F_OK) == 0); #endif diff --git a/src/SMDS/SMDS_Position.hxx b/src/SMDS/SMDS_Position.hxx index 62c4042d3..31fdde7bc 100644 --- a/src/SMDS/SMDS_Position.hxx +++ b/src/SMDS/SMDS_Position.hxx @@ -54,7 +54,7 @@ class SMDS_EXPORT SMDS_Position */ template -class SMDS_EXPORT SMDS_Ptr : public std::unique_ptr< T > +class SMDS_Ptr : public std::unique_ptr< T > { bool myIsOwner; diff --git a/src/SMESH/CMakeLists.txt b/src/SMESH/CMakeLists.txt index 3e41c626a..fc119ed8f 100644 --- a/src/SMESH/CMakeLists.txt +++ b/src/SMESH/CMakeLists.txt @@ -110,6 +110,10 @@ SET(SMESHimpl_SOURCES # --- rules --- ADD_LIBRARY(SMESHimpl ${SMESHimpl_SOURCES}) +IF(WIN32) + TARGET_COMPILE_OPTIONS(SMESHimpl PRIVATE /bigobj) +ENDIF(WIN32) + TARGET_LINK_LIBRARIES(SMESHimpl ${_link_LIBRARIES} ) INSTALL(TARGETS SMESHimpl EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 4b5814c1f..574d4b3de 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -52,6 +52,8 @@ #include #endif +#include + using namespace std; //============================================================================= @@ -1029,7 +1031,15 @@ std::vector< std::string > SMESH_Gen::GetPluginXMLPaths() xmlPath += sep + plugin + ".xml"; bool fileOK; #ifdef WIN32 - fileOK = (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES); +#ifdef UNICODE + const wchar_t* path = Kernel_Utils::decode_s(xmlPath); +#else + const char* path = xmlPath.c_str(); +#endif + fileOK = (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES); +#ifdef UNICODE + delete path; +#endif #else fileOK = (access(xmlPath.c_str(), F_OK) == 0); #endif diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx index 9db6348cd..c91deb64c 100644 --- a/src/SMESH/SMESH_subMesh.hxx +++ b/src/SMESH/SMESH_subMesh.hxx @@ -48,7 +48,7 @@ class SMESH_Hypothesis; class SMESH_Mesh; class SMESH_subMesh; class SMESH_subMeshEventListener; -class SMESH_subMeshEventListenerData; +struct SMESH_subMeshEventListenerData; typedef SMESH_subMeshEventListener EventListener; typedef SMESH_subMeshEventListenerData EventListenerData; diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx index 43ffce19a..3b038c5ff 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx @@ -265,7 +265,7 @@ bool SMESHGUI_ConvToQuadOp::onApply() prop->Delete(); SMESH::MeshPreviewStruct_var previewData = aEditor->GetPreviewData(); - myBadElemsPreview->SetData( & previewData.in() ); + myBadElemsPreview->SetData( previewData._retn() ); myBadElemsPreview->SetVisibility(true); SUIT_MessageBox* mb = new SUIT_MessageBox(SUIT_MessageBox::Warning, diff --git a/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx b/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx index f3c23cfb5..701fef8e4 100644 --- a/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx @@ -536,7 +536,7 @@ void SMESHGUI_FindElemByPointOp::redisplayPreview() myPreview->nodesXYZ[0].z = myDlg->myZ->GetValue(); if (!mySimulation) mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); - mySimulation->SetData(&myPreview.in()); + mySimulation->SetData( myPreview._retn()); } //================================================================================ diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index f3176684a..7aff8c6ce 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -521,7 +521,17 @@ namespace SMESH try { // load plugin library if(MYDEBUG) MESSAGE("Loading client meshers plugin library ..."); - LibHandle libHandle = LoadLib( aClientLibName.toUtf8().data() ); +#ifdef WIN32 +#ifdef UNICODE + LPTSTR path = new TCHAR[aClientLibName.length() + 1]; + path[aClientLibName.toWCharArray(path)] = '\0'; +#else + const char* path = aClientLibName.toUtf8().data(); +#endif +#else + char* path = aClientLibName.toUtf8().data(); +#endif + LibHandle libHandle = LoadLib( path ); if (!libHandle) { // report any error, if occurred { diff --git a/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx b/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx index 7dca619fb..1e58474dd 100644 --- a/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx @@ -167,7 +167,7 @@ vtkIdType getCellType( const SMDSAbs_ElementType theType, */ //================================================================================ -void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct* previewData) +void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct_var previewData) { // Create points const SMESH::nodes_array& aNodesXYZ = previewData->nodesXYZ; diff --git a/src/SMESHGUI/SMESHGUI_MeshEditPreview.h b/src/SMESHGUI/SMESHGUI_MeshEditPreview.h index 5ae485a74..6d58999ad 100644 --- a/src/SMESHGUI/SMESHGUI_MeshEditPreview.h +++ b/src/SMESHGUI/SMESHGUI_MeshEditPreview.h @@ -37,10 +37,8 @@ class SVTK_ViewWindow; class vtkTextActor; class vtkUnstructuredGrid; -namespace SMESH -{ - class MeshPreviewStruct; -} +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) /*! * \brief Displayer of the mesh edition preview @@ -59,7 +57,7 @@ public: SMESHGUI_MeshEditPreview( SVTK_ViewWindow* ); ~SMESHGUI_MeshEditPreview(); - void SetData( const SMESH::MeshPreviewStruct* ); + void SetData( const SMESH::MeshPreviewStruct_var ); void SetVisibility( bool ); void SetColor( double, double, double ); diff --git a/src/SMESHUtils/SMESH_File.cxx b/src/SMESHUtils/SMESH_File.cxx index 556212201..2472d9eb3 100644 --- a/src/SMESHUtils/SMESH_File.cxx +++ b/src/SMESHUtils/SMESH_File.cxx @@ -36,6 +36,8 @@ #include +#include + namespace boofs = boost::filesystem; //================================================================================ @@ -79,9 +81,17 @@ bool SMESH_File::open() if ( !_map && length > 0 ) { #ifdef WIN32 - _file = CreateFile(_name.data(), GENERIC_READ, FILE_SHARE_READ, +#ifdef UNICODE + const wchar_t* name = Kernel_Utils::decode(_name.data()); +#else + char* name = name.data(); +#endif + _file = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); bool ok = ( _file != INVALID_HANDLE_VALUE ); +#ifdef UNICODE + delete name; +#endif #else _file = ::open(_name.data(), O_RDONLY ); bool ok = ( _file >= 0 ); @@ -291,14 +301,21 @@ bool SMESH_File::getInts(std::vector& ints) bool SMESH_File::openForWriting() { #ifdef WIN32 - - _file = CreateFile( _name.c_str(), // name of the write +#ifdef UNICODE + const wchar_t* name = Kernel_Utils::decode(_name.data()); +#else + char* name = name.data(); +#endif + _file = CreateFile( name, // name of the write GENERIC_WRITE, // open for writing 0, // do not share NULL, // default security OPEN_ALWAYS, // CREATE NEW or OPEN EXISTING FILE_ATTRIBUTE_NORMAL, // normal file NULL); // no attr. template +#ifdef UNICODE + delete name; +#endif return ( _file != INVALID_HANDLE_VALUE ); #else diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 18a393019..bad0a03da 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -1999,7 +1999,7 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) args.push_back( theCommand->GetArg( i ) ); } theCommand->RemoveArgs(); - for ( uint i = 0; i < args.size(); i++ ) + for ( unsigned int i = 0; i < args.size(); i++ ) theCommand->SetArg( i+1, args[i] ); if ( theCommand->GetNbArgs() == 4 ) { @@ -2039,7 +2039,7 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) args.push_back( theCommand->GetArg( i ) ); } theCommand->RemoveArgs(); - for ( uint i = 0; i < args.size(); i++ ) + for (unsigned int i = 0; i < args.size(); i++ ) theCommand->SetArg( i+1, args[i] ); // make the 1st arg be the last one (or last but three for ExportMED()) _pyID partID = theCommand->GetArg( 1 ); diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index f994b82f0..e7916cca3 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -439,7 +439,19 @@ GenericHypothesisCreator_i* SMESH_Gen_i::getHypothesisCreator(const char* theHyp { // load plugin library if(MYDEBUG) MESSAGE("Loading server meshers plugin library ..."); - LibHandle libHandle = LoadLib( aPlatformLibName.c_str() ); +#ifdef WIN32 +#ifdef UNICODE + const wchar_t* path = Kernel_Utils::decode_s(aPlatformLibName); +#else + const char* path = aPlatformLibName.c_str() +#endif +#else + const char* path = aPlatformLibName.c_str() +#endif + LibHandle libHandle = LoadLib( path ); +#if defined(WIN32) && defined(UNICODE) + delete path; +#endif if (!libHandle) { // report any error, if occurred diff --git a/src/SMESH_SWIG_WITHIHM/CMakeLists.txt b/src/SMESH_SWIG_WITHIHM/CMakeLists.txt index 9b52ec3bf..7ed537863 100644 --- a/src/SMESH_SWIG_WITHIHM/CMakeLists.txt +++ b/src/SMESH_SWIG_WITHIHM/CMakeLists.txt @@ -96,8 +96,13 @@ SET(_swig_SCRIPTS ) # --- rules --- +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(libSMESH_Swig python ${SMESH_Swig_SOURCES}) +ELSE() + SWIG_ADD_LIBRARY(libSMESH_Swig LANGUAGE python SOURCES ${SMESH_Swig_SOURCES}) +ENDIF() + -SWIG_ADD_MODULE(libSMESH_Swig python ${SMESH_Swig_SOURCES}) SWIG_LINK_LIBRARIES(libSMESH_Swig ${_link_LIBRARIES}) SWIG_CHECK_GENERATION(libSMESH_Swig) IF(WIN32) diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index f44a29d90..f5c61d97c 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx @@ -2047,8 +2047,9 @@ public: SVTK_IndexedMapOfIds idMap; selector->GetCompositeIndex( actor->getIO(), idMap ); - for ( int i = 1; i <= idMap.Extent(); i++ ) - myResult.push_back( std::make_pair( (int)idMap( i )[0], (int)idMap( i )[1]) ); + for ( int i = 1; i <= idMap.Extent(); i++ ) { + myResult.push_back( std::make_pair( (int)idMap(i)[0], (int)idMap(i)[1]) ); + } } }; diff --git a/src/Tools/MeshCut/MeshCut_Utils.cxx b/src/Tools/MeshCut/MeshCut_Utils.cxx index 3a41721ca..f8d26b366 100644 --- a/src/Tools/MeshCut/MeshCut_Utils.cxx +++ b/src/Tools/MeshCut/MeshCut_Utils.cxx @@ -25,6 +25,7 @@ #include #include #include +#include using namespace std; using namespace MESHCUT; @@ -924,7 +925,7 @@ void MESHCUT::champType(std::string type, med_entity_type MEM, med_geometry_type if (debug) { cout << endl << " Liste des valeurs du champ brut aux 3 premiers éléments:" << endl; - for (imaille = 0; imaille < min(nmailles, 3); imaille++) + for (imaille = 0; imaille < std::min(nmailles, 3); imaille++) { cout << " Maille " << imaille << endl; for (igauss = 0; igauss < ngauss; igauss++) -- 2.39.2