From 0b73361226b11e06520c32970178e016cc0d200d Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 13 Nov 2023 12:47:39 +0100 Subject: [PATCH 1/7] remove CGAL_ITK_support.cmake and adapt the CMakeLists that were using it --- Installation/cmake/modules/CGAL_ITK_support.cmake | 7 ------- Mesh_3/examples/Mesh_3/CMakeLists.txt | 12 ++++++++---- .../demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt | 10 +++++++--- 3 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 Installation/cmake/modules/CGAL_ITK_support.cmake diff --git a/Installation/cmake/modules/CGAL_ITK_support.cmake b/Installation/cmake/modules/CGAL_ITK_support.cmake deleted file mode 100644 index 61ed67e2f2b..00000000000 --- a/Installation/cmake/modules/CGAL_ITK_support.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(ITK_FOUND AND NOT TARGET CGAL::ITK_support) - add_library(CGAL::ITK_support INTERFACE IMPORTED) - set_target_properties(CGAL::ITK_support PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "CGAL_USE_ITK" - INTERFACE_INCLUDE_DIRECTORIES "${ITK_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${ITK_LIBRARIES}") -endif() diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 31ab08db7e8..7f9ccfdb03b 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -171,16 +171,20 @@ if(TARGET CGAL::CGAL_ImageIO) target_link_libraries(mesh_3D_image_variable_size PUBLIC CGAL::Eigen3_support) - find_package(ITK NAMES ITK InsightToolkit QUIET COMPONENTS ITKCommon ITKThresholding ITKSmoothing ITKImageIntensity) + find_package(ITK NAMES ITK InsightToolkit + QUIET COMPONENTS ITKCommon ITKThresholding ITKSmoothing ITKImageIntensity) if(ITK_FOUND) - include(CGAL_ITK_support) + message(STATUS "ITK found") + include(${ITK_USE_FILE}) + set(ITK_LIBS ITKCommon ITKSmoothing ITKImageIntensity) + create_single_source_cgal_program("mesh_3D_weighted_image.cpp") target_link_libraries(mesh_3D_weighted_image - PUBLIC CGAL::Eigen3_support CGAL::ITK_support) + PUBLIC CGAL::Eigen3_support ${ITK_LIBS}) create_single_source_cgal_program("mesh_3D_weighted_image_with_detection_of_features.cpp") target_link_libraries(mesh_3D_weighted_image_with_detection_of_features - PUBLIC CGAL::Eigen3_support CGAL::ITK_support) + PUBLIC CGAL::Eigen3_support ${ITK_LIBS}) else(ITK_FOUND) message(STATUS "NOTICE: The examples that need ITK will not be compiled.") endif(ITK_FOUND) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt index 706ce2d3643..994a71fc703 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt @@ -28,10 +28,14 @@ target_link_libraries( ${OPENGL_gl_LIBRARY}) target_include_directories(mesh_3_plugin PRIVATE include) -find_package(ITK NAMES ITK InsightToolkit QUIET COMPONENTS ITKCommon ITKThresholding ITKSmoothing ITKImageIntensity) +find_package(ITK NAMES ITK InsightToolkit + QUIET COMPONENTS ITKCommon ITKThresholding ITKSmoothing ITKImageIntensity) if(ITK_FOUND) - include(CGAL_ITK_support) - target_link_libraries(mesh_3_plugin PUBLIC CGAL::ITK_support) + include(${ITK_USE_FILE}) + set(ITK_LIBS ITKCommon ITKSmoothing ITKImageIntensity) + + target_link_libraries(mesh_3_plugin PUBLIC ${ITK_LIBS}) + target_compile_definitions(mesh_3_plugin PUBLIC CGAL_USE_ITK) endif(ITK_FOUND) find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage vtkIOXML NO_MODULE) From cb5bd56ef0dd9161096346f185b2c696a5b30bd2 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 16 Nov 2023 14:44:44 +0100 Subject: [PATCH 2/7] update install.sh Now almost all dependencies of the CGAL 3D demo are installed. Exceptions: ``` -- Missing optional packages: * LASLIB, A library for LIDAR I/O. Required for reading or writing LAS files. * SCIP, A solver for mixed integer programming. Can be used as a solver in the surface_reconstruction_plugin plugin. * OpenGR * libpointmatcher ``` --- .github/install.sh | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/install.sh b/.github/install.sh index 32b8552aa8f..8759748fa5e 100755 --- a/.github/install.sh +++ b/.github/install.sh @@ -1,11 +1,28 @@ #!/bin/bash + +set -e + sudo apt-get update -sudo apt-get install -y libmpfr-dev \ - libeigen3-dev qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev \ - libqt5svg5-dev qttools5-dev qttools5-dev-tools libboost-dev libinsighttoolkit4-dev zsh -#update cmake to 3.18.4 +sudo apt-get install -y \ + libmpfr-dev \ + libtbb-dev \ + libmetis-dev \ + libssh-dev \ + libeigen3-dev \ + qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev libqt5websockets5-dev \ + libqt5svg5-dev qttools5-dev qttools5-dev-tools \ + libboost-dev libboost-serialization-dev libboost-iostreams-dev libboost-filesystem-dev libboost-filesystem-dev \ + libvtk9-dev \ + libinsighttoolkit4-dev \ + libceres-dev \ + libglpk-dev \ + libopencv-dev \ + zsh + +#update CMake sudo apt purge --auto-remove cmake cd /tmp -wget https://cmake.org/files/v3.18/cmake-3.18.4-Linux-x86_64.sh -sudo sh cmake-3.18.4-Linux-x86_64.sh --skip-license --prefix=/usr/local -rm cmake-3.18.4-Linux-x86_64.sh +CMAKE_VER=$(curl --silent https://cmake.org/files/LatestRelease/cmake-latest-files-v1.json | jq -r .version.string) +wget https://cmake.org/files/LatestRelease/cmake-$CMAKE_VER-linux-x86_64.sh +sudo sh cmake-*.sh --skip-license --prefix=/usr/local +rm cmake-*.sh From 8db251c7963a35b24d67be2f1086e7830a5c5bb1 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 16 Nov 2023 14:56:46 +0100 Subject: [PATCH 3/7] set -x for install.sh --- .github/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/install.sh b/.github/install.sh index 8759748fa5e..0b1f3c5db9e 100755 --- a/.github/install.sh +++ b/.github/install.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -ex sudo apt-get update sudo apt-get install -y \ From 0a9392c778ab7e485603ed0658e1f679b0be44bb Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 16 Nov 2023 15:00:06 +0100 Subject: [PATCH 4/7] try to fix issue with Github's Ubuntu --- .github/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/install.sh b/.github/install.sh index 0b1f3c5db9e..e41d4762a2e 100755 --- a/.github/install.sh +++ b/.github/install.sh @@ -12,7 +12,7 @@ sudo apt-get install -y \ qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev libqt5websockets5-dev \ libqt5svg5-dev qttools5-dev qttools5-dev-tools \ libboost-dev libboost-serialization-dev libboost-iostreams-dev libboost-filesystem-dev libboost-filesystem-dev \ - libvtk9-dev \ + libvtk9-dev libunwind-dev \ libinsighttoolkit4-dev \ libceres-dev \ libglpk-dev \ From 74896b99c08a79ab6721675c504c9f45e6612c2e Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 16 Nov 2023 16:27:23 +0100 Subject: [PATCH 5/7] Use ITK 5.x instead of 4.13 --- .github/install.sh | 2 +- Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/install.sh b/.github/install.sh index e41d4762a2e..5fc8323c8c9 100755 --- a/.github/install.sh +++ b/.github/install.sh @@ -13,7 +13,7 @@ sudo apt-get install -y \ libqt5svg5-dev qttools5-dev qttools5-dev-tools \ libboost-dev libboost-serialization-dev libboost-iostreams-dev libboost-filesystem-dev libboost-filesystem-dev \ libvtk9-dev libunwind-dev \ - libinsighttoolkit4-dev \ + libinsighttoolkit5-dev \ libceres-dev \ libglpk-dev \ libopencv-dev \ diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt index 994a71fc703..f7cadd99fb6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt @@ -33,7 +33,11 @@ find_package(ITK NAMES ITK InsightToolkit if(ITK_FOUND) include(${ITK_USE_FILE}) set(ITK_LIBS ITKCommon ITKSmoothing ITKImageIntensity) - + foreach(lib ${ITK_LIBS}) + if(NOT TARGET ${lib}) + message(STATUS "ITK library ${lib} not found") + endif() + endforeach() target_link_libraries(mesh_3_plugin PUBLIC ${ITK_LIBS}) target_compile_definitions(mesh_3_plugin PUBLIC CGAL_USE_ITK) endif(ITK_FOUND) From 9262c6a8b681d35903e1eb9e5126012542eb91b7 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 23 Nov 2023 17:25:18 +0100 Subject: [PATCH 6/7] Re-add CGAL_ITK_support.cmake That will allow to be compatible with ITK version 4.13 and 5.x. --- Installation/cmake/modules/CGAL_ITK_support.cmake | 9 +++++++++ Mesh_3/examples/Mesh_3/CMakeLists.txt | 10 +++++----- .../demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt | 11 +++-------- 3 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 Installation/cmake/modules/CGAL_ITK_support.cmake diff --git a/Installation/cmake/modules/CGAL_ITK_support.cmake b/Installation/cmake/modules/CGAL_ITK_support.cmake new file mode 100644 index 00000000000..a0a8b57b85a --- /dev/null +++ b/Installation/cmake/modules/CGAL_ITK_support.cmake @@ -0,0 +1,9 @@ +if(ITK_FOUND AND NOT TARGET CGAL::ITK_support) + add_library(CGAL::ITK_support INTERFACE IMPORTED) + foreach(itk_target ITKCommon ITKSmoothing ITKImageIntensity) + if(TARGET ${itk_target}) + target_link_libraries(CGAL::ITK_support INTERFACE ${itk_target}) + endif() + endforeach() + target_compile_definitions(CGAL::ITK_support INTERFACE CGAL_USE_ITK) +endif() diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 7f9ccfdb03b..bb988eb0e50 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -174,20 +174,20 @@ if(TARGET CGAL::CGAL_ImageIO) find_package(ITK NAMES ITK InsightToolkit QUIET COMPONENTS ITKCommon ITKThresholding ITKSmoothing ITKImageIntensity) if(ITK_FOUND) + include(CGAL_ITK_support) message(STATUS "ITK found") include(${ITK_USE_FILE}) - set(ITK_LIBS ITKCommon ITKSmoothing ITKImageIntensity) create_single_source_cgal_program("mesh_3D_weighted_image.cpp") target_link_libraries(mesh_3D_weighted_image - PUBLIC CGAL::Eigen3_support ${ITK_LIBS}) + PUBLIC CGAL::Eigen3_support CGAL::ITK_support) create_single_source_cgal_program("mesh_3D_weighted_image_with_detection_of_features.cpp") target_link_libraries(mesh_3D_weighted_image_with_detection_of_features - PUBLIC CGAL::Eigen3_support ${ITK_LIBS}) - else(ITK_FOUND) + PUBLIC CGAL::Eigen3_support CGAL::ITK_support) + else() message(STATUS "NOTICE: The examples that need ITK will not be compiled.") - endif(ITK_FOUND) + endif() else() message(STATUS "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_weighted_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled.") diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt index f7cadd99fb6..489a33e3248 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt @@ -31,15 +31,10 @@ target_include_directories(mesh_3_plugin PRIVATE include) find_package(ITK NAMES ITK InsightToolkit QUIET COMPONENTS ITKCommon ITKThresholding ITKSmoothing ITKImageIntensity) if(ITK_FOUND) + include(CGAL_ITK_support) + message(STATUS "ITK found") include(${ITK_USE_FILE}) - set(ITK_LIBS ITKCommon ITKSmoothing ITKImageIntensity) - foreach(lib ${ITK_LIBS}) - if(NOT TARGET ${lib}) - message(STATUS "ITK library ${lib} not found") - endif() - endforeach() - target_link_libraries(mesh_3_plugin PUBLIC ${ITK_LIBS}) - target_compile_definitions(mesh_3_plugin PUBLIC CGAL_USE_ITK) + target_link_libraries(mesh_3_plugin PUBLIC CGAL::ITK_support) endif(ITK_FOUND) find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage vtkIOXML NO_MODULE) From a34698c40340ed90579e0eb19d6d135c56229692 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 24 Nov 2023 11:21:02 +0100 Subject: [PATCH 7/7] fix install.sh with Qt6 --- .github/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/install.sh b/.github/install.sh index 8adc6b5d2d9..0c030be8e7a 100755 --- a/.github/install.sh +++ b/.github/install.sh @@ -12,13 +12,13 @@ sudo apt-get install -y \ qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev libqt5websockets5-dev \ libqt5svg5-dev qttools5-dev qttools5-dev-tools \ libboost-dev libboost-serialization-dev libboost-iostreams-dev libboost-filesystem-dev libboost-filesystem-dev \ - libvtk9-dev libunwind-dev \ + libvtk9-dev libgdcm-tools libvtkgdcm-dev libunwind-dev \ libinsighttoolkit5-dev \ libceres-dev \ libglpk-dev \ libopencv-dev \ zsh \ - qt6-base-dev qt6-declarative-dev + qt6-base-dev qt6-declarative-dev libqt6svg6-dev libqt6websockets6-dev #update CMake sudo apt purge --auto-remove cmake