From 43ee452778da6d2724fe8fe52f1baf5fa46f9013 Mon Sep 17 00:00:00 2001 From: rnv Date: Wed, 29 Aug 2018 14:23:17 +0300 Subject: [PATCH] SALOME 9.1.0 Windows version --- .../EntityGUI_FeatureDetectorDlg.cxx | 5 +++ src/GEOMUtils/GEOMUtils_XmlHandler.cxx | 33 ++++++++++++++++--- src/GEOM_I/GEOM_Gen_i.cc | 16 ++++++++- src/GEOM_SWIG_WITHIHM/CMakeLists.txt | 7 +++- src/XAO_Swig/CMakeLists.txt | 9 +++-- 5 files changed, 62 insertions(+), 8 deletions(-) diff --git a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx index 4a1ea5788..bca07be75 100644 --- a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx +++ b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx @@ -76,7 +76,12 @@ #include // boost includes +#include +#if BOOST_VERSION < 106700 #include +#else +#include +#endif // Constructors enum{ diff --git a/src/GEOMUtils/GEOMUtils_XmlHandler.cxx b/src/GEOMUtils/GEOMUtils_XmlHandler.cxx index dee3492cb..46ea3a8f9 100644 --- a/src/GEOMUtils/GEOMUtils_XmlHandler.cxx +++ b/src/GEOMUtils/GEOMUtils_XmlHandler.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -112,7 +112,21 @@ namespace xmlPath += sep; xmlPath += "share" + sep + "salome" + sep + "resources" + sep + "geom" + sep + plugin + ".xml"; #ifdef WIN32 - fileOK = (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES); + +#ifdef UNICODE + //RNV: this is workaround for providing compilation, + // path should be processed as unicode string. + size_t length = strlen(xmlPath.c_str()) + sizeof(char); + wchar_t* aPath = new wchar_t[length + 1]; + memset(aPath, '\0', length); + mbstowcs(aPath, xmlPath.c_str(), length); +#else + const char* aPath = xmlPath.c_str(); +#endif + fileOK = (GetFileAttributes(aPath) != INVALID_FILE_ATTRIBUTES); +#if UNICODE + delete aPath; +#endif #else fileOK = (access(xmlPath.c_str(), F_OK) == 0); #endif @@ -124,8 +138,19 @@ namespace if ( xmlPath[ xmlPath.size()-1 ] != sep[0] ) xmlPath += sep; xmlPath += "share" + sep + "salome" + sep + "resources" + sep + toLower(plugin) + sep + plugin + ".xml"; -#ifdef WIN32 - fileOK = (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES); +#ifdef WIN32 +#ifdef UNICODE + size_t length = strlen(xmlPath.c_str()) + sizeof(char); + wchar_t* aPath = new wchar_t[length+1]; + memset(aPath, '\0', length); + mbstowcs(aPath, xmlPath.c_str(), length); +#else + const char* aPath = xmlPath.c_str(); +#endif + fileOK = (GetFileAttributes(aPath) != INVALID_FILE_ATTRIBUTES); +#if UNICODE + delete aPath; +#endif #else fileOK = (access(xmlPath.c_str(), F_OK) == 0); #endif diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index b94e8619e..715328ce0 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -2510,8 +2510,22 @@ void GEOM_Gen_i::LoadPlugin(const std::string& theLibName) // check, if corresponding operations are already created if (myOpCreatorMap.find(theLibName) == myOpCreatorMap.end()) { +#ifdef UNICODE + //RNV: this is workaround for providing compilation, + // path should be processed as unicode string. + size_t length = strlen(aPlatformLibName.c_str()) + sizeof(char); + wchar_t* aPath = new wchar_t[length + 1]; + memset(aPath, '\0', length); + mbstowcs(aPath, aPlatformLibName.c_str(), length); +#else + const char* aPath = xmlPath.c_str(); +#endif // load plugin library - LibHandle libHandle = LoadLib( aPlatformLibName.c_str() ); +#if WIN32 + LibHandle libHandle = LoadLib(aPath); +#else + LibHandle libHandle = LoadLib(aPlatformLibName.c_str()); +#endif if (!libHandle) { // report any error, if occurred #ifndef WIN32 diff --git a/src/GEOM_SWIG_WITHIHM/CMakeLists.txt b/src/GEOM_SWIG_WITHIHM/CMakeLists.txt index 0e76c8e8e..b6ca5b2aa 100755 --- a/src/GEOM_SWIG_WITHIHM/CMakeLists.txt +++ b/src/GEOM_SWIG_WITHIHM/CMakeLists.txt @@ -74,7 +74,12 @@ SET(_swig_SCRIPTS # --- rules --- -SWIG_ADD_MODULE(libGEOM_Swig python libGEOM_Swig.i libGEOM_Swig.cxx) +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(libGEOM_Swig python libGEOM_Swig.i libGEOM_Swig.cxx) +ELSE() + SWIG_ADD_LIBRARY(libGEOM_Swig LANGUAGE python SOURCES libGEOM_Swig.i libGEOM_Swig.cxx) +ENDIF() + SWIG_LINK_LIBRARIES(libGEOM_Swig "${_link_LIBRARIES}") SWIG_CHECK_GENERATION(libGEOM_Swig) IF(WIN32) diff --git a/src/XAO_Swig/CMakeLists.txt b/src/XAO_Swig/CMakeLists.txt index 8d771be5c..b784acd2a 100644 --- a/src/XAO_Swig/CMakeLists.txt +++ b/src/XAO_Swig/CMakeLists.txt @@ -53,11 +53,16 @@ SET(_swig_SCRIPTS # swig flags SET_SOURCE_FILES_PROPERTIES(xao.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(xao.i PROPERTIES SWIG_FLAGS "-py3") -#SET_SOURCE_FILES_PROPERTIES(xao_wrap.cxx PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H") +SET_SOURCE_FILES_PROPERTIES(xao_wrap.cxx PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H") # --- rules --- +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(xao python xao.i) +ELSE() + SWIG_ADD_LIBRARY(xao LANGUAGE python SOURCES xao.i) +ENDIF() + -SWIG_ADD_MODULE(xao python xao.i) SWIG_LINK_LIBRARIES(xao "${_link_LIBRARIES}") SWIG_CHECK_GENERATION(xao) IF(WIN32)