Skip to content

Commit

Permalink
Installation - update FindOpenMesh.cmake (#8332)
Browse files Browse the repository at this point in the history
## Summary of Changes

This PR updates CGAL's `FindOpenMesh.cmake`, accordingly with the one
provided by OpenMesh 11.0, and introducing the target
`OpenMesh::OpenMesh`

## Release Management

* Affected package(s): Installation
* License and copyright ownership: unchanged
  • Loading branch information
sloriot authored Sep 6, 2024
2 parents 368d601 + 4cf1f4b commit abd0a58
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 187 deletions.
4 changes: 2 additions & 2 deletions BGL/examples/BGL_OpenMesh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ find_package(CGAL REQUIRED)

find_package(OpenMesh)
if(OpenMesh_FOUND)
include(UseOpenMesh)
include(CGAL_OpenMesh_support)
create_single_source_cgal_program("TriMesh.cpp")
target_link_libraries(TriMesh PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(TriMesh PRIVATE CGAL::OpenMesh_support)
else()
message("NOTICE: This project requires OpenMesh and will not be compiled.")
endif()
4 changes: 2 additions & 2 deletions BGL/examples/BGL_polyhedron_3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ create_single_source_cgal_program("copy_polyhedron.cpp")

find_package(OpenMesh QUIET)
if(OpenMesh_FOUND)
target_link_libraries(copy_polyhedron PRIVATE ${OPENMESH_LIBRARIES})
target_compile_definitions(copy_polyhedron PRIVATE -DCGAL_USE_OPENMESH)
include(CGAL_OpenMesh_support)
target_link_libraries(copy_polyhedron PRIVATE CGAL::OpenMesh_support)
else()
message(STATUS "NOTICE: The example 'copy_polyhedron' will not use OpenMesh.")
endif()
Expand Down
26 changes: 9 additions & 17 deletions BGL/test/BGL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,18 @@ create_single_source_cgal_program("test_deprecated_io.cpp")

find_package(OpenMesh QUIET)
if(OpenMesh_FOUND)
include(UseOpenMesh)
add_definitions(-DCGAL_USE_OPENMESH)
include(CGAL_OpenMesh_support)

target_link_libraries(test_clear PRIVATE ${OPENMESH_LIBRARIES})
target_compile_definitions(test_clear PRIVATE -DCGAL_USE_OPENMESH)
target_link_libraries(test_Euler_operations PRIVATE ${OPENMESH_LIBRARIES})
target_compile_definitions(test_Euler_operations PRIVATE -DCGAL_USE_OPENMESH)
target_link_libraries(test_Collapse_edge PRIVATE ${OPENMESH_LIBRARIES})
target_compile_definitions(test_Collapse_edge PRIVATE -DCGAL_USE_OPENMESH)
target_link_libraries(test_Face_filtered_graph PRIVATE ${OPENMESH_LIBRARIES})
target_compile_definitions(test_Face_filtered_graph PRIVATE -DCGAL_USE_OPENMESH)
target_link_libraries(test_graph_traits PRIVATE ${OPENMESH_LIBRARIES} )
target_compile_definitions(test_graph_traits PRIVATE -DCGAL_USE_OPENMESH)
target_link_libraries(test_Properties PRIVATE ${OPENMESH_LIBRARIES})
target_compile_definitions(test_Properties PRIVATE -DCGAL_USE_OPENMESH)
target_link_libraries(test_bgl_read_write PRIVATE ${OPENMESH_LIBRARIES})
target_compile_definitions(test_bgl_read_write PRIVATE -DCGAL_USE_OPENMESH)
target_link_libraries(test_clear PRIVATE CGAL::OpenMesh_support)
target_link_libraries(test_Euler_operations PRIVATE CGAL::OpenMesh_support)
target_link_libraries(test_Collapse_edge PRIVATE CGAL::OpenMesh_support)
target_link_libraries(test_Face_filtered_graph PRIVATE CGAL::OpenMesh_support)
target_link_libraries(test_graph_traits PRIVATE CGAL::OpenMesh_support )
target_link_libraries(test_Properties PRIVATE CGAL::OpenMesh_support)
target_link_libraries(test_bgl_read_write PRIVATE CGAL::OpenMesh_support)

create_single_source_cgal_program("graph_concept_OpenMesh.cpp")
target_link_libraries(graph_concept_OpenMesh PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(graph_concept_OpenMesh PRIVATE CGAL::OpenMesh_support)
else()
message(STATUS "NOTICE: Tests that use OpenMesh will not be compiled.")
endif()
Expand Down
9 changes: 4 additions & 5 deletions Combinatorial_map/test/Combinatorial_map/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ create_single_source_cgal_program(cmap_test_split_attribute.cpp)

# Link with OpenMesh if possible
find_package(OpenMesh QUIET)
if(TARGET OpenMesh::OpenMesh)
if(OpenMesh_FOUND)
message(STATUS "Found OpenMesh")
include(CGAL_OpenMesh_support)

target_link_libraries(Combinatorial_map_copy_test PRIVATE OpenMesh::OpenMesh)
target_compile_definitions(Combinatorial_map_copy_test PRIVATE -DCGAL_USE_OPENMESH)
target_link_libraries(Combinatorial_map_copy_test_index PRIVATE OpenMesh::OpenMesh)
target_compile_definitions(Combinatorial_map_copy_test_index PRIVATE -DCGAL_USE_OPENMESH)
target_link_libraries(Combinatorial_map_copy_test PRIVATE CGAL::OpenMesh_support)
target_link_libraries(Combinatorial_map_copy_test_index PRIVATE CGAL::OpenMesh_support)
else()
message(STATUS "NOTICE: Tests will not use OpenMesh.")
endif()
6 changes: 3 additions & 3 deletions Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ create_single_source_cgal_program("extreme_indices_3.cpp")

find_package(OpenMesh QUIET)
if(OpenMesh_FOUND)
include(UseOpenMesh)
include(CGAL_OpenMesh_support)
message(STATUS "Found OpenMesh")

create_single_source_cgal_program("quickhull_OM_3.cpp")
target_link_libraries(quickhull_OM_3 PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(quickhull_OM_3 PRIVATE CGAL::OpenMesh_support)
create_single_source_cgal_program("dynamic_hull_OM_3.cpp")
target_link_libraries(dynamic_hull_OM_3 PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(dynamic_hull_OM_3 PRIVATE CGAL::OpenMesh_support)
else()
message(STATUS "NOTICE: Examples that use OpenMesh will not be compiled.")
endif()
17 changes: 17 additions & 0 deletions Installation/cmake/modules/CGAL_OpenMesh_support.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

if(OpenMesh_FOUND AND NOT TARGET CGAL::OpenMesh_support)

add_library(CGAL::OpenMesh_support INTERFACE IMPORTED)

if(TARGET OpenMeshCore)
target_link_libraries(CGAL::OpenMesh_support INTERFACE OpenMeshCore)
endif()

if(TARGET OpenMeshTools)
target_link_libraries(CGAL::OpenMesh_support INTERFACE OpenMeshTools)
endif()

target_compile_definitions(CGAL::OpenMesh_support
INTERFACE "CGAL_USE_OPENMESH;NOMINMAX;_USE_MATH_DEFINES")

endif()
79 changes: 0 additions & 79 deletions Installation/cmake/modules/FindOpenMesh.cmake

This file was deleted.

5 changes: 0 additions & 5 deletions Installation/cmake/modules/UseOpenMesh.cmake

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ include_directories(BEFORE "/usr/include/libxml2/")
# add_definitions("-g")

# OpenMesh
set(OPENMESH_DIR "${CMAKE_CURRENT_SOURCE_DIR}/openmesh")
find_package(OpenMesh REQUIRED)
include_directories(${OPENMESH_INCLUDE_DIR})
link_directories(${OPENMESH_LIBRARY_DIR})
include(CGAL_OpenMesh_support)

# Polyhedron
add_executable(polyhedron_performance performance_2.h polyhedron_performance.h
Expand All @@ -42,7 +40,7 @@ target_link_libraries(surface_mesh_performance surface_mesh)
# Open_mesh
add_executable(openmesh_performance performance_2.h openmesh_performance.h
openmesh_performance.cpp)
target_link_libraries(openmesh_performance ${OPENMESH_LIBRARIES})
target_link_libraries(openmesh_performance CGAL::OpenMesh_support)

# CGoGN
find_package(Qt REQUIRED)
Expand Down Expand Up @@ -91,4 +89,4 @@ target_link_libraries(
Zinri
z
${QT_LIBRARIES}
${OPENMESH_LIBRARIES})
CGAL::OpenMesh_support)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -95,30 +95,29 @@ endif()

find_package(OpenMesh QUIET)
if(OpenMesh_FOUND)
include(UseOpenMesh)
include(CGAL_OpenMesh_support)

create_single_source_cgal_program("compute_normals_example_OM.cpp")
target_link_libraries(compute_normals_example_OM PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(compute_normals_example_OM PRIVATE CGAL::OpenMesh_support)
create_single_source_cgal_program("corefinement_OM_union.cpp")
target_link_libraries(corefinement_OM_union PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(corefinement_OM_union PRIVATE CGAL::OpenMesh_support)

if(TARGET CGAL::Eigen3_support)
create_single_source_cgal_program("hole_filling_example_OM.cpp")
target_link_libraries(hole_filling_example_OM PRIVATE CGAL::Eigen3_support ${OPENMESH_LIBRARIES})
target_link_libraries(hole_filling_example_OM PRIVATE CGAL::Eigen3_support CGAL::OpenMesh_support)
endif()

create_single_source_cgal_program("point_inside_example_OM.cpp")
target_link_libraries(point_inside_example_OM PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(point_inside_example_OM PRIVATE CGAL::OpenMesh_support)

create_single_source_cgal_program("stitch_borders_example_OM.cpp")
target_link_libraries(stitch_borders_example_OM PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(stitch_borders_example_OM PRIVATE CGAL::OpenMesh_support)

#create_single_source_cgal_program("remove_degeneracies_example.cpp")
#target_link_libraries(remove_degeneracies_example PRIVATE ${OPENMESH_LIBRARIES})
#target_compile_definitions(remove_degeneracies_example PRIVATE -DCGAL_USE_OPENMESH)
#target_link_libraries(remove_degeneracies_example PRIVATE CGAL::OpenMesh_support)

create_single_source_cgal_program("triangulate_faces_example_OM.cpp")
target_link_libraries(triangulate_faces_example_OM PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(triangulate_faces_example_OM PRIVATE CGAL::OpenMesh_support)
else()
message(STATUS "NOTICE: Examples that use OpenMesh will not be compiled.")
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ endif()

find_package(OpenMesh QUIET)
if(OpenMesh_FOUND)
include(UseOpenMesh)
include(CGAL_OpenMesh_support)
create_single_source_cgal_program("remeshing_test_P_SM_OM.cpp")
target_link_libraries(remeshing_test_P_SM_OM PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(remeshing_test_P_SM_OM PRIVATE CGAL::OpenMesh_support)
else()
message(STATUS "NOTICE: Tests that use OpenMesh will not be compiled.")
endif()
Expand Down
6 changes: 2 additions & 4 deletions Property_map/test/Property_map/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ create_single_source_cgal_program("test_Property_container.cpp")
find_package(OpenMesh QUIET)
if(OpenMesh_FOUND)
message(STATUS "Found OpenMesh")
include(UseOpenMesh)

target_link_libraries(dynamic_properties_test PRIVATE ${OPENMESH_LIBRARIES})
target_compile_definitions(dynamic_properties_test PRIVATE -DCGAL_USE_OPENMESH)
include(CGAL_OpenMesh_support)
target_link_libraries(dynamic_properties_test PRIVATE CGAL::OpenMesh_support)
else()
message(STATUS "NOTICE: Tests will not use OpenMesh.")
endif()
4 changes: 2 additions & 2 deletions STL_Extension/test/STL_Extension/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ endif()
find_package(OpenMesh QUIET)
if(OpenMesh_FOUND)
message(STATUS "Found OpenMesh")
include(UseOpenMesh)
include(CGAL_OpenMesh_support)

create_single_source_cgal_program("test_hash_OpenMesh.cpp")
target_link_libraries(test_hash_OpenMesh PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(test_hash_OpenMesh PRIVATE CGAL::OpenMesh_support)
else()
message(STATUS "NOTICE: Tests that use OpenMesh will not be compiled.")
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ if(TARGET CGAL::Eigen3_support)

find_package(OpenMesh QUIET)
if(OpenMesh_FOUND)
include(UseOpenMesh)
include(CGAL_OpenMesh_support)
message(STATUS "Found OpenMesh")

create_single_source_cgal_program("all_roi_assign_example_with_OpenMesh.cpp")
target_link_libraries(all_roi_assign_example_with_OpenMesh
PRIVATE ${OPENMESH_LIBRARIES} CGAL::Eigen3_support)
PRIVATE CGAL::OpenMesh_support CGAL::Eigen3_support)
else()
message(STATUS "NOTICE: Examples that use OpenMesh will not be compiled.")
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ if(TARGET CGAL::Eigen3_support)

find_package(OpenMesh QUIET)
if(OpenMesh_FOUND)
include(UseOpenMesh)
include(CGAL_OpenMesh_support)
message(STATUS "Found OpenMesh")

create_single_source_cgal_program("Cactus_deformation_session_OpenMesh.cpp")
target_link_libraries(Cactus_deformation_session_OpenMesh
PRIVATE ${OPENMESH_LIBRARIES} CGAL::Eigen3_support)
PRIVATE CGAL::OpenMesh_support CGAL::Eigen3_support)
else()
message(STATUS "NOTICE: Examples that use OpenMesh will not be compiled.")
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ create_single_source_cgal_program("extract_segmentation_into_mesh_example.cpp")

find_package(OpenMesh QUIET)
if(OpenMesh_FOUND)
include(UseOpenMesh)
include(CGAL_OpenMesh_support)
message(STATUS "Found OpenMesh")

create_single_source_cgal_program("segmentation_from_sdf_values_OpenMesh_example.cpp")
target_link_libraries(segmentation_from_sdf_values_OpenMesh_example PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries(segmentation_from_sdf_values_OpenMesh_example PRIVATE CGAL::OpenMesh_support)
else()
message(STATUS "NOTICE: Examples that use OpenMesh will not be compiled.")
endif()
Loading

0 comments on commit abd0a58

Please sign in to comment.