mirror of https://github.com/CGAL/cgal
Proposal for imported targets
This commit is contained in:
parent
2167d4ffef
commit
41519e3010
|
|
@ -0,0 +1,9 @@
|
||||||
|
if(Eigen_FOUND AND NOT TARGET CGAL::Eigen_support)
|
||||||
|
if(NOT TARGET Threads::Threads)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
endif()
|
||||||
|
add_library(CGAL::Eigen_support INTERFACE IMPORTED)
|
||||||
|
set_target_properties(CGAL::Eigen_support PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "CGAL_EIGEN3_ENABLED"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
if(LASLIB_FOUND AND NOT TARGET CGAL::LASLIB_support)
|
||||||
|
add_library(CGAL::LASLIB_support INTERFACE IMPORTED)
|
||||||
|
set_target_properties(CGAL::LASLIB_support PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_LASLIB"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${LASLIB_INCLUDE_DIR};${LASZIP_INCLUDE_DIR}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${LASLIB_LIBRARIES}")
|
||||||
|
endif()
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
if(OpenGR_FOUND AND NOT TARGET CGAL::OpenGR_support)
|
||||||
|
add_library(CGAL::OpenGR_support INTERFACE IMPORTED)
|
||||||
|
set_target_properties(CGAL::OpenGR_support PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_OPENGR"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${OpenGR_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
if(TBB_FOUND AND NOT TARGET CGAL::TBB_support)
|
||||||
|
if(NOT TARGET Threads::Threads)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
endif()
|
||||||
|
add_library(CGAL::TBB_support INTERFACE IMPORTED)
|
||||||
|
set_target_properties(CGAL::TBB_support PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_TBB;NOMINMAX"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${TBB_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "TBB:tbb;TBB:tbbmalloc;Threads::Threads")
|
||||||
|
endif()
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
if(libpointmatcher_FOUND AND NOT TARGET CGAL::pointmatcher_support)
|
||||||
|
add_library(CGAL::pointmatcher_support INTERFACE IMPORTED)
|
||||||
|
set_target_properties(CGAL::pointmatcher_support PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_POINTMATCHER"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${libpointmatcher_INCLUDE_DIR}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${libpointmatcher_LIBRARIES}")
|
||||||
|
endif()
|
||||||
|
|
@ -31,114 +31,101 @@ if ( CGAL_FOUND )
|
||||||
"Enable concurrency"
|
"Enable concurrency"
|
||||||
OFF)
|
OFF)
|
||||||
|
|
||||||
|
set(CGAL_libs CGAL::CGAL)
|
||||||
if( CGAL_ACTIVATE_CONCURRENT_PSP3 OR ENV{CGAL_ACTIVATE_CONCURRENT_PSP3} )
|
if( CGAL_ACTIVATE_CONCURRENT_PSP3 OR ENV{CGAL_ACTIVATE_CONCURRENT_PSP3} )
|
||||||
find_package( TBB REQUIRED )
|
find_package( TBB REQUIRED )
|
||||||
|
include(CGAL_TBB_support)
|
||||||
|
if (TARGET CGAL::TBB_support)
|
||||||
|
set(CGAL_TBB_target ${CGAL_libs} CGAL::TBB_support)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Executables that do *not* require EIGEN
|
# Executables that do *not* require EIGEN
|
||||||
create_single_source_cgal_program( "average_spacing_example.cpp" )
|
foreach(target
|
||||||
create_single_source_cgal_program( "bilateral_smooth_point_set_example.cpp" )
|
average_spacing_example
|
||||||
create_single_source_cgal_program( "grid_simplification_example.cpp" )
|
bilateral_smooth_point_set_example
|
||||||
create_single_source_cgal_program( "grid_simplify_indices.cpp" )
|
grid_simplification_example
|
||||||
create_single_source_cgal_program( "property_map.cpp" )
|
grid_simplify_indices
|
||||||
create_single_source_cgal_program( "random_simplification_example.cpp" )
|
property_map
|
||||||
create_single_source_cgal_program( "read_write_xyz_point_set_example.cpp" )
|
random_simplification_example
|
||||||
create_single_source_cgal_program( "remove_outliers_example.cpp" )
|
read_write_xyz_point_set_example
|
||||||
create_single_source_cgal_program( "wlop_simplify_and_regularize_point_set_example.cpp" )
|
remove_outliers_example
|
||||||
create_single_source_cgal_program( "edge_aware_upsample_point_set_example.cpp" )
|
wlop_simplify_and_regularize_point_set_example
|
||||||
create_single_source_cgal_program( "structuring_example.cpp" )
|
edge_aware_upsample_point_set_example
|
||||||
|
structuring_example
|
||||||
create_single_source_cgal_program( "read_ply_points_with_colors_example.cpp" )
|
read_ply_points_with_colors_example
|
||||||
create_single_source_cgal_program( "write_ply_points_example.cpp" )
|
write_ply_points_example)
|
||||||
|
add_executable(${target} "${target}.cpp")
|
||||||
|
target_link_libraries(${target} ${CGAL_libs})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
find_package(LASLIB)
|
find_package(LASLIB)
|
||||||
if (LASLIB_FOUND)
|
include(CGAL_LASLIB_support)
|
||||||
create_single_source_cgal_program( "read_las_example.cpp" )
|
if (TARGET CGAL::LASLIB_support)
|
||||||
CGAL_target_use_LASLIB(read_las_example)
|
add_executable( read_las_example "read_las_example.cpp" )
|
||||||
|
target_link_libraries(read_las_example ${CGAL_libs} CGAL::LASLIB_support)
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.")
|
message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use Eigen
|
# Use Eigen
|
||||||
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
|
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
|
||||||
if (EIGEN3_FOUND)
|
include(CGAL_Eigen_support)
|
||||||
|
if (TARGET CGAL::Eigen_support)
|
||||||
|
set(CGAL_libs ${CGAL_libs} CGAL::Eigen_support)
|
||||||
|
|
||||||
# Executables that require Eigen
|
# Executables that require Eigen
|
||||||
create_single_source_cgal_program( "jet_smoothing_example.cpp" )
|
foreach(target
|
||||||
CGAL_target_use_Eigen(jet_smoothing_example)
|
jet_smoothing_example
|
||||||
|
normal_estimation
|
||||||
|
edges_example
|
||||||
|
|
||||||
create_single_source_cgal_program( "normal_estimation.cpp" )
|
callback_example
|
||||||
CGAL_target_use_Eigen(normal_estimation)
|
scale_estimation_example
|
||||||
|
scale_estimation_2d_example
|
||||||
create_single_source_cgal_program( "edges_example.cpp" )
|
hierarchy_simplification_example
|
||||||
|
normals_example)
|
||||||
|
add_executable(${target} "${target}.cpp")
|
||||||
|
target_link_libraries(${target} ${CGAL_libs})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
# Executables that require libpointmatcher
|
# Executables that require libpointmatcher
|
||||||
find_package(libpointmatcher QUIET)
|
find_package(libpointmatcher QUIET)
|
||||||
if (libpointmatcher_FOUND)
|
include(CGAL_pointmatcher_support)
|
||||||
create_single_source_cgal_program( "registration_with_pointmatcher.cpp" )
|
if (TARGET CGAL::pointmatcher_support)
|
||||||
CGAL_target_use_pointmatcher(registration_with_pointmatcher)
|
add_executable(registration_with_pointmatcher "registration_with_pointmatcher.cpp")
|
||||||
CGAL_target_use_Eigen(registration_with_pointmatcher)
|
target_link_libraries(registration_with_pointmatcher
|
||||||
|
${CGAL_libs} CGAL::pointmatcher_support)
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE : the registration_with_pointmatcher test requires libpointmatcher and will not be compiled.")
|
message(STATUS "NOTICE : the registration_with_pointmatcher test requires libpointmatcher and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Executables that require OpenGR
|
# Executables that require OpenGR
|
||||||
find_package(OpenGR QUIET)
|
find_package(OpenGR QUIET)
|
||||||
if (OpenGR_FOUND)
|
include(CGAL_OpenGR_support)
|
||||||
create_single_source_cgal_program( "registration_with_OpenGR.cpp" )
|
if (TARGET CGAL::OpenGR_support)
|
||||||
CGAL_target_use_OpenGR(registration_with_OpenGR)
|
add_executable(registration_with_OpenGR "registration_with_OpenGR.cpp" )
|
||||||
CGAL_target_use_Eigen(registration_with_OpenGR)
|
target_link_libraries(registration_with_OpenGR
|
||||||
|
${CGAL_libs} CGAL::OpenGR_support)
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE : registration_with_OpenGR requires OpenGR, and will not be compiled.")
|
message(STATUS "NOTICE : registration_with_OpenGR requires OpenGR, and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Executables that require both libpointmatcher and OpenGR
|
# Executables that require both libpointmatcher and OpenGR
|
||||||
if (libpointmatcher_FOUND AND OpenGR_FOUND)
|
if (TARGET CGAL::pointmatcher_support AND
|
||||||
create_single_source_cgal_program( "registration_with_opengr_pointmatcher_pipeline.cpp" )
|
TARGET CGAL::OpenGR_support)
|
||||||
CGAL_target_use_OpenGR(registration_with_opengr_pointmatcher_pipeline)
|
add_executable(registration_with_opengr_pointmatcher_pipeline
|
||||||
CGAL_target_use_pointmatcher(registration_with_opengr_pointmatcher_pipeline)
|
"registration_with_opengr_pointmatcher_pipeline.cpp" )
|
||||||
CGAL_target_use_Eigen(registration_with_opengr_pointmatcher_pipeline)
|
target_link_libraries(registration_with_opengr_pointmatcher_pipeline
|
||||||
|
${CGAL_libs} CGAL::pointmatcher_support CGAL::OpenGR_support)
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE : registration_with_opengr_pointmatcher_pipeline requires libpointmatcher and OpenGR, and will not be compiled.")
|
message(STATUS "NOTICE : registration_with_opengr_pointmatcher_pipeline requires libpointmatcher and OpenGR, and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
CGAL_target_use_Eigen(edges_example)
|
|
||||||
|
|
||||||
create_single_source_cgal_program( "callback_example.cpp" )
|
|
||||||
CGAL_target_use_Eigen(callback_example)
|
|
||||||
|
|
||||||
create_single_source_cgal_program( "scale_estimation_example.cpp" )
|
|
||||||
CGAL_target_use_Eigen(scale_estimation_example)
|
|
||||||
|
|
||||||
create_single_source_cgal_program( "scale_estimation_2d_example.cpp" )
|
|
||||||
CGAL_target_use_Eigen(scale_estimation_2d_example)
|
|
||||||
|
|
||||||
create_single_source_cgal_program( "hierarchy_simplification_example.cpp" )
|
|
||||||
CGAL_target_use_Eigen(hierarchy_simplification_example)
|
|
||||||
|
|
||||||
create_single_source_cgal_program( "normals_example.cpp" )
|
|
||||||
CGAL_target_use_Eigen(normals_example)
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE: Some of the executables in this directory need Eigen 3.1 (or greater) and will not be compiled.")
|
message(STATUS "NOTICE: Some of the executables in this directory need Eigen 3.1 (or greater) and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (TBB_FOUND)
|
|
||||||
foreach(target
|
|
||||||
scale_estimation_example
|
|
||||||
wlop_simplify_and_regularize_point_set_example
|
|
||||||
bilateral_smooth_point_set_example
|
|
||||||
edge_aware_upsample_point_set_example
|
|
||||||
average_spacing_example
|
|
||||||
normals_example
|
|
||||||
jet_smoothing_example
|
|
||||||
normal_estimation
|
|
||||||
callback_example)
|
|
||||||
if(TARGET ${target})
|
|
||||||
CGAL_target_use_TBB(${target})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
|
message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue