pkgsrc/graphics/pcl/patches/patch-surface_CMakeLists.txt
thor 93ca69daa3 graphics/pcl: enable visualization using VTK
This is a very common use-case and thus VTK is on by default. As there
are cases where you just need PCL for the data formats and algorithms,
it can be disabled.

There is another change pending to add Qt support to VTK, which will
be inherited here, as I am told the (a?) standard use case for VTK is via
Qt. The option is: Either just computations (headless) or the full
visualization stuff.
2021-05-07 11:36:29 +00:00

61 lines
2.1 KiB
Text

$NetBSD: patch-surface_CMakeLists.txt,v 1.1 2021/05/07 11:36:29 thor Exp $
Support VTK 9, from PR 4262
--- surface/CMakeLists.txt.orig 2020-08-14 12:23:03.000000000 +0000
+++ surface/CMakeLists.txt
@@ -4,7 +4,7 @@ set(SUBSYS_DEPS common search kdtree oct
set(build TRUE)
PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ON)
-PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS qhull)
+PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} EXT_DEPS vtk OPT_DEPS qhull)
PCL_ADD_DOC("${SUBSYS_NAME}")
@@ -149,19 +149,32 @@ set(impl_incs
)
set(LIB_NAME "pcl_${SUBSYS_NAME}")
+
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}"
)
-include_directories(SYSTEM
- ${VTK_INCLUDE_DIRS}
-)
-link_directories(${VTK_LIBRARY_DIRS})
PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} SOURCES ${srcs} ${incs} ${impl_incs} ${VTK_SMOOTHING_INCLUDES} ${POISSON_INCLUDES} ${OPENNURBS_INCLUDES} ${ON_NURBS_INCLUDES})
-target_link_libraries("${LIB_NAME}" pcl_common pcl_search pcl_kdtree pcl_octree ${VTK_LIBRARIES} ${ON_NURBS_LIBRARIES})
+
+target_link_libraries("${LIB_NAME}" pcl_common pcl_search pcl_kdtree pcl_octree ${ON_NURBS_LIBRARIES})
+
+if(VTK_FOUND)
+ if(${VTK_VERSION} VERSION_LESS 9.0)
+ include_directories(SYSTEM ${VTK_INCLUDE_DIRS})
+ link_directories(${VTK_LIBRARY_DIRS})
+ target_link_libraries("${LIB_NAME}" ${VTK_LIBRARIES})
+ else()
+ target_link_libraries("${LIB_NAME}" VTK::CommonDataModel
+ VTK::CommonExecutionModel
+ VTK::FiltersModeling
+ VTK::FiltersCore)
+ endif()
+endif()
+
if(QHULL_FOUND)
target_link_libraries("${LIB_NAME}" ${QHULL_LIBRARIES})
endif()
+
PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS})
# Install include files
@@ -178,6 +191,7 @@ endif()
if(VTK_FOUND AND NOT ANDROID)
PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}/vtk_smoothing" ${VTK_SMOOTHING_INCLUDES})
endif()
+
if(WIN32)
target_link_libraries("${LIB_NAME}" Rpcrt4.lib)
endif()