Skip to content

Commit

Permalink
Fix linking with pcl_io_ply
Browse files Browse the repository at this point in the history
In case of static libraries. Fixes #4422
Mostly just of copy of the vcpkg patch (https://github.com/microsoft/vcpkg/blob/master/ports/pcl/io_ply.patch)
  • Loading branch information
mvieth committed Dec 22, 2024
1 parent 9f09199 commit ec7fdca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions PCLConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ list(APPEND PCL_COMPILE_OPTIONS @PCLCONFIG_SSE_COMPILE_OPTIONS@)
list(APPEND PCL_COMPILE_OPTIONS @PCLCONFIG_AVX_COMPILE_OPTIONS@)

set(pcl_all_components @PCLCONFIG_AVAILABLE_COMPONENTS@)
# insert "io_ply" before "io"
list(FIND pcl_all_components "io" pcl_pos_io)
list(INSERT pcl_all_components ${pcl_pos_io} "io_ply")
unset(pcl_pos_io)
list(LENGTH pcl_all_components PCL_NB_COMPONENTS)

#list each component dependencies IN PCL
Expand All @@ -446,6 +450,11 @@ list(LENGTH pcl_all_components PCL_NB_COMPONENTS)

@PCLCONFIG_OPTIONAL_DEPENDENCIES@

# io_ply subcomponent
list(APPEND pcl_io_int_dep io_ply)
set(pcl_io_ply_int_dep common)
set(pcl_io_ply_ext_dep boost)

# VTK components required by PCL
set(PCL_VTK_COMPONENTS "@PCL_VTK_COMPONENTS@")

Expand Down Expand Up @@ -503,18 +512,21 @@ foreach(component ${PCL_TO_FIND_COMPONENTS})

string(REGEX REPLACE "^cuda_(.*)$" "\\1" cuda_component "${component}")
string(REGEX REPLACE "^gpu_(.*)$" "\\1" gpu_component "${component}")
string(REGEX REPLACE "^io_(.*)$" "\\1" io_component "${component}")

find_path(PCL_${COMPONENT}_INCLUDE_DIR
NAMES pcl/${component}
pcl/apps/${component}
pcl/cuda/${cuda_component} pcl/cuda/${component}
pcl/gpu/${gpu_component} pcl/gpu/${component}
pcl/io/${io_component}
HINTS ${PCL_INCLUDE_DIRS}
PATH_SUFFIXES
${component}/include
apps/${component}/include
cuda/${cuda_component}/include
gpu/${gpu_component}/include
io/${io_component}/include
DOC "path to ${component} headers"
NO_DEFAULT_PATH)
mark_as_advanced(PCL_${COMPONENT}_INCLUDE_DIR)
Expand Down
3 changes: 3 additions & 0 deletions io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ endif()
PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}/ply" ${PLY_INCLUDES})
target_link_libraries(pcl_io_ply pcl_common Boost::boost)

PCL_MAKE_PKGCONFIG(pcl_io_ply COMPONENT ${SUBSYS_NAME} DESC "${SUBSYS_DESC}, PLY" PCL_DEPS common)

set(srcs
src/debayer.cpp
src/pcd_grabber.cpp
Expand Down Expand Up @@ -428,6 +430,7 @@ endif()
if(WITH_ENSENSO)
list(APPEND EXT_DEPS ensenso)
endif()
list(APPEND EXT_DEPS pcl_io_ply)

PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS} EXT_DEPS ${EXT_DEPS})

Expand Down

0 comments on commit ec7fdca

Please sign in to comment.