Files
create/src/Mod/ReverseEngineering/App/CMakeLists.txt
Markus Reitböck f523ab6ee3 ReverseEngineering: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
 should be considered an optimization, not a requirement. In particular, do not explicitly include a
 precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
 generated precompile header on the compiler command line instead. This is more portable across
 the major compilers and is likely to be easier to maintain. It will also avoid warnings being
 generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-23 22:39:35 +02:00

89 lines
2.1 KiB
CMake

if (PCL_SURFACE_FOUND AND PCL_FEATURES_FOUND)
add_definitions(-DHAVE_PCL_SURFACE)
if(EXISTS "${PCL_INCLUDE_DIRS}/pcl/surface/on_nurbs/fitting_surface_tdm.h")
add_definitions(-DHAVE_PCL_OPENNURBS)
endif()
endif ()
if (PCL_FILTERS_FOUND AND PCL_FEATURES_FOUND)
add_definitions(-DHAVE_PCL_FILTERS)
endif ()
if (PCL_SEGMENTATION_FOUND AND PCL_FEATURES_FOUND)
add_definitions(-DHAVE_PCL_SEGMENTATION)
endif ()
if (PCL_SAMPLE_CONSENSUS_FOUND)
add_definitions(-DHAVE_PCL_SAMPLE_CONSENSUS)
endif ()
set(Reen_LIBS
Part
Mesh
Points
FreeCADApp
${PCL_COMMON_LIBRARIES}
${PCL_KDTREE_LIBRARIES}
${PCL_FEATURES_LIBRARIES}
${PCL_FILTERS_LIBRARIES}
${PCL_SEARCH_LIBRARIES}
${PCL_SURFACE_LIBRARIES}
${PCL_SEGMENTATION_LIBRARIES}
${PCL_SAMPLE_CONSENSUS_LIBRARIES}
${QT_QTCORE_LIBRARY}
)
SET(Reen_SRCS
AppReverseEngineering.cpp
ApproxSurface.cpp
ApproxSurface.h
BSplineFitting.cpp
BSplineFitting.h
RegionGrowing.cpp
RegionGrowing.h
SampleConsensus.cpp
SampleConsensus.h
Segmentation.cpp
Segmentation.h
SurfaceTriangulation.cpp
SurfaceTriangulation.h
PreCompiled.h
)
add_library(ReverseEngineering SHARED ${Reen_SRCS})
if(FREECAD_USE_PCH)
target_precompile_headers(ReverseEngineering PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
target_include_directories(
ReverseEngineering
PRIVATE
${CMAKE_SOURCE_DIR}/src
)
target_include_directories(
ReverseEngineering
SYSTEM
PUBLIC
${PCL_INCLUDE_DIRS}
${FLANN_INCLUDE_DIRS}
)
target_link_libraries(ReverseEngineering ${Reen_LIBS})
if (MSVC)
target_compile_options(ReverseEngineering PRIVATE /wd4275)
endif()
if (FREECAD_WARN_ERROR)
target_compile_warn_error(ReverseEngineering)
endif()
SET_BIN_DIR(ReverseEngineering ReverseEngineering /Mod/ReverseEngineering)
SET_PYTHON_PREFIX_SUFFIX(ReverseEngineering)
INSTALL(TARGETS ReverseEngineering DESTINATION ${CMAKE_INSTALL_LIBDIR})