diff --git a/CMakeLists.txt b/CMakeLists.txt index d26642a52b..ab0ea3d23a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -261,6 +261,7 @@ OPTION(BUILD_JTREADER "Build the FreeCAD jt reader module" OFF) OPTION(BUILD_MATERIAL "Build the FreeCAD material module" ON) OPTION(BUILD_MESH "Build the FreeCAD mesh module" ON) OPTION(BUILD_MESH_PART "Build the FreeCAD mesh part module" ON) +OPTION(BUILD_FLAT_MESH "Build the FreeCAD flat mesh module" ON) OPTION(BUILD_OPENSCAD "Build the FreeCAD openscad module" ON) OPTION(BUILD_PART "Build the FreeCAD part module" ON) OPTION(BUILD_PART_DESIGN "Build the FreeCAD part design module" ON) @@ -342,6 +343,7 @@ REQUIRES_MODS(BUILD_IMPORT BUILD_PART) REQUIRES_MODS(BUILD_INSPECTION BUILD_MESH BUILD_POINTS BUILD_PART) REQUIRES_MODS(BUILD_JTREADER BUILD_MESH) REQUIRES_MODS(BUILD_MESH_PART BUILD_PART BUILD_MESH BUILD_SMESH) +REQUIRES_MODS(BUILD_FLAT_MESH BUILD_MESH_PART) REQUIRES_MODS(BUILD_OPENSCAD BUILD_MESH_PART BUILD_DRAFT) REQUIRES_MODS(BUILD_PART_DESIGN BUILD_SKETCHER) REQUIRES_MODS(BUILD_PATH BUILD_PART BUILD_ROBOT) diff --git a/src/Mod/MeshPart/App/CMakeLists.txt b/src/Mod/MeshPart/App/CMakeLists.txt index 3541a82d4b..ada204086b 100644 --- a/src/Mod/MeshPart/App/CMakeLists.txt +++ b/src/Mod/MeshPart/App/CMakeLists.txt @@ -74,59 +74,61 @@ 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 - ) +if (BUILD_FLAT_MESH) + if (FREECAD_USE_PYBIND11) + SET(FLATMESH_SRCS + MeshFlattening.cpp + MeshFlattening.h + MeshFlatteningNurbs.h + MeshFlatteningNurbs.cpp + MeshFlatteningLscmRelax.h + MeshFlatteningLscmRelax.cpp + MeshFlatteningPy.cpp + ) - add_library(flatmesh SHARED ${FLATMESH_SRCS}) - SET_PYTHON_PREFIX_SUFFIX(flatmesh) - target_link_libraries(flatmesh ${PYTHON_LIBRARIES} ${MeshPart_LIBS}) + add_library(flatmesh SHARED ${FLATMESH_SRCS}) + SET_PYTHON_PREFIX_SUFFIX(flatmesh) + target_link_libraries(flatmesh ${PYTHON_LIBRARIES} ${MeshPart_LIBS}) - SET_BIN_DIR(flatmesh flatmesh /Mod/MeshPart) - install(TARGETS flatmesh DESTINATION ${CMAKE_INSTALL_LIBDIR}) -else() - if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER) - # boost-python >= 1.67 on some platforms has suffix - set(BOOST_PY_SUFFIX ${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}) + SET_BIN_DIR(flatmesh flatmesh /Mod/MeshPart) + install(TARGETS flatmesh DESTINATION ${CMAKE_INSTALL_LIBDIR}) + else() + if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER) + # boost-python >= 1.67 on some platforms has suffix + set(BOOST_PY_SUFFIX ${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}) - find_package( Boost COMPONENTS python${BOOST_PY_SUFFIX} ) - if (NOT Boost_PYTHON${BOOST_PY_SUFFIX}_FOUND) - # try just the major version - find_package( Boost COMPONENTS python${PYTHON_VERSION_MAJOR} ) - if (NOT Boost_PYTHON${PYTHON_VERSION_MAJOR}_FOUND) - # unversioned - find_package( Boost COMPONENTS python REQUIRED) + find_package( Boost COMPONENTS python${BOOST_PY_SUFFIX} ) + if (NOT Boost_PYTHON${BOOST_PY_SUFFIX}_FOUND) + # try just the major version + find_package( Boost COMPONENTS python${PYTHON_VERSION_MAJOR} ) + if (NOT Boost_PYTHON${PYTHON_VERSION_MAJOR}_FOUND) + # unversioned + find_package( Boost COMPONENTS python REQUIRED) + endif() + endif() + + if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + SET(FLATMESH_SRCS + MeshFlattening.cpp + MeshFlattening.h + MeshFlatteningNurbs.h + MeshFlatteningNurbs.cpp + MeshFlatteningLscmRelax.h + MeshFlatteningLscmRelax.cpp + MeshFlatteningBoostPython.cpp + ) + + + add_library(flatmesh SHARED ${FLATMESH_SRCS}) + SET_PYTHON_PREFIX_SUFFIX(flatmesh) + target_link_libraries(flatmesh ${PYTHON_LIBRARIES} ${MeshPart_LIBS} ${Boost_LIBRARIES}) + + SET_BIN_DIR(flatmesh flatmesh /Mod/MeshPart) + install(TARGETS flatmesh DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() endif() - - if(Boost_FOUND) - include_directories(${Boost_INCLUDE_DIRS}) - SET(FLATMESH_SRCS - MeshFlattening.cpp - MeshFlattening.h - MeshFlatteningNurbs.h - MeshFlatteningNurbs.cpp - MeshFlatteningLscmRelax.h - MeshFlatteningLscmRelax.cpp - MeshFlatteningBoostPython.cpp - ) - - - add_library(flatmesh SHARED ${FLATMESH_SRCS}) - SET_PYTHON_PREFIX_SUFFIX(flatmesh) - target_link_libraries(flatmesh ${PYTHON_LIBRARIES} ${MeshPart_LIBS} ${Boost_LIBRARIES}) - - SET_BIN_DIR(flatmesh flatmesh /Mod/MeshPart) - install(TARGETS flatmesh DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() endif() -endif() +endif(BUILD_FLAT_MESH) ############################################################################