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
This commit is contained in:
wmayer
2018-04-28 12:10:55 +02:00
parent 2092afe07f
commit 68cc427b00
18 changed files with 71 additions and 70 deletions

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
SMESH_Version.h.cmake Normal file
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

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"

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>

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)

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

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;

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>

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>

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>

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>

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>

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);

View File

@@ -25,6 +25,7 @@ include_directories(
)
link_directories(${OCC_LIBRARY_DIR})
link_directories(${SMESH_LIB_PATH})
set(FemGui_LIBS

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
)

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>

View File

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

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