fixed cmakelists

This commit is contained in:
Dmitry Anisimov 2021-08-04 15:26:18 +02:00
parent 77f686242d
commit 017ba35bfa
3 changed files with 107 additions and 121 deletions

View File

@ -6,32 +6,28 @@ project(Shape_regularization_Benchmarks)
cmake_minimum_required(VERSION 3.1...3.15) cmake_minimum_required(VERSION 3.1...3.15)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
find_package(CGAL QUIET COMPONENTS Core) find_package(CGAL REQUIRED)
if(CGAL_FOUND) message(STATUS "Found CGAL")
message(STATUS "Found CGAL")
include(${CGAL_USE_FILE}) include(${CGAL_USE_FILE})
include(CGAL_CreateSingleSourceCGALProgram) include(CGAL_CreateSingleSourceCGALProgram)
# Find OSQP library and headers. # Find OSQP library and headers.
find_package(OSQP QUIET) find_package(OSQP QUIET)
include(CGAL_OSQP_support) include(CGAL_OSQP_support)
if(TARGET CGAL::OSQP_support) if(TARGET CGAL::OSQP_support)
message(STATUS "Found OSQP") message(STATUS "Found OSQP")
set(osqp_targets set(osqp_targets
benchmark_contours benchmark_contours
benchmark_qp_segments) benchmark_qp_segments)
foreach(osqp_target ${osqp_targets}) foreach(osqp_target ${osqp_targets})
create_single_source_cgal_program("${osqp_target}.cpp") create_single_source_cgal_program("${osqp_target}.cpp")
if(TARGET ${osqp_target}) if(TARGET ${osqp_target})
target_link_libraries(${osqp_target} PUBLIC CGAL::OSQP_support) target_link_libraries(${osqp_target} PUBLIC CGAL::OSQP_support)
endif() endif()
endforeach() endforeach()
else()
message(STATUS "NOTICE: OSQP was not found. OSQP benchmarks won't be available.")
endif()
else() else()
message(WARNING "This program requires the CGAL library, and will not be compiled.") message(NOTICE "OSQP was not found. OSQP benchmarks won't be available.")
endif() endif()

View File

@ -6,52 +6,47 @@ project(Shape_regularization_Examples)
cmake_minimum_required(VERSION 3.1...3.15) cmake_minimum_required(VERSION 3.1...3.15)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
find_package(CGAL QUIET COMPONENTS Core) find_package(CGAL REQUIRED)
if(CGAL_FOUND) message(STATUS "Found CGAL")
message(STATUS "Found CGAL")
include(${CGAL_USE_FILE}) include(${CGAL_USE_FILE})
include(CGAL_CreateSingleSourceCGALProgram) include(CGAL_CreateSingleSourceCGALProgram)
# Find OSQP library and headers. # Find OSQP library and headers.
find_package(OSQP QUIET) find_package(OSQP QUIET)
include(CGAL_OSQP_support) include(CGAL_OSQP_support)
if(TARGET CGAL::OSQP_support) if(TARGET CGAL::OSQP_support)
message(STATUS "Found OSQP") message(STATUS "Found OSQP")
set(osqp_targets set(osqp_targets
regularize_15_segments regularize_15_segments
regularize_100_segments_angles regularize_100_segments_angles
regularize_100_segments_offsets regularize_100_segments_offsets
regularize_simple) regularize_simple)
foreach(osqp_target ${osqp_targets}) foreach(osqp_target ${osqp_targets})
create_single_source_cgal_program("${osqp_target}.cpp") create_single_source_cgal_program("${osqp_target}.cpp")
if(TARGET ${osqp_target}) if(TARGET ${osqp_target})
target_link_libraries(${osqp_target} PUBLIC CGAL::OSQP_support) target_link_libraries(${osqp_target} PUBLIC CGAL::OSQP_support)
endif()
endforeach()
# Use Eigen.
find_package(Eigen3 REQUIRED)
include(CGAL_Eigen3_support)
if(TARGET CGAL::Eigen3_support)
message(STATUS "Found Eigen")
create_single_source_cgal_program("regularize_real_data_2.cpp")
target_link_libraries(regularize_real_data_2 PUBLIC CGAL::Eigen3_support CGAL::OSQP_support)
else()
message(STATUS "NOTICE: Eigen was not found. Eigen examples won't be available.")
endif() endif()
endforeach()
# Use Eigen.
find_package(Eigen3 REQUIRED)
include(CGAL_Eigen3_support)
if(TARGET CGAL::Eigen3_support)
message(STATUS "Found Eigen")
create_single_source_cgal_program("regularize_real_data_2.cpp")
target_link_libraries(regularize_real_data_2 PUBLIC CGAL::Eigen3_support CGAL::OSQP_support)
else() else()
message(STATUS "NOTICE: OSQP was not found. OSQP examples won't be available.") message(NOTICE "Eigen was not found. Eigen examples won't be available.")
endif() endif()
create_single_source_cgal_program("regularize_framework.cpp")
create_single_source_cgal_program("regularize_planes.cpp")
create_single_source_cgal_program("regularize_contour.cpp")
create_single_source_cgal_program("regularize_closed_contour.cpp")
create_single_source_cgal_program("regularize_open_contour.cpp")
else() else()
message(WARNING "This program requires the CGAL library, and will not be compiled.") message(NOTICE "OSQP was not found. OSQP examples won't be available.")
endif() endif()
create_single_source_cgal_program("regularize_framework.cpp")
create_single_source_cgal_program("regularize_planes.cpp")
create_single_source_cgal_program("regularize_contour.cpp")
create_single_source_cgal_program("regularize_closed_contour.cpp")
create_single_source_cgal_program("regularize_open_contour.cpp")

View File

@ -6,68 +6,63 @@ project(Shape_regularization_Tests)
cmake_minimum_required(VERSION 3.1...3.15) cmake_minimum_required(VERSION 3.1...3.15)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
find_package(CGAL QUIET COMPONENTS Core) find_package(CGAL REQUIRED)
if(CGAL_FOUND) message(STATUS "Found CGAL")
message(STATUS "Found CGAL")
include(${CGAL_USE_FILE}) include(${CGAL_USE_FILE})
include(CGAL_CreateSingleSourceCGALProgram) include(CGAL_CreateSingleSourceCGALProgram)
# Find OSQP library and headers. # Find OSQP library and headers.
find_package(OSQP QUIET) find_package(OSQP QUIET)
include(CGAL_OSQP_support) include(CGAL_OSQP_support)
if(TARGET CGAL::OSQP_support) if(TARGET CGAL::OSQP_support)
message(STATUS "Found OSQP") message(STATUS "Found OSQP")
set(osqp_targets set(osqp_targets
test_segments test_segments
test_overloads test_overloads
test_0_segments test_0_segments
test_1_segment test_1_segment
test_2_segments test_2_segments
test_3_segments test_3_segments
test_4_segments test_4_segments
test_100_segments_angles test_100_segments_angles
test_100_segments_offsets) test_100_segments_offsets)
foreach(osqp_target ${osqp_targets}) foreach(osqp_target ${osqp_targets})
create_single_source_cgal_program("${osqp_target}.cpp") create_single_source_cgal_program("${osqp_target}.cpp")
if(TARGET ${osqp_target}) if(TARGET ${osqp_target})
target_link_libraries(${osqp_target} PUBLIC CGAL::OSQP_support) target_link_libraries(${osqp_target} PUBLIC CGAL::OSQP_support)
endif() endif()
endforeach()
else()
message(STATUS "NOTICE: OSQP was not found. OSQP tests won't be available.")
endif()
set(targets
test_neighbor_query
test_groups_parallel
test_groups_collinear
test_groups_orthogonal
test_unique_segments
test_plane_regularization
test_closed_contour_3_edges
test_closed_contour_4_edges
test_closed_contour_6_edges
test_closed_contour_10_edges
test_open_contour_1_edge
test_open_contour_2_edges
test_open_contour_3_edges
test_open_contour_5_edges
test_open_contour_9_edges
test_equal_contours
test_directions_longest
test_directions_multiple_1
test_directions_multiple_2
test_directions_multiple_3
test_directions_user_defined
test_contour_orientation)
foreach(target ${targets})
create_single_source_cgal_program("${target}.cpp")
endforeach() endforeach()
else() else()
message(WARNING "This program requires the CGAL library, and will not be compiled.") message(NOTICE "OSQP was not found. OSQP tests won't be available.")
endif() endif()
set(targets
test_neighbor_query
test_groups_parallel
test_groups_collinear
test_groups_orthogonal
test_unique_segments
test_plane_regularization
test_closed_contour_3_edges
test_closed_contour_4_edges
test_closed_contour_6_edges
test_closed_contour_10_edges
test_open_contour_1_edge
test_open_contour_2_edges
test_open_contour_3_edges
test_open_contour_5_edges
test_open_contour_9_edges
test_equal_contours
test_directions_longest
test_directions_multiple_1
test_directions_multiple_2
test_directions_multiple_3
test_directions_user_defined
test_contour_orientation)
foreach(target ${targets})
create_single_source_cgal_program("${target}.cpp")
endforeach()