diff --git a/CMakeLists.txt b/CMakeLists.txt index a6a7f7ebb9..e64353c578 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -648,6 +648,9 @@ endif() # Salome SMESH sources are under src/3rdParty now IF(BUILD_SMESH) + # set the internal smesh version: + set(SMESH_VERSION_MAJOR 5) # in src/3rdParty it says smesh is version 5.*, is this true? + #if we use smesh we definitely also need vtk, no matter of external or internal smesh set (VTK_COMPONENTS vtkCommonCore @@ -734,13 +737,14 @@ endif() endif() find_package(MEDFile REQUIRED) set(SMESH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc) + else(NOT FREECAD_USE_EXTERNAL_SMESH) find_package(SMESH CONFIG REQUIRED) include_directories(${SMESH_INCLUDE_DIR}) link_directories(${SMESH_LIB_PATH}) SET(EXTERNAL_SMESH_LIBS ${SMESH_LIBRARIES}) add_definitions(-DHAVE_NETGEN) - add_definitions(-DEXTERNAL_SMESH) + add_definitions(-DSMESH_VERSION_MAJOR=${SMESH_VERSION_MAJOR}) if(NOT SMESH_FOUND) message(ERROR "================\n" "SMESH not found.\n" diff --git a/src/Mod/Fem/App/AppFem.cpp b/src/Mod/Fem/App/AppFem.cpp index 7b33c0479c..297d79428a 100644 --- a/src/Mod/Fem/App/AppFem.cpp +++ b/src/Mod/Fem/App/AppFem.cpp @@ -119,7 +119,7 @@ PyMOD_INIT_FUNC(Fem) Fem::StdMeshers_SegmentAroundVertex_0DPy ::init_type(femModule); Fem::StdMeshers_SegmentLengthAroundVertexPy ::init_type(femModule); Fem::StdMeshers_StartEndLengthPy ::init_type(femModule); -#ifndef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR < 7 Fem::StdMeshers_TrianglePreferencePy ::init_type(femModule); #endif Fem::StdMeshers_Hexa_3DPy ::init_type(femModule); diff --git a/src/Mod/Fem/App/AppFemPy.cpp b/src/Mod/Fem/App/AppFemPy.cpp index d1880b680a..7a05bcec35 100644 --- a/src/Mod/Fem/App/AppFemPy.cpp +++ b/src/Mod/Fem/App/AppFemPy.cpp @@ -50,7 +50,7 @@ #include #include #include -#ifndef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR < 7 #include #endif #include diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp index 1086cfc7da..3ff5bb36dc 100644 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -90,7 +90,7 @@ using namespace Base; using namespace boost; static int StatCount = 0; -#ifdef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR >= 7 SMESH_Gen* FemMesh::_mesh_gen = 0; #endif @@ -493,7 +493,7 @@ SMESH_Mesh* FemMesh::getSMesh() SMESH_Gen * FemMesh::getGenerator() { -#ifndef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR < 7 return SMESH_Gen::get(); #else if (! FemMesh::_mesh_gen) @@ -1165,7 +1165,7 @@ void FemMesh::read(const char *FileName) // read brep-file myMesh->STLToMesh(File.filePath().c_str()); } -#ifndef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR < 7 else if (File.hasExtension("dat") ) { // read brep-file // vejmarie disable diff --git a/src/Mod/Fem/App/FemMesh.h b/src/Mod/Fem/App/FemMesh.h index 4eb17869df..e335e9c867 100644 --- a/src/Mod/Fem/App/FemMesh.h +++ b/src/Mod/Fem/App/FemMesh.h @@ -160,7 +160,7 @@ private: SMESH_Mesh *myMesh; std::list hypoth; -#ifdef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR >= 7 static SMESH_Gen *_mesh_gen; #endif }; diff --git a/src/Mod/Fem/App/FemMeshPyImp.cpp b/src/Mod/Fem/App/FemMeshPyImp.cpp index 5c4a37e3b1..70fc732c5e 100644 --- a/src/Mod/Fem/App/FemMeshPyImp.cpp +++ b/src/Mod/Fem/App/FemMeshPyImp.cpp @@ -37,7 +37,7 @@ #include #include #include -#ifdef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR >= 7 #include #endif diff --git a/src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp b/src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp index 4c70a7108c..a30b677852 100644 --- a/src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp +++ b/src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp @@ -34,7 +34,7 @@ #include #include -#ifdef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR >= 7 #include #endif diff --git a/src/Mod/Fem/App/FemMeshShapeObject.cpp b/src/Mod/Fem/App/FemMeshShapeObject.cpp index df75a20026..a2c690f101 100644 --- a/src/Mod/Fem/App/FemMeshShapeObject.cpp +++ b/src/Mod/Fem/App/FemMeshShapeObject.cpp @@ -61,7 +61,7 @@ #include #include #include -#ifndef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR < 7 #include #endif #include diff --git a/src/Mod/Fem/App/FemVTKTools.cpp b/src/Mod/Fem/App/FemVTKTools.cpp index 73f615d0cd..1e8286eebe 100644 --- a/src/Mod/Fem/App/FemVTKTools.cpp +++ b/src/Mod/Fem/App/FemVTKTools.cpp @@ -53,7 +53,7 @@ #include #include #include -#ifdef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR >= 7 #include #endif diff --git a/src/Mod/Fem/App/HypothesisPy.cpp b/src/Mod/Fem/App/HypothesisPy.cpp index 14006a18b7..99f90cd34a 100755 --- a/src/Mod/Fem/App/HypothesisPy.cpp +++ b/src/Mod/Fem/App/HypothesisPy.cpp @@ -53,7 +53,7 @@ #include #include #include -#ifndef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR < 7 #include #endif #include @@ -89,7 +89,7 @@ void SMESH_HypothesisPy::init_type(PyObject* module) SMESH_HypothesisPy::add_varargs_method("setLibName", &SMESH_HypothesisPy::setLibName, "setLibName(String)"); SMESH_HypothesisPy::add_varargs_method("getLibName", &SMESH_HypothesisPy::getLibName, "String getLibName()"); -#ifndef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR < 7 SMESH_HypothesisPy::add_varargs_method("setParameters", &SMESH_HypothesisPy::setParameters, "setParameters(String)"); SMESH_HypothesisPy::add_varargs_method("getParameters", &SMESH_HypothesisPy::getParameters, "String getParameters()"); SMESH_HypothesisPy::add_varargs_method("setLastParameters", &SMESH_HypothesisPy::setLastParameters, "setLastParameters(String)"); @@ -145,7 +145,7 @@ Py::Object SMESH_HypothesisPy::getLibName(const Py::Tuple& args) } -#ifndef EXTERNAL_SMESH ////////////////////////////////////////////////////////// +#if SMESH_VERSION_MAJOR < 7 ////////////////////////////////////////////////////////// template Py::Object SMESH_HypothesisPy::setParameters(const Py::Tuple& args) { @@ -653,7 +653,7 @@ StdMeshers_Hexa_3DPy::~StdMeshers_Hexa_3DPy() // ---------------------------------------------------------------------------- -#ifndef EXTERNAL_SMESH /////////////////////////////////////////////////////////// +#if SMESH_VERSION_MAJOR < 7 /////////////////////////////////////////////////////////// void StdMeshers_TrianglePreferencePy::init_type(PyObject* module) { behaviors().name("StdMeshers_TrianglePreference"); diff --git a/src/Mod/Fem/App/HypothesisPy.h b/src/Mod/Fem/App/HypothesisPy.h index be0f5947bd..ed8db84ca2 100755 --- a/src/Mod/Fem/App/HypothesisPy.h +++ b/src/Mod/Fem/App/HypothesisPy.h @@ -221,7 +221,7 @@ public: StdMeshers_Hexa_3DPy(int hypId, int studyId, SMESH_Gen* gen); ~StdMeshers_Hexa_3DPy(); }; -#ifndef EXTERNAL_SMESH /////////////////////////////////////////////////////////////////////////////// +#if SMESH_VERSION_MAJOR < 7 /////////////////////////////////////////////////////////////////////////////// class StdMeshers_TrianglePreferencePy : public SMESH_HypothesisPy { public: diff --git a/src/Mod/MeshPart/App/Mesher.cpp b/src/Mod/MeshPart/App/Mesher.cpp index b488b2f70e..a8bdbfa732 100644 --- a/src/Mod/MeshPart/App/Mesher.cpp +++ b/src/Mod/MeshPart/App/Mesher.cpp @@ -43,7 +43,7 @@ #include #include -#ifdef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR >= 7 #include #include #else @@ -75,7 +75,7 @@ using namespace MeshPart; -#ifdef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR >= 7 SMESH_Gen* Mesher::_mesh_gen = 0; #endif @@ -323,7 +323,7 @@ Mesh::MeshObject* Mesher::createMesh() const #else std::list hypoth; -#ifndef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR < 7 SMESH_Gen* meshgen = SMESH_Gen::get(); #else if (! Mesher::_mesh_gen) @@ -406,7 +406,7 @@ Mesh::MeshObject* Mesher::createMesh() const StdMeshers_Regular_1D* hyp1d = new StdMeshers_Regular_1D(hyp++,0,meshgen); hypoth.push_back(hyp1d); } -#ifndef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR < 7 StdMeshers_TrianglePreference* hyp2d_1 = new StdMeshers_TrianglePreference(hyp++,0,meshgen); hypoth.push_back(hyp2d_1); #endif diff --git a/src/Mod/MeshPart/App/Mesher.h b/src/Mod/MeshPart/App/Mesher.h index c3c1822381..079454a080 100644 --- a/src/Mod/MeshPart/App/Mesher.h +++ b/src/Mod/MeshPart/App/Mesher.h @@ -154,7 +154,7 @@ private: std::vector colors; struct Vertex; -#ifdef EXTERNAL_SMESH +#if SMESH_VERSION_MAJOR >= 7 static SMESH_Gen *_mesh_gen; #endif };