diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b015bff26f..0232a451da8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,7 +144,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) endif() if(CMAKE_COMPILER_IS_MSVC) - add_definitions("-DBOOST_ALL_NO_LIB -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX -DPCL_ONLY_CORE_POINT_TYPES ${SSE_DEFINITIONS}") + add_definitions("-DBOOST_ALL_NO_LIB -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX ${SSE_DEFINITIONS}") if("${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}") string(APPEND CMAKE_CXX_FLAGS " /fp:precise ${SSE_FLAGS} ${AVX_FLAGS}") diff --git a/cmake/pcl_targets.cmake b/cmake/pcl_targets.cmake index 2da076c23c5..ef83650813f 100644 --- a/cmake/pcl_targets.cmake +++ b/cmake/pcl_targets.cmake @@ -173,6 +173,7 @@ macro(PCL_ADD_INCLUDES _component _subdir) COMPONENT pcl_${_component}) endmacro() + ############################################################################### # Add a library target. # _name The library name. @@ -192,33 +193,41 @@ function(PCL_ADD_LIBRARY _name) message(FATAL_ERROR "PCL_ADD_LIBRARY requires parameter COMPONENT.") endif() - add_library(${_name} ${PCL_LIB_TYPE} ${ARGS_SOURCES}) - PCL_ADD_VERSION_INFO(${_name}) - target_compile_features(${_name} PUBLIC ${PCL_CXX_COMPILE_FEATURES}) + if(NOT ARGS_SOURCES) + add_library(${_name} INTERFACE) + else() + add_library(${_name} ${PCL_LIB_TYPE} ${ARGS_SOURCES}) - target_link_libraries(${_name} Threads::Threads) - if(TARGET OpenMP::OpenMP_CXX) - target_link_libraries(${_name} OpenMP::OpenMP_CXX) - endif() + PCL_ADD_VERSION_INFO(${_name}) - if((UNIX AND NOT ANDROID) OR MINGW) - target_link_libraries(${_name} m ${ATOMIC_LIBRARY}) - endif() + target_compile_features(${_name} PUBLIC ${PCL_CXX_COMPILE_FEATURES}) - if(MINGW) - target_link_libraries(${_name} gomp) - endif() + target_link_libraries(${_name} Threads::Threads) - if(MSVC) - target_link_libraries(${_name} delayimp.lib) # because delay load is enabled for openmp.dll - endif() + if(TARGET OpenMP::OpenMP_CXX) + target_link_libraries(${_name} OpenMP::OpenMP_CXX) + endif() - set_target_properties(${_name} PROPERTIES + if((UNIX AND NOT ANDROID) OR MINGW) + target_link_libraries(${_name} m ${ATOMIC_LIBRARY}) + endif() + + if(MINGW) + target_link_libraries(${_name} gomp) + endif() + + if(MSVC) + target_link_libraries(${_name} delayimp.lib) # because delay load is enabled for openmp.dll + endif() + + set_target_properties(${_name} PROPERTIES VERSION ${PCL_VERSION} SOVERSION ${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} DEFINE_SYMBOL "PCLAPI_EXPORTS") - set_target_properties(${_name} PROPERTIES FOLDER "Libraries") - + + set_target_properties(${_name} PROPERTIES FOLDER "Libraries") + endif() + install(TARGETS ${_name} RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT pcl_${ARGS_COMPONENT} LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT pcl_${ARGS_COMPONENT} diff --git a/features/CMakeLists.txt b/features/CMakeLists.txt index b5f902aece8..6bd6ff3bb85 100644 --- a/features/CMakeLists.txt +++ b/features/CMakeLists.txt @@ -14,23 +14,20 @@ endif() include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") -set(incs +set(LIB_NAME "pcl_${SUBSYS_NAME}") + +set(incs_lib1 "include/pcl/${SUBSYS_NAME}/boost.h" "include/pcl/${SUBSYS_NAME}/eigen.h" "include/pcl/${SUBSYS_NAME}/board.h" "include/pcl/${SUBSYS_NAME}/flare.h" "include/pcl/${SUBSYS_NAME}/brisk_2d.h" "include/pcl/${SUBSYS_NAME}/cppf.h" - "include/pcl/${SUBSYS_NAME}/cvfh.h" - "include/pcl/${SUBSYS_NAME}/our_cvfh.h" "include/pcl/${SUBSYS_NAME}/crh.h" "include/pcl/${SUBSYS_NAME}/don.h" "include/pcl/${SUBSYS_NAME}/feature.h" - "include/pcl/${SUBSYS_NAME}/fpfh.h" - "include/pcl/${SUBSYS_NAME}/fpfh_omp.h" "include/pcl/${SUBSYS_NAME}/from_meshes.h" "include/pcl/${SUBSYS_NAME}/gasd.h" - "include/pcl/${SUBSYS_NAME}/gfpfh.h" "include/pcl/${SUBSYS_NAME}/integral_image2D.h" "include/pcl/${SUBSYS_NAME}/integral_image_normal.h" "include/pcl/${SUBSYS_NAME}/intensity_gradient.h" @@ -44,45 +41,18 @@ set(incs "include/pcl/${SUBSYS_NAME}/normal_3d.h" "include/pcl/${SUBSYS_NAME}/normal_3d_omp.h" "include/pcl/${SUBSYS_NAME}/normal_based_signature.h" - "include/pcl/${SUBSYS_NAME}/organized_edge_detection.h" - "include/pcl/${SUBSYS_NAME}/pfh.h" - "include/pcl/${SUBSYS_NAME}/pfh_tools.h" - "include/pcl/${SUBSYS_NAME}/pfhrgb.h" - "include/pcl/${SUBSYS_NAME}/ppf.h" - "include/pcl/${SUBSYS_NAME}/ppfrgb.h" - "include/pcl/${SUBSYS_NAME}/shot.h" - "include/pcl/${SUBSYS_NAME}/shot_lrf.h" - "include/pcl/${SUBSYS_NAME}/shot_lrf_omp.h" - "include/pcl/${SUBSYS_NAME}/shot_omp.h" - "include/pcl/${SUBSYS_NAME}/spin_image.h" - "include/pcl/${SUBSYS_NAME}/principal_curvatures.h" - "include/pcl/${SUBSYS_NAME}/rift.h" - "include/pcl/${SUBSYS_NAME}/rops_estimation.h" - "include/pcl/${SUBSYS_NAME}/rsd.h" - "include/pcl/${SUBSYS_NAME}/grsd.h" - "include/pcl/${SUBSYS_NAME}/statistical_multiscale_interest_region_extraction.h" - "include/pcl/${SUBSYS_NAME}/vfh.h" - "include/pcl/${SUBSYS_NAME}/esf.h" - "include/pcl/${SUBSYS_NAME}/3dsc.h" - "include/pcl/${SUBSYS_NAME}/usc.h" "include/pcl/${SUBSYS_NAME}/boundary.h" - "include/pcl/${SUBSYS_NAME}/range_image_border_extractor.h" ) -set(impl_incs +set(impl_incs_lib1 "include/pcl/${SUBSYS_NAME}/impl/board.hpp" "include/pcl/${SUBSYS_NAME}/impl/flare.hpp" "include/pcl/${SUBSYS_NAME}/impl/brisk_2d.hpp" "include/pcl/${SUBSYS_NAME}/impl/cppf.hpp" - "include/pcl/${SUBSYS_NAME}/impl/cvfh.hpp" - "include/pcl/${SUBSYS_NAME}/impl/our_cvfh.hpp" "include/pcl/${SUBSYS_NAME}/impl/crh.hpp" "include/pcl/${SUBSYS_NAME}/impl/don.hpp" "include/pcl/${SUBSYS_NAME}/impl/feature.hpp" - "include/pcl/${SUBSYS_NAME}/impl/fpfh.hpp" - "include/pcl/${SUBSYS_NAME}/impl/fpfh_omp.hpp" "include/pcl/${SUBSYS_NAME}/impl/gasd.hpp" - "include/pcl/${SUBSYS_NAME}/impl/gfpfh.hpp" "include/pcl/${SUBSYS_NAME}/impl/integral_image2D.hpp" "include/pcl/${SUBSYS_NAME}/impl/integral_image_normal.hpp" "include/pcl/${SUBSYS_NAME}/impl/intensity_gradient.hpp" @@ -95,44 +65,19 @@ set(impl_incs "include/pcl/${SUBSYS_NAME}/impl/normal_3d.hpp" "include/pcl/${SUBSYS_NAME}/impl/normal_3d_omp.hpp" "include/pcl/${SUBSYS_NAME}/impl/normal_based_signature.hpp" - "include/pcl/${SUBSYS_NAME}/impl/organized_edge_detection.hpp" - "include/pcl/${SUBSYS_NAME}/impl/pfh.hpp" - "include/pcl/${SUBSYS_NAME}/impl/pfhrgb.hpp" - "include/pcl/${SUBSYS_NAME}/impl/ppf.hpp" - "include/pcl/${SUBSYS_NAME}/impl/ppfrgb.hpp" - "include/pcl/${SUBSYS_NAME}/impl/shot.hpp" - "include/pcl/${SUBSYS_NAME}/impl/shot_lrf.hpp" - "include/pcl/${SUBSYS_NAME}/impl/shot_lrf_omp.hpp" - "include/pcl/${SUBSYS_NAME}/impl/shot_omp.hpp" - "include/pcl/${SUBSYS_NAME}/impl/spin_image.hpp" - "include/pcl/${SUBSYS_NAME}/impl/principal_curvatures.hpp" - "include/pcl/${SUBSYS_NAME}/impl/rift.hpp" - "include/pcl/${SUBSYS_NAME}/impl/rops_estimation.hpp" - "include/pcl/${SUBSYS_NAME}/impl/rsd.hpp" - "include/pcl/${SUBSYS_NAME}/impl/grsd.hpp" - "include/pcl/${SUBSYS_NAME}/impl/statistical_multiscale_interest_region_extraction.hpp" - "include/pcl/${SUBSYS_NAME}/impl/vfh.hpp" - "include/pcl/${SUBSYS_NAME}/impl/esf.hpp" - "include/pcl/${SUBSYS_NAME}/impl/3dsc.hpp" - "include/pcl/${SUBSYS_NAME}/impl/usc.hpp" "include/pcl/${SUBSYS_NAME}/impl/boundary.hpp" - "include/pcl/${SUBSYS_NAME}/impl/range_image_border_extractor.hpp" ) -set(srcs +set(srcs_lib1 src/board.cpp src/flare.cpp src/brisk_2d.cpp src/boundary.cpp src/cppf.cpp - src/cvfh.cpp - src/our_cvfh.cpp src/crh.cpp src/don.cpp - src/fpfh.cpp src/from_meshes.cpp src/gasd.cpp - src/gfpfh.cpp src/integral_image_normal.cpp src/intensity_gradient.cpp src/intensity_spin.cpp @@ -143,25 +88,97 @@ set(srcs src/narf.cpp src/normal_3d.cpp src/normal_based_signature.cpp +) + +PCL_ADD_LIBRARY(${LIB_NAME}_lib1 COMPONENT ${SUBSYS_NAME} SOURCES ${srcs_lib1} ${incs_lib1} ${impl_incs_lib1}) +target_link_libraries(${LIB_NAME}_lib1 pcl_common pcl_search pcl_kdtree pcl_octree pcl_filters) + +set(incs_lib2 + "include/pcl/${SUBSYS_NAME}/3dsc.h" + "include/pcl/${SUBSYS_NAME}/cvfh.h" + "include/pcl/${SUBSYS_NAME}/esf.h" + "include/pcl/${SUBSYS_NAME}/fpfh.h" + "include/pcl/${SUBSYS_NAME}/fpfh_omp.h" + "include/pcl/${SUBSYS_NAME}/gfpfh.h" + "include/pcl/${SUBSYS_NAME}/grsd.h" + "include/pcl/${SUBSYS_NAME}/organized_edge_detection.h" + "include/pcl/${SUBSYS_NAME}/our_cvfh.h" + "include/pcl/${SUBSYS_NAME}/pfh.h" + "include/pcl/${SUBSYS_NAME}/pfh_tools.h" + "include/pcl/${SUBSYS_NAME}/pfhrgb.h" + "include/pcl/${SUBSYS_NAME}/ppf.h" + "include/pcl/${SUBSYS_NAME}/ppfrgb.h" + "include/pcl/${SUBSYS_NAME}/principal_curvatures.h" + "include/pcl/${SUBSYS_NAME}/range_image_border_extractor.h" + "include/pcl/${SUBSYS_NAME}/rift.h" + "include/pcl/${SUBSYS_NAME}/rops_estimation.h" + "include/pcl/${SUBSYS_NAME}/rsd.h" + "include/pcl/${SUBSYS_NAME}/shot.h" + "include/pcl/${SUBSYS_NAME}/shot_lrf.h" + "include/pcl/${SUBSYS_NAME}/shot_lrf_omp.h" + "include/pcl/${SUBSYS_NAME}/shot_omp.h" + "include/pcl/${SUBSYS_NAME}/spin_image.h" + "include/pcl/${SUBSYS_NAME}/statistical_multiscale_interest_region_extraction.h" + "include/pcl/${SUBSYS_NAME}/vfh.h" + "include/pcl/${SUBSYS_NAME}/usc.h" +) + +set(impl_incs_lib2 + "include/pcl/${SUBSYS_NAME}/impl/3dsc.hpp" + "include/pcl/${SUBSYS_NAME}/impl/cvfh.hpp" + "include/pcl/${SUBSYS_NAME}/impl/esf.hpp" + "include/pcl/${SUBSYS_NAME}/impl/fpfh.hpp" + "include/pcl/${SUBSYS_NAME}/impl/fpfh_omp.hpp" + "include/pcl/${SUBSYS_NAME}/impl/gfpfh.hpp" + "include/pcl/${SUBSYS_NAME}/impl/grsd.hpp" + "include/pcl/${SUBSYS_NAME}/impl/organized_edge_detection.hpp" + "include/pcl/${SUBSYS_NAME}/impl/our_cvfh.hpp" + "include/pcl/${SUBSYS_NAME}/impl/pfh.hpp" + "include/pcl/${SUBSYS_NAME}/impl/pfhrgb.hpp" + "include/pcl/${SUBSYS_NAME}/impl/ppf.hpp" + "include/pcl/${SUBSYS_NAME}/impl/ppfrgb.hpp" + "include/pcl/${SUBSYS_NAME}/impl/principal_curvatures.hpp" + "include/pcl/${SUBSYS_NAME}/impl/range_image_border_extractor.hpp" + "include/pcl/${SUBSYS_NAME}/impl/rift.hpp" + "include/pcl/${SUBSYS_NAME}/impl/rops_estimation.hpp" + "include/pcl/${SUBSYS_NAME}/impl/rsd.hpp" + "include/pcl/${SUBSYS_NAME}/impl/shot.hpp" + "include/pcl/${SUBSYS_NAME}/impl/shot_lrf.hpp" + "include/pcl/${SUBSYS_NAME}/impl/shot_lrf_omp.hpp" + "include/pcl/${SUBSYS_NAME}/impl/shot_omp.hpp" + "include/pcl/${SUBSYS_NAME}/impl/spin_image.hpp" + "include/pcl/${SUBSYS_NAME}/impl/statistical_multiscale_interest_region_extraction.hpp" + "include/pcl/${SUBSYS_NAME}/impl/vfh.hpp" + "include/pcl/${SUBSYS_NAME}/impl/usc.hpp" +) + +set(srcs_lib2 + src/3dsc.cpp + src/cvfh.cpp #depends on vfh and normalestimation(lib1) + src/esf.cpp + src/fpfh.cpp + src/gfpfh.cpp + src/grsd.cpp src/organized_edge_detection.cpp + src/our_cvfh.cpp src/pfh.cpp src/ppf.cpp - src/shot.cpp - src/shot_lrf.cpp - src/spin_image.cpp src/principal_curvatures.cpp + src/range_image_border_extractor.cpp src/rift.cpp src/rops_estimation.cpp src/rsd.cpp - src/grsd.cpp + src/shot.cpp + src/shot_lrf.cpp + src/spin_image.cpp src/statistical_multiscale_interest_region_extraction.cpp - src/vfh.cpp - src/esf.cpp - src/3dsc.cpp + src/vfh.cpp # depends on pfh src/usc.cpp - src/range_image_border_extractor.cpp ) +PCL_ADD_LIBRARY(${LIB_NAME}_lib2 COMPONENT ${SUBSYS_NAME} SOURCES ${srcs_lib2} ${incs_lib2} ${impl_incs_lib2}) +target_link_libraries(${LIB_NAME}_lib2 pcl_common pcl_search pcl_kdtree pcl_octree pcl_filters ${LIB_NAME}_lib1) + if(MSVC) # Workaround to avoid hitting the MSVC 4GB linker memory limit when building pcl_features. # Disable whole program optimization (/GL) and link-time code generation (/LTCG). @@ -169,10 +186,11 @@ if(MSVC) string(REPLACE "/LTCG" "" CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}) endif() -set(LIB_NAME "pcl_${SUBSYS_NAME}") -PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} SOURCES ${srcs} ${incs} ${impl_incs}) -target_link_libraries("${LIB_NAME}" pcl_common pcl_search pcl_kdtree pcl_octree pcl_filters) +PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME}) +target_link_libraries(${LIB_NAME} INTERFACE ${LIB_NAME}_lib1 ${LIB_NAME}_lib2) + PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS}) + # Install headers PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}" ${incs}) PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}/impl" ${impl_incs})