We have clarified our Privacy Statement even further. Please have a look at our changes.
Browse Source

Improve handling of external smesh

+ add SMESH_version.h.cmake to set full version number instead of using compiler define
+ do not set include path of smesh globally
+ do not set library path of smesh globally
+ do not set HAVE_NETGEN define globally
+ improve using debug and release libs of smesh for MSVC
master
wmayer 1 year ago
parent
commit
68cc427b00
18 changed files with 71 additions and 70 deletions
  1. +6
    -4
      CMakeLists.txt
  2. +12
    -0
      SMESH_Version.h.cmake
  3. +1
    -0
      src/Mod/Fem/App/AppFem.cpp
  4. +0
    -3
      src/Mod/Fem/App/AppFemPy.cpp
  5. +11
    -11
      src/Mod/Fem/App/CMakeLists.txt
  6. +2
    -2
      src/Mod/Fem/App/FemMesh.cpp
  7. +1
    -0
      src/Mod/Fem/App/FemMesh.h
  8. +1
    -3
      src/Mod/Fem/App/FemMeshPyImp.cpp
  9. +1
    -3
      src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp
  10. +0
    -3
      src/Mod/Fem/App/FemMeshShapeObject.cpp
  11. +1
    -3
      src/Mod/Fem/App/FemVTKTools.cpp
  12. +1
    -1
      src/Mod/Fem/App/HypothesisPy.cpp
  13. +2
    -1
      src/Mod/Fem/App/HypothesisPy.h
  14. +1
    -0
      src/Mod/Fem/Gui/CMakeLists.txt
  15. +23
    -31
      src/Mod/MeshPart/App/CMakeLists.txt
  16. +5
    -5
      src/Mod/MeshPart/App/Mesher.cpp
  17. +1
    -0
      src/Mod/MeshPart/App/Mesher.h
  18. +2
    -0
      src/Mod/MeshPart/Gui/CMakeLists.txt

+ 6
- 4
CMakeLists.txt View File

@@ -650,6 +650,9 @@ endif()
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?
set(SMESH_VERSION_MINOR 1)
set(SMESH_VERSION_PATCH 2)
set(SMESH_VERSION_TWEAK 2)

#if we use smesh we definitely also need vtk, no matter of external or internal smesh
set (VTK_COMPONENTS
@@ -740,11 +743,8 @@ endif()

else(NOT FREECAD_USE_EXTERNAL_SMESH)
find_package(SMESH CONFIG)
include_directories(${SMESH_INCLUDE_DIR})
link_directories(${SMESH_LIB_PATH})
set (SMESH_INCLUDE_DIR ${SMESH_INCLUDE_PATH})
SET(EXTERNAL_SMESH_LIBS ${SMESH_LIBRARIES})
add_definitions(-DHAVE_NETGEN)
add_definitions(-DSMESH_VERSION_MAJOR=${SMESH_VERSION_MAJOR})
if(NOT SMESH_FOUND)
message(ERROR "================\n"
"SMESH not found.\n"
@@ -752,7 +752,9 @@ endif()
endif()
include_directories(${SMESH_INCLUDE_DIR})
endif()

set(SMESH_FOUND TRUE)
configure_file(SMESH_Version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/SMESH_Version.h)
ENDIF(BUILD_SMESH)

# -------------------------------- Netgen --------------------------------

+ 12
- 0
SMESH_Version.h.cmake View File

@@ -0,0 +1,12 @@
#ifndef SMESH_VERSION_H
#define SMESH_VERSION_H

/* SMESH_Version.h. Generated from SMESH_Version.h.cmake by cmake. */

// SMESH version
#define SMESH_VERSION_MAJOR ${SMESH_VERSION_MAJOR}
#define SMESH_VERSION_MINOR ${SMESH_VERSION_MINOR}
#define SMESH_VERSION_PATCH ${SMESH_VERSION_PATCH}
#define SMESH_VERSION_TWEAK ${SMESH_VERSION_TWEAK}

#endif // SMESH_VERSION_H

+ 1
- 0
src/Mod/Fem/App/AppFem.cpp View File

@@ -30,6 +30,7 @@
#include <Base/Interpreter.h>
#include <CXX/Extensions.hxx>

#include <SMESH_Version.h>
#include "FemMeshPy.h"
#include "FemMesh.h"
#include "FemMeshProperty.h"

+ 0
- 3
src/Mod/Fem/App/AppFemPy.cpp View File

@@ -50,9 +50,6 @@
#include <StdMeshers_LocalLength.hxx>
#include <StdMeshers_NumberOfSegments.hxx>
#include <StdMeshers_AutomaticLength.hxx>
#if SMESH_VERSION_MAJOR < 7
#include <StdMeshers_TrianglePreference.hxx>
#endif
#include <StdMeshers_MEFISTO_2D.hxx>
#include <StdMeshers_Deflection1D.hxx>
#include <StdMeshers_MaxElementArea.hxx>

+ 11
- 11
src/Mod/Fem/App/CMakeLists.txt View File

@@ -28,23 +28,23 @@ include_directories(


link_directories(${OCC_LIBRARY_DIR})
link_directories(${SMESH_LIB_PATH})


set(Fem_LIBS
Part
FreeCADApp
StdMeshers
SMESH
SMDS
SMESHDS
)


if(BUILD_FEM_NETGEN)
list(APPEND Fem_LIBS
NETGENPlugin
)
endif(BUILD_FEM_NETGEN)
if (FREECAD_USE_EXTERNAL_SMESH)
list(APPEND Fem_LIBS ${EXTERNAL_SMESH_LIBS})
else()
if (BUILD_FEM_NETGEN)
list(APPEND Fem_LIBS StdMeshers SMESH SMDS SMESHDS NETGENPlugin)
else ()
list(APPEND Fem_LIBS StdMeshers SMESH SMDS SMESHDS)
endif()
endif()


generate_from_xml(FemMeshPy)
@@ -181,7 +181,7 @@ SET(Fem_SRCS


add_library(Fem SHARED ${Fem_SRCS})
target_link_libraries(Fem ${Fem_LIBS} ${VTK_LIBRARIES} ${EXTERNAL_SMESH_LIBS})
target_link_libraries(Fem ${Fem_LIBS} ${VTK_LIBRARIES})


SET_BIN_DIR(Fem Fem /Mod/Fem)

+ 2
- 2
src/Mod/Fem/App/FemMesh.cpp View File

@@ -50,7 +50,7 @@

#include "FemMesh.h"
#ifdef FC_USE_VTK
#include "FemVTKTools.h"
#include "FemVTKTools.h"
#endif

#include <boost/assign/list_of.hpp>
@@ -496,7 +496,7 @@ SMESH_Gen * FemMesh::getGenerator()
#if SMESH_VERSION_MAJOR < 7
return SMESH_Gen::get();
#else
if (! FemMesh::_mesh_gen)
if (!FemMesh::_mesh_gen)
FemMesh::_mesh_gen = new SMESH_Gen();
return FemMesh::_mesh_gen;
#endif

+ 1
- 0
src/Mod/Fem/App/FemMesh.h View File

@@ -31,6 +31,7 @@
#include <vector>
#include <list>
#include <boost/shared_ptr.hpp>
#include <SMESH_Version.h>

class SMESH_Gen;
class SMESH_Mesh;

+ 1
- 3
src/Mod/Fem/App/FemMeshPyImp.cpp View File

@@ -37,9 +37,7 @@
#include <SMDSAbs_ElementType.hxx>
#include <SMDS_MeshElement.hxx>
#include <SMDS_VolumeTool.hxx>
#if SMESH_VERSION_MAJOR >= 7
#include <SMESHDS_Mesh.hxx>
#endif
#include <SMESHDS_Mesh.hxx>

#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>

+ 1
- 3
src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp View File

@@ -34,9 +34,7 @@
#include <Base/Console.h>

#include <SMESH_Gen.hxx>
#if SMESH_VERSION_MAJOR >= 7
#include <SMESHDS_Mesh.hxx>
#endif
#include <SMESHDS_Mesh.hxx>

#include <SMESH_Mesh.hxx>
#include <SMDS_PolyhedralVolumeOfNodes.hxx>

+ 0
- 3
src/Mod/Fem/App/FemMeshShapeObject.cpp View File

@@ -61,9 +61,6 @@
#include <StdMeshers_QuadraticMesh.hxx>
#include <StdMeshers_RadialPrism_3D.hxx>
#include <StdMeshers_SegmentAroundVertex_0D.hxx>
#if SMESH_VERSION_MAJOR < 7
#include <StdMeshers_TrianglePreference.hxx>
#endif
#include <StdMeshers_ProjectionSource1D.hxx>
#include <StdMeshers_ProjectionSource2D.hxx>
#include <StdMeshers_ProjectionSource3D.hxx>

+ 1
- 3
src/Mod/Fem/App/FemVTKTools.cpp View File

@@ -53,9 +53,7 @@
#include <SMESH_Mesh.hxx>
#include <SMDS_PolyhedralVolumeOfNodes.hxx>
#include <SMDS_VolumeTool.hxx>
#if SMESH_VERSION_MAJOR >= 7
#include <SMESHDS_Mesh.hxx>
#endif
#include <SMESHDS_Mesh.hxx>

# include <TopoDS_Face.hxx>
# include <TopoDS_Solid.hxx>

+ 1
- 1
src/Mod/Fem/App/HypothesisPy.cpp View File

@@ -54,7 +54,7 @@
#include <StdMeshers_RadialPrism_3D.hxx>
#include <StdMeshers_SegmentAroundVertex_0D.hxx>
#if SMESH_VERSION_MAJOR < 7
#include <StdMeshers_TrianglePreference.hxx>
#include <StdMeshers_TrianglePreference.hxx>
#endif
#include <StdMeshers_ProjectionSource1D.hxx>
#include <StdMeshers_ProjectionSource2D.hxx>

+ 2
- 1
src/Mod/Fem/App/HypothesisPy.h View File

@@ -25,6 +25,7 @@

#include <CXX/Extensions.hxx>
#include <boost/shared_ptr.hpp>
#include <SMESH_Version.h>

class SMESH_Hypothesis;
class SMESH_Gen;
@@ -60,7 +61,7 @@ public:
Py::Object repr();
Py::Object getLibName(const Py::Tuple& args);
Py::Object setLibName(const Py::Tuple& args);
#ifndef EXTERNAL_SMESH
#if SMESH_VERSION_MAJOR < 7
Py::Object setParameters(const Py::Tuple& args);
Py::Object getParameters(const Py::Tuple& args);
Py::Object setLastParameters(const Py::Tuple& args);

+ 1
- 0
src/Mod/Fem/Gui/CMakeLists.txt View File

@@ -25,6 +25,7 @@ include_directories(
)

link_directories(${OCC_LIBRARY_DIR})
link_directories(${SMESH_LIB_PATH})


set(FemGui_LIBS

+ 23
- 31
src/Mod/MeshPart/App/CMakeLists.txt View File

@@ -13,6 +13,7 @@ if(BUILD_FEM_NETGEN)
endif(BUILD_FEM_NETGEN)

include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src
${Boost_INCLUDE_DIRS}
${OCC_INCLUDE_DIR}
@@ -26,31 +27,22 @@ include_directories(


link_directories(${OCC_LIBRARY_DIR})
link_directories(${SMESH_LIB_PATH})

set(MeshPart_LIBS
Part
Mesh
)

if(BUILD_FEM_NETGEN)
set(MeshPart_LIBS
Part
Mesh
StdMeshers
NETGENPlugin
SMESH
SMDS
)
elseif(BUILD_SMESH)
set(MeshPart_LIBS
Part
Mesh
StdMeshers
SMESH
SMDS
)
else(BUILD_FEM_NETGEN)
set(MeshPart_LIBS
Part
Mesh
)
endif(BUILD_FEM_NETGEN)
if (FREECAD_USE_EXTERNAL_SMESH)
list(APPEND MeshPart_LIBS ${EXTERNAL_SMESH_LIBS})
else()
if (BUILD_FEM_NETGEN)
list(APPEND MeshPart_LIBS StdMeshers NETGENPlugin SMESH SMDS)
elseif (BUILD_SMESH)
list(APPEND MeshPart_LIBS StdMeshers SMESH SMDS)
endif()
endif()


SET(MeshPart_SRCS
@@ -67,7 +59,7 @@ SET(MeshPart_SRCS
)

add_library(MeshPart SHARED ${MeshPart_SRCS})
target_link_libraries(MeshPart ${MeshPart_LIBS} ${EXTERNAL_SMESH_LIBS})
target_link_libraries(MeshPart ${MeshPart_LIBS})


fc_target_copy_resource(MeshPart
@@ -84,13 +76,13 @@ INSTALL(TARGETS MeshPart DESTINATION ${CMAKE_INSTALL_LIBDIR})
################################ flat mesh ###############################
if (FREECAD_USE_PYBIND11)
SET(FLATMESH_SRCS
MeshFlattening.cpp
MeshFlattening.h
MeshFlatteningNurbs.h
MeshFlatteningNurbs.cpp
MeshFlatteningLscmRelax.h
MeshFlatteningLscmRelax.cpp
MeshFlatteningPy.cpp
MeshFlattening.cpp
MeshFlattening.h
MeshFlatteningNurbs.h
MeshFlatteningNurbs.cpp
MeshFlatteningLscmRelax.h
MeshFlatteningLscmRelax.cpp
MeshFlatteningPy.cpp
)



+ 5
- 5
src/Mod/MeshPart/App/Mesher.cpp View File

@@ -40,14 +40,14 @@
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif
#include <SMESH_Gen.hxx>
#include <StdMeshers_MaxLength.hxx>
#include <SMESH_Mesh.hxx>
#include <SMESHDS_Mesh.hxx>
#if SMESH_VERSION_MAJOR >= 7
#include <SMESH_Mesh.hxx>
#include <SMESHDS_Mesh.hxx>
#else
#include <StdMeshers_TrianglePreference.hxx>
#if SMESH_VERSION_MAJOR < 7
#include <StdMeshers_TrianglePreference.hxx>
#endif
#include <StdMeshers_LocalLength.hxx>

+ 1
- 0
src/Mod/MeshPart/App/Mesher.h View File

@@ -25,6 +25,7 @@
#include <sstream>
#include <Base/Stream.h>
#include <SMESH_Version.h>
class TopoDS_Shape;
class SMESH_Gen;

+ 2
- 0
src/Mod/MeshPart/Gui/CMakeLists.txt View File

@@ -23,7 +23,9 @@ include_directories(
${PYTHON_INCLUDE_DIRS}
${XercesC_INCLUDE_DIRS}
)

link_directories(${OCC_LIBRARY_DIR})
link_directories(${SMESH_LIB_PATH})

set(MeshPartGui_LIBS
MeshPart

Loading…
Cancel
Save