Skip to content

Commit

Permalink
Merge pull request #2673 from SergioRAgostinho/compound-targets
Browse files Browse the repository at this point in the history
Add compound CMake target for examples, tools, apps.
  • Loading branch information
taketwo authored Dec 5, 2018
2 parents 3d16372 + e25a59f commit 6a6aacc
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 18 deletions.
12 changes: 11 additions & 1 deletion apps/3d_rec_framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ if(build)

PCL_MAKE_PKGCONFIG("${LIB_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" "" "" "" "" "")

add_subdirectory(tools)
if(QHULL_FOUND)
add_executable(pcl_global_classification src/tools/global_classification.cpp)
target_link_libraries(pcl_global_classification pcl_apps pcl_3d_rec_framework pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface)
endif()

pcl_add_executable(pcl_local_or_mian ${SUBSUBSYS_NAME} src/tools/local_recognition_mian_dataset.cpp)
target_link_libraries(pcl_local_or_mian pcl_apps pcl_3d_rec_framework pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints)

# Add to the compound apps target
string(TOUPPER ${SUBSUBSYS_NAME} SUBSUBSYS_NAME_UPPER)
list(APPEND PCL_APPS_ALL_TARGETS ${PCL_${SUBSUBSYS_NAME_UPPER}_ALL_TARGETS})
set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE)
endif()
1 change: 0 additions & 1 deletion apps/3d_rec_framework/tools/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions apps/3d_rec_framework/tools/apps/CMakeLists.txt

This file was deleted.

4 changes: 4 additions & 0 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS openni vtk

if(build)

# to be filled with all targets the apps subsystem
set(PCL_APPS_ALL_TARGETS)

include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include")

PCL_ADD_EXECUTABLE(pcl_test_search_speed "${SUBSYS_NAME}" src/test_search.cpp)
Expand Down Expand Up @@ -239,5 +242,6 @@ if(build)
PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}" ${incs})
PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}/impl" ${impl_incs})

add_custom_target(${SUBSYS_NAME} DEPENDS ${PCL_APPS_ALL_TARGETS})
endif()

3 changes: 3 additions & 0 deletions apps/cloud_composer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,7 @@ if(build)
set(VSP_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/supervoxels.h")
define_composer_tool (supervoxels "${VSP_SOURCES}" "${VSP_HEADERS}" "${VSP_DEPS}")

# Add to the compound apps target
list(APPEND PCL_APPS_ALL_TARGETS ${EXE_NAME})
set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE)
endif()
3 changes: 3 additions & 0 deletions apps/in_hand_scanner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,7 @@ if(build)
pcl_add_executable_opt_bundle(pcl_offline_integration "${SUBSUBSYS_NAME}" ${OI_SRCS} ${OI_INCS})
target_link_libraries(pcl_offline_integration ${SUBSUBSYS_LIBS} ${OPENGL_LIBRARIES} ${QT_LIBRARIES})

# Add to the compound apps target
list(APPEND PCL_APPS_ALL_TARGETS ${PCL_IN_HAND_SCANNER_ALL_TARGETS})
set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE)
endif()
4 changes: 3 additions & 1 deletion apps/modeler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ if(build)

PCL_MAKE_PKGCONFIG("${EXE_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" "" "" "" "" "")

add_subdirectory(tools)
# Add to the compound apps target
list(APPEND PCL_APPS_ALL_TARGETS ${EXE_NAME})
set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE)

endif()
2 changes: 0 additions & 2 deletions apps/modeler/tools/CMakeLists.txt

This file was deleted.

3 changes: 3 additions & 0 deletions apps/optronic_viewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,7 @@ if(build)

PCL_MAKE_PKGCONFIG("${EXE_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" "" "" "" "" "")

# Add to the compound apps target
list(APPEND PCL_APPS_ALL_TARGETS ${EXE_NAME})
set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE)
endif()
4 changes: 4 additions & 0 deletions apps/point_cloud_editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,8 @@ if(BUILD)

PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}" ${INCS})
PCL_MAKE_PKGCONFIG("${EXE_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" "" "" "" "" "")

# Add to the compound apps target
list(APPEND PCL_APPS_ALL_TARGETS ${EXE_NAME})
set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE)
endif()
10 changes: 10 additions & 0 deletions cmake/pcl_targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ macro(PCL_ADD_EXECUTABLE _name _component)
set(PCL_EXECUTABLES ${PCL_EXECUTABLES} ${_name})
install(TARGETS ${_name} RUNTIME DESTINATION ${BIN_INSTALL_DIR}
COMPONENT pcl_${_component})

string(TOUPPER ${_component} _component_upper)
list(APPEND PCL_${_component_upper}_ALL_TARGETS ${_name})
endmacro()

###############################################################################
Expand Down Expand Up @@ -323,6 +326,9 @@ if(APPLE AND VTK_USE_COCOA)
else()
install(TARGETS ${_name} RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT pcl_${_component})
endif()

string(TOUPPER ${_component} _component_upper)
list(APPEND PCL_${_component_upper}_ALL_TARGETS ${_name})
endmacro()


Expand Down Expand Up @@ -410,6 +416,10 @@ macro(PCL_ADD_EXAMPLE _name)
if(USE_PROJECT_FOLDERS)
set_target_properties(${_name} PROPERTIES FOLDER "Examples")
endif()

# add target to list of example targets created at the parent scope
list(APPEND PCL_EXAMPLES_ALL_TARGETS ${_name})
set(PCL_EXAMPLES_ALL_TARGETS "${PCL_EXAMPLES_ALL_TARGETS}" PARENT_SCOPE)
endmacro()

###############################################################################
Expand Down
7 changes: 5 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ PCL_SUBSYS_OPTION(build ${SUBSYS_NAME} ${SUBSYS_DESC} ${DEFAULT} ${REASON})
PCL_SUBSYS_DEPEND(build ${SUBSYS_NAME} DEPS ${SUBSYS_DEPS})

if(build)
# this variable will filled with all targets added with pcl_add_example
set(PCL_EXAMPLES_ALL_TARGETS)

include_directories(${PCL_INCLUDE_DIRS})
# This looks for all examples/XXX/CMakeLists.txt
file (GLOB examples_sbudirs */CMakeLists.txt)
Expand All @@ -22,10 +25,10 @@ if(build)
STRING(REGEX REPLACE ${name} "" dir ${absolute})
list(APPEND PCL_EXAMPLES_SUBDIRS ${dir})
endforeach()
# Display the found subdirectories
message(STATUS "PCL_EXAMPLES_SUBDIRS ${PCL_EXAMPLES_SUBDIRS}")
# Add the subdirectories
foreach(subdir ${PCL_EXAMPLES_SUBDIRS})
add_subdirectory(${subdir})
endforeach()

add_custom_target(${SUBSYS_NAME} DEPENDS ${PCL_EXAMPLES_ALL_TARGETS})
endif()
5 changes: 4 additions & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ PCL_SUBSYS_DEPEND (BUILD_tools "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${S

if(BUILD_tools)

# to be filled with all targets the tools subsystem
set(PCL_TOOLS_ALL_TARGETS)

PCL_ADD_EXECUTABLE(pcl_sac_segmentation_plane "${SUBSYS_NAME}" sac_segmentation_plane.cpp)
target_link_libraries(pcl_sac_segmentation_plane pcl_common pcl_io pcl_sample_consensus pcl_segmentation)

Expand Down Expand Up @@ -273,5 +276,5 @@ if(BUILD_tools)
${Tide_LIBRARIES})
endif()


add_custom_target(${SUBSYS_NAME} DEPENDS ${PCL_TOOLS_ALL_TARGETS})
endif()

0 comments on commit 6a6aacc

Please sign in to comment.