From 5d9271d7f4bbd0439895e6143c134183d8faf2da Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 4 Aug 2025 14:34:21 +0100 Subject: [PATCH 1/7] Lab: Use std::filesystem --- Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt | 8 ++------ Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt b/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt index dda7d3fac53..8278f13a92b 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt @@ -48,8 +48,8 @@ else() message(STATUS "NOTICE: DICOM files (.dcm) require the VTK libraries, and will not be readable.") endif() -find_package(Boost QUIET OPTIONAL_COMPONENTS filesystem system) -if(Boost_FILESYSTEM_FOUND AND Boost_SYSTEM_FOUND) +find_package(Boost) + qt6_wrap_ui( imgUI_FILES Image_res_dialog.ui raw_image.ui) cgal_lab_plugin(io_image_plugin Io_image_plugin Volume_plane_intersection.cpp @@ -62,11 +62,7 @@ if(Boost_FILESYSTEM_FOUND AND Boost_SYSTEM_FOUND) target_compile_definitions(io_image_plugin PRIVATE -DCGAL_USE_VTK -DNOMINMAX) endif() - target_link_libraries(io_image_plugin PRIVATE Boost::filesystem Boost::system) -else() - message(STATUS "NOTICE: the Io_image_plugin requires boost-filesystem, and will not be compiled") -endif() cgal_lab_plugin( mesh_3_optimization_plugin Optimization_plugin diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp index 780511846aa..6388dec9abb 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp @@ -72,7 +72,7 @@ #include #include -#include +#include #include #include @@ -1520,10 +1520,10 @@ Image* Io_image_plugin::createDirectoryImage(const QString& dirname, CGAL_assertion(ext == Directory_extension_type::BMP); // vtkBMPReader does not provide SetDirectoryName()... - std::vector paths; + std::vector paths; vtkStringArray* files = vtkStringArray::New(); - boost::filesystem::path p(dirname.toUtf8().data()); - for(boost::filesystem::directory_entry& x : boost::filesystem::directory_iterator(p)) + std::filesystem::path p(dirname.toUtf8().data()); + for(std::filesystem::directory_entry& x : std::filesystem::directory_iterator(p)) { std::string s = x.path().string(); if(CGAL::IO::internal::get_file_extension(s) != "bmp") @@ -1535,7 +1535,7 @@ Image* Io_image_plugin::createDirectoryImage(const QString& dirname, // boost::filesystem::directory_iterator does not guarantee a sorted order std::sort(std::begin(paths), std::end(paths)); - for(const boost::filesystem::path& p : paths) + for(const std::filesystem::path& p : paths) files->InsertNextValue(p.string()); if(files->GetSize() == 0) From 0578f9ce05d0e6ce879633d12aa1ce7f578c9316 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 4 Aug 2025 15:46:20 +0100 Subject: [PATCH 2/7] constness --- Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp index 6388dec9abb..af93526c30d 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp @@ -1523,7 +1523,7 @@ Image* Io_image_plugin::createDirectoryImage(const QString& dirname, std::vector paths; vtkStringArray* files = vtkStringArray::New(); std::filesystem::path p(dirname.toUtf8().data()); - for(std::filesystem::directory_entry& x : std::filesystem::directory_iterator(p)) + for(const std::filesystem::directory_entry& x : std::filesystem::directory_iterator(p)) { std::string s = x.path().string(); if(CGAL::IO::internal::get_file_extension(s) != "bmp") From 465d2046ae497bc41ae99ffe892e651c606da535 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 4 Aug 2025 16:02:03 +0100 Subject: [PATCH 3/7] cleanup --- Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt | 1 - Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt b/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt index 8278f13a92b..c950047d0f0 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt @@ -48,7 +48,6 @@ else() message(STATUS "NOTICE: DICOM files (.dcm) require the VTK libraries, and will not be readable.") endif() -find_package(Boost) qt6_wrap_ui( imgUI_FILES Image_res_dialog.ui raw_image.ui) cgal_lab_plugin(io_image_plugin Io_image_plugin diff --git a/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp index af93526c30d..a4302b32708 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp @@ -1532,7 +1532,7 @@ Image* Io_image_plugin::createDirectoryImage(const QString& dirname, paths.push_back(x.path()); } - // boost::filesystem::directory_iterator does not guarantee a sorted order + // std::filesystem::directory_iterator does not guarantee a sorted order std::sort(std::begin(paths), std::end(paths)); for(const std::filesystem::path& p : paths) From ac99b93d923ad5fb1e73dd894ae4a98a4095900c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 4 Aug 2025 16:36:46 +0100 Subject: [PATCH 4/7] This fixes the compilation, but does it the same? --- CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h b/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h index 97bd4502006..9dace36edc8 100644 --- a/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h +++ b/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h @@ -20,13 +20,7 @@ #include #include -#include -#include - -#ifndef BOOST_FILESYSTEM_VERSION -// That macro was not defined in previous releases of Boost. -# define BOOST_FILESYSTEM_VERSION 2 -#endif +#include #include @@ -60,15 +54,11 @@ public: } display_information(fileName, std::cout); - boost::filesystem::path headerFile(fileName); - boost::filesystem::path dataFile(string_field("in")); -#if BOOST_FILESYSTEM_VERSION == 2 - dataFile = boost::filesystem::complete(dataFile, - boost::filesystem::complete(headerFile.parent_path())); -#else - dataFile = boost::filesystem::absolute(dataFile, - boost::filesystem::absolute(headerFile.parent_path())); -#endif + std::filesystem::path headerFile(fileName); + std::filesystem::path dataFile(string_field("in")); + + dataFile = std::filesystem::absolute(dataFile); +# if(!load_data(dataFile.string())) { return; err_msg = "Invalid data file \""; From 14bae86654b173bc94ce64ba1d9c8140d97ff14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 4 Aug 2025 18:19:46 +0200 Subject: [PATCH 5/7] fix path --- CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h b/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h index 9dace36edc8..34f26203248 100644 --- a/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h +++ b/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h @@ -55,10 +55,8 @@ public: display_information(fileName, std::cout); std::filesystem::path headerFile(fileName); - std::filesystem::path dataFile(string_field("in")); + std::filesystem::path dataFile = std::filesystem::absolute(fileName).parent_path() / std::filesystem::path("in"); - dataFile = std::filesystem::absolute(dataFile); -# if(!load_data(dataFile.string())) { return; err_msg = "Invalid data file \""; From a6c0c91fad1310141cabded4b2c4efb6e823d26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 5 Aug 2025 14:44:03 +0200 Subject: [PATCH 6/7] missing string_field --- CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h b/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h index 34f26203248..54ed43b9814 100644 --- a/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h +++ b/CGAL_ImageIO/include/CGAL/SEP_to_ImageIO.h @@ -55,7 +55,7 @@ public: display_information(fileName, std::cout); std::filesystem::path headerFile(fileName); - std::filesystem::path dataFile = std::filesystem::absolute(fileName).parent_path() / std::filesystem::path("in"); + std::filesystem::path dataFile = std::filesystem::absolute(fileName).parent_path() / std::filesystem::path(string_field("in")); if(!load_data(dataFile.string())) { return; From 9c9678c0041f208bde50128ede64f26aee6e5af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 6 Aug 2025 16:29:55 +0200 Subject: [PATCH 7/7] do not look for boost system for recent libpointmatcher --- Installation/cmake/modules/CGAL_pointmatcher_support.cmake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Installation/cmake/modules/CGAL_pointmatcher_support.cmake b/Installation/cmake/modules/CGAL_pointmatcher_support.cmake index 16650ba6d9c..a4f823cdddc 100644 --- a/Installation/cmake/modules/CGAL_pointmatcher_support.cmake +++ b/Installation/cmake/modules/CGAL_pointmatcher_support.cmake @@ -1,16 +1,15 @@ if(libpointmatcher_FOUND AND NOT TARGET CGAL::pointmatcher_support) if (libpointmatcher_VERSION VERSION_GREATER_EQUAL "1.4.4") - find_package(Boost COMPONENTS thread system program_options date_time chrono) + find_package(Boost COMPONENTS thread program_options date_time chrono) else() find_package(Boost COMPONENTS thread filesystem system program_options date_time chrono) endif() if(Boost_chrono_FOUND AND Boost_thread_FOUND - AND Boost_system_FOUND AND Boost_program_options_FOUND AND Boost_date_time_FOUND - AND (libpointmatcher_VERSION VERSION_GREATER_EQUAL "1.4.4" OR Boost_filesystem_FOUND)) + AND (libpointmatcher_VERSION VERSION_GREATER_EQUAL "1.4.4" OR (Boost_filesystem_FOUND AND Boost_system_FOUND))) add_library(CGAL::pointmatcher_support INTERFACE IMPORTED) target_compile_options(CGAL::pointmatcher_support INTERFACE "-D_USE_MATH_DEFINES") target_compile_definitions(CGAL::pointmatcher_support INTERFACE "CGAL_LINKED_WITH_POINTMATCHER") @@ -18,7 +17,7 @@ if(libpointmatcher_FOUND AND NOT TARGET CGAL::pointmatcher_support) target_link_libraries(CGAL::pointmatcher_support INTERFACE ${libpointmatcher_LIBRARIES} libnabo::nabo) else() if (libpointmatcher_VERSION VERSION_GREATER_EQUAL "1.4.4") - message(STATUS "NOTICE: the libpointmatcher library requires the following boost components: thread system program_options date_time chrono.") + message(STATUS "NOTICE: the libpointmatcher library requires the following boost components: thread program_options date_time chrono.") else() message(STATUS "NOTICE: the libpointmatcher library requires the following boost components: thread filesystem system program_options date_time chrono.") endif()