From: Yoann Audouin Date: Fri, 4 Nov 2022 16:22:45 +0000 (+0100) Subject: Disabling boost::filesystem for windows X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3c51726026865bf7f0f1ae6c83e24cc887001319;p=modules%2Fsmesh.git Disabling boost::filesystem for windows --- diff --git a/src/SMESH/SMESH_DriverShape.cxx b/src/SMESH/SMESH_DriverShape.cxx index c9db8372e..5568a2610 100644 --- a/src/SMESH/SMESH_DriverShape.cxx +++ b/src/SMESH/SMESH_DriverShape.cxx @@ -24,7 +24,6 @@ // Author : Yoann AUDOUIN, EDF // Module : SMESH // - #include #include #include "SMESH_DriverShape.hxx" @@ -41,9 +40,11 @@ //Occ include #include +#ifndef WIN32 #include #include namespace fs = boost::filesystem; +#endif /** * @brief Import the content of a shape file (STEP) into a TopDS_Shape object @@ -147,6 +148,7 @@ int exportBREPShape(const std::string shape_file, const TopoDS_Shape& aShape){ * @return error code */ int importShape(const std::string shape_file, TopoDS_Shape& aShape){ +#ifndef WIN32 std::string type = fs::path(shape_file).extension().string(); boost::algorithm::to_lower(type); if (type == ".brep"){ @@ -156,6 +158,7 @@ int importShape(const std::string shape_file, TopoDS_Shape& aShape){ } else { throw SALOME_Exception("Unknow format for importShape: " + type); } +#endif } /** @@ -167,6 +170,7 @@ int importShape(const std::string shape_file, TopoDS_Shape& aShape){ * @return error code */ int exportShape(const std::string shape_file, const TopoDS_Shape& aShape){ +#ifndef WIN32 std::string type = fs::path(shape_file).extension().string(); boost::algorithm::to_lower(type); if (type == ".brep"){ @@ -176,4 +180,5 @@ int exportShape(const std::string shape_file, const TopoDS_Shape& aShape){ } else { throw SALOME_Exception("Unknow format for exportShape: " + type); } +#endif } diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index fdacc7418..7a98988f9 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -25,7 +25,6 @@ // Author : Paul RASCLE, EDF // Module : SMESH // - //#define CHRONODEF // #ifndef WIN32 @@ -60,8 +59,10 @@ #include using namespace std; +#ifndef WIN32 #include namespace fs = boost::filesystem; +#endif // Environment variable separator #ifdef WIN32 @@ -280,6 +281,9 @@ bool SMESH_Gen::parallelComputeSubMeshes( const bool complexShapeFirst, const bool aShapeOnly) { +#ifdef WIN32 + throw SALOME_Exception("ParallelMesh is not working on Windows"); +#else bool ret = true; @@ -351,15 +355,9 @@ bool SMESH_Gen::parallelComputeSubMeshes( smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); continue; } -#ifdef WIN32 - compute_function(smToCompute, computeEvent, - shapeSM, aShapeOnly, allowedSubShapes, - aShapesId); -#else boost::asio::post(*(aMesh._pool), std::bind(compute_function, smToCompute, computeEvent, shapeSM, aShapeOnly, allowedSubShapes, aShapesId)); -#endif } // Waiting for the thread for Solids to finish @@ -369,6 +367,7 @@ bool SMESH_Gen::parallelComputeSubMeshes( aMesh.DeleteTmpFolder(); return ret; +#endif }; //============================================================================= diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 6c55d1e7b..46b98cdae 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -80,8 +80,10 @@ #include #endif +#ifndef WIN32 #include namespace fs=boost::filesystem; +#endif // maximum stored group name length in MED file #define MAX_MED_GROUP_NAME_LENGTH 80 @@ -236,10 +238,8 @@ SMESH_Mesh::~SMESH_Mesh() int result=pthread_create(&thread, NULL, deleteMeshDS, (void*)_meshDS); #endif } -#ifndef WIN32 if(_pool) DeletePoolThreads(); -#endif } //================================================================================ @@ -2578,9 +2578,11 @@ void SMESH_Mesh::getAncestorsSubMeshes (const TopoDS_Shape& theSubSha //============================================================================= void SMESH_Mesh::CreateTmpFolder() { +#ifndef WIN32 // Temporary folder that will be used by parallel computation tmp_folder = fs::temp_directory_path()/fs::unique_path(fs::path("SMESH_%%%%-%%%%")); fs::create_directories(tmp_folder); +#endif } // //============================================================================= @@ -2590,7 +2592,7 @@ void SMESH_Mesh::CreateTmpFolder() //============================================================================= void SMESH_Mesh::DeleteTmpFolder() { -#ifndef _DEBUG_ +#ifndef WIN32 fs::remove_all(tmp_folder); #endif } diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index ffce71417..42e5b4c92 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -29,7 +29,6 @@ #include "SMESH_SMESH.hxx" - #include "SMDSAbs_ElementType.hxx" #include "SMESH_ComputeError.hxx" #include "SMESH_Controls.hxx" @@ -49,11 +48,11 @@ #include #include -#include #ifndef WIN32 +#include #include -#include #endif +#include #ifdef WIN32 #pragma warning(disable:4251) // Warning DLL Interface ... @@ -422,10 +421,13 @@ class SMESH_EXPORT SMESH_Mesh void DeleteTmpFolder(); // Temporary folder used during parallel Computation +#ifndef WIN32 boost::filesystem::path tmp_folder; - #ifndef WIN32 boost::asio::thread_pool * _pool = nullptr; //thread pool for computation - #endif +#else + std::string tmp_folder; + bool _pool = false; +#endif private: diff --git a/test/SMESH_ParallelCompute.py b/test/SMESH_ParallelCompute.py index eeddd3f02..fccec1300 100644 --- a/test/SMESH_ParallelCompute.py +++ b/test/SMESH_ParallelCompute.py @@ -123,9 +123,11 @@ def run_test(nbox=2, boxsize=100): print("Time elapsed (seq, par): ", time_seq, time_par) def main(): + if sys.platform == "win32": + print("Test disabled on Windows") + return nbox = 2 boxsize = 100 run_test(nbox, boxsize) main() - diff --git a/test/netgen_runner.py b/test/netgen_runner.py index be8386fcb..76ec09d8b 100644 --- a/test/netgen_runner.py +++ b/test/netgen_runner.py @@ -126,4 +126,7 @@ def test_netgen3d(): assert nb_tetras > 0 if __name__ == "__main__": + if sys.platform == "win32": + print("Disabled on windows") + sys.exit(0) test_netgen3d()