From a82fb5088b4ad48cd01237b74a84cc6e230da6a6 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Fri, 30 Aug 2024 10:14:36 +0200 Subject: [PATCH 01/10] allow use of Rapidlasso Laslib as alternative to CGALs fork --- .../cmake/modules/CGAL_LASLIB_support.cmake | 4 +- .../Point_set_processing_3/CMakeLists.txt | 2 + .../write_las_example.cpp | 45 +++++++++ .../include/CGAL/IO/read_las_points.h | 6 +- .../include/CGAL/IO/write_las_points.h | 95 ++++++++++++------ .../test/Stream_support/CMakeLists.txt | 14 ++- .../Stream_support/data/colored_points.las | Bin 0 -> 397 bytes .../test/Stream_support/test_LAS.cpp | 63 ++++++++++++ 8 files changed, 196 insertions(+), 33 deletions(-) create mode 100644 Point_set_processing_3/examples/Point_set_processing_3/write_las_example.cpp create mode 100644 Stream_support/test/Stream_support/data/colored_points.las create mode 100644 Stream_support/test/Stream_support/test_LAS.cpp diff --git a/Installation/cmake/modules/CGAL_LASLIB_support.cmake b/Installation/cmake/modules/CGAL_LASLIB_support.cmake index 7c65da9ebf04..e541326fdd83 100644 --- a/Installation/cmake/modules/CGAL_LASLIB_support.cmake +++ b/Installation/cmake/modules/CGAL_LASLIB_support.cmake @@ -2,7 +2,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_SYSTEM_INCLUDE_DIRECTORIES "${LASLIB_INCLUDE_DIR};${LASZIP_INCLUDE_DIR}" + INTERFACE_INCLUDE_DIRECTORIES "${LASLIB_INCLUDE_DIR}" + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${LASLIB_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES "${LASLIB_LIBRARIES}") endif() diff --git a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt index 0e684584b131..de0b1a236930 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt @@ -71,7 +71,9 @@ find_package(LASLIB) include(CGAL_LASLIB_support) if(TARGET CGAL::LASLIB_support) create_single_source_cgal_program("read_las_example.cpp") + create_single_source_cgal_program("write_las_example.cpp") target_link_libraries(read_las_example PRIVATE ${CGAL_libs} CGAL::LASLIB_support) + target_link_libraries(write_las_example PRIVATE ${CGAL_libs} CGAL::LASLIB_support) else() message( STATUS diff --git a/Point_set_processing_3/examples/Point_set_processing_3/write_las_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/write_las_example.cpp new file mode 100644 index 000000000000..200d31cc7e48 --- /dev/null +++ b/Point_set_processing_3/examples/Point_set_processing_3/write_las_example.cpp @@ -0,0 +1,45 @@ +#include + +#include +#include +#include + +#include +#include +#include + +// types +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef Kernel::FT FT; +typedef Kernel::Point_3 Point; +typedef std::array Color; +typedef std::pair PointWithColor; + +int main(int argc, char*argv[]) +{ + const char* fname = "colored_points.las"; + + std::ofstream os(fname, std::ios::binary); + + std::vector points; // store points + points.push_back(std::make_pair(Point(0, 0, 0), Color{ 65535, 0, 0, 0 })); + points.push_back(std::make_pair(Point(1, 0, 0), Color{ 0, 65535, 0, 0 })); + points.push_back(std::make_pair(Point(0, 1, 0), Color{ 0, 0, 65535, 0 })); + points.push_back(std::make_pair(Point(1, 1, 0), Color{ 0, 65535, 65535, 0 })); + points.push_back(std::make_pair(Point(1, 1, 1), Color{ 65535, 65535, 0, 0 })); + + // Writes a .las point set file with colors + if(!CGAL::IO::write_LAS_with_properties(os, points, + CGAL::IO::make_las_point_writer(CGAL::First_of_pair_property_map()), + std::make_tuple(CGAL::Second_of_pair_property_map(), + CGAL::IO::LAS_property::R(), + CGAL::IO::LAS_property::G(), + CGAL::IO::LAS_property::B(), + CGAL::IO::LAS_property::I()))) + { + std::cerr << "Error: cannot write file " << fname << std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/Point_set_processing_3/include/CGAL/IO/read_las_points.h b/Point_set_processing_3/include/CGAL/IO/read_las_points.h index beb35f44355f..e7d70470ff13 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_las_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_las_points.h @@ -44,7 +44,7 @@ # pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif -#define USE_AS_DLL +#define USE_AS_DLL 1 #include #undef USE_AS_DLL @@ -385,7 +385,11 @@ bool read_LAS_with_properties(std::istream& is, if(!is) return false; +#if LAS_TOOLS_VERSION <= 170805 LASreaderLAS lasreader; +#else + LASreaderLAS lasreader(nullptr); +#endif lasreader.open(is); while(lasreader.read_point()) diff --git a/Point_set_processing_3/include/CGAL/IO/write_las_points.h b/Point_set_processing_3/include/CGAL/IO/write_las_points.h index aa153ec4c443..661bdf86977d 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_las_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_las_points.h @@ -84,41 +84,41 @@ make_las_point_writer(PointMap point_map) namespace internal { namespace LAS { - inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::Intensity&) + inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::Intensity&) { r.set_intensity(v); } - inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Return_number&) + inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Return_number&) { r.set_return_number(v); } - inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Number_of_returns&) + inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Number_of_returns&) { r.set_number_of_returns(v); } - inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Scan_direction_flag&) + inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Scan_direction_flag&) { r.set_scan_direction_flag(v); } - inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Edge_of_flight_line&) + inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Edge_of_flight_line&) { r.set_edge_of_flight_line(v); } - inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Classification&) + inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Classification&) { r.set_classification(v); } - inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Synthetic_flag&) + inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Synthetic_flag&) { r.set_synthetic_flag(v); } - inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Keypoint_flag&) + inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Keypoint_flag&) { r.set_keypoint_flag(v); } - inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Withheld_flag&) + inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Withheld_flag&) { r.set_withheld_flag(v); } - inline void output_value(LASpoint& r, const float& v, LAS_property::Scan_angle&) + inline void output_value(LASpoint& r, const float& v, const LAS_property::Scan_angle&) { r.set_scan_angle_rank(char(v)); } - inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::User_data&) + inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::User_data&) { r.set_user_data(v); } - inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::Point_source_ID&) + inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::Point_source_ID&) { r.set_point_source_ID(v); } - inline void output_value(LASpoint& r, const unsigned int& v, LAS_property::Deleted_flag&) + inline void output_value(LASpoint& r, const unsigned int& v, const LAS_property::Deleted_flag&) { r.set_deleted_flag(v); } - inline void output_value(LASpoint& r, const double& v, LAS_property::GPS_time&) + inline void output_value(LASpoint& r, const double& v, const LAS_property::GPS_time&) { r.set_gps_time(v); } - inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::R&) + inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::R&) { r.set_R(v); } - inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::G&) + inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::G&) { r.set_G(v); } - inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::B&) + inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::B&) { r.set_B(v); } - inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::I&) + inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::I&) { r.set_I(v); } template @@ -134,20 +134,57 @@ namespace LAS { output_value (point, get(current.first, *it), current.second); } + template + void output_tuple(LASpoint& point, const Value& v, const Tuple& t, std::index_sequence) { + output_value(point, std::get(v), std::get(t)); + } + + template + void output_tuple(LASpoint& point, const Value& v, const Tuple& t, std::index_sequence) { + output_value(point, std::get(v), std::get(t)); + output_tuple(point, v, t, std::index_sequence()); + } + template + typename PropertyMap, + typename ... T> void output_properties(LASpoint& point, - ForwardIterator it, - std::pair&& current, - NextPropertyHandler&& next, - PropertyHandler&& ... properties) + ForwardIterator it, + std::tuple&& current) { - output_value (point, get(current.first, *it), current.second); - output_properties (point, it, std::forward(next), - std::forward(properties)...); + output_tuple(point, get(std::get<0>(current), *it), std::tuple(), std::index_sequence_for{}); + } + + template + void output_properties(LASpoint& point, + ForwardIterator it, + std::pair&& current, + NextPropertyHandler&& next, + PropertyHandler&& ... properties) + { + output_value(point, get(current.first, *it), current.second); + output_properties(point, it, std::forward(next), + std::forward(properties)...); + } + + template + void output_properties(LASpoint& point, + ForwardIterator it, + std::tuple&& current, + NextPropertyHandler&& next, + PropertyHandler&& ... properties) + { + output_tuple(point, get(std::get<0>(current), *it), std::tuple(), std::index_sequence_for{}); + output_properties(point, it, std::forward(next), + std::forward(properties)...); } } // namespace LAS diff --git a/Stream_support/test/Stream_support/CMakeLists.txt b/Stream_support/test/Stream_support/CMakeLists.txt index ade4d2c88f8c..9c41b5b2dac3 100644 --- a/Stream_support/test/Stream_support/CMakeLists.txt +++ b/Stream_support/test/Stream_support/CMakeLists.txt @@ -13,6 +13,9 @@ find_library( NAMES 3MF DOC "Path to the lib3MF library") +find_package(LASLIB QUIET) +include(CGAL_LASLIB_support) + # create a target per cppfile file( GLOB cppfiles @@ -33,6 +36,15 @@ foreach(cppfile ${cppfiles}) ) endif() else() - create_single_source_cgal_program("${cppfile}") + if("${cppfile}" STREQUAL "test_LAS.cpp") + if(TARGET CGAL::LASLIB_support) + create_single_source_cgal_program("test_LAS.cpp") + target_link_libraries(test_LAS PRIVATE ${CGAL_libs} CGAL::LASLIB_support) + else() + message(STATUS "NOTICE: Some tests require the LASlib library, and will not be compiled.") + endif() + else() + create_single_source_cgal_program("${cppfile}") + endif() endif() endforeach() diff --git a/Stream_support/test/Stream_support/data/colored_points.las b/Stream_support/test/Stream_support/data/colored_points.las new file mode 100644 index 0000000000000000000000000000000000000000..102aee9443e3685f2351986e4b253a9f6da7a3cd GIT binary patch literal 397 zcmeZq40dC{0vMUF2$C%HnBg&053>>jE077o=wRwKwHMraf_CUMx;hwtVSm~G|Nr0H z6U&FGgV3BP-2eYU-2W$MStEo|RRCqdYLHc-s{pA1nSn3|T?J4ct^%S8RRu_zfdK$t C+dcmP literal 0 HcmV?d00001 diff --git a/Stream_support/test/Stream_support/test_LAS.cpp b/Stream_support/test/Stream_support/test_LAS.cpp new file mode 100644 index 000000000000..555e80f533ab --- /dev/null +++ b/Stream_support/test/Stream_support/test_LAS.cpp @@ -0,0 +1,63 @@ +#include + +#include +#include + +#include +#include +#include + +// types +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef Kernel::FT FT; +typedef Kernel::Point_3 Point; +typedef std::array Color; +typedef std::pair PointWithColor; + +int main(int argc, char* argv[]) +{ + std::ifstream is("data/colored_points.las"); + + // Reads a .las point set file with normal vectors and colors + std::vector points; // store points + if (!CGAL::IO::read_LAS_with_properties(is, std::back_inserter(points), + CGAL::IO::make_las_point_reader(CGAL::First_of_pair_property_map()), + std::make_tuple(CGAL::Second_of_pair_property_map(), + CGAL::Construct_array(), + CGAL::IO::LAS_property::R(), + CGAL::IO::LAS_property::G(), + CGAL::IO::LAS_property::B(), + CGAL::IO::LAS_property::I()))) + { + std::cerr << "Error: cannot read file data/colored_points.las" << std::endl; + return EXIT_FAILURE; + } + + CGAL_assertion(points.size() == 5); + CGAL_assertion(points[0].second[0] == 65535); + CGAL_assertion(points[0].second[1] == 0); + CGAL_assertion(points[0].second[2] == 0); + CGAL_assertion(points[0].second[3] == 0); + + CGAL_assertion(points[1].second[0] == 0); + CGAL_assertion(points[1].second[1] == 65535); + CGAL_assertion(points[1].second[2] == 0); + CGAL_assertion(points[1].second[3] == 0); + + CGAL_assertion(points[2].second[0] == 0); + CGAL_assertion(points[2].second[1] == 0); + CGAL_assertion(points[2].second[2] == 65535); + CGAL_assertion(points[2].second[3] == 0); + + CGAL_assertion(points[3].second[0] == 0); + CGAL_assertion(points[3].second[1] == 65535); + CGAL_assertion(points[3].second[2] == 65535); + CGAL_assertion(points[3].second[3] == 0); + + CGAL_assertion(points[4].second[0] == 65535); + CGAL_assertion(points[4].second[1] == 65535); + CGAL_assertion(points[4].second[2] == 0); + CGAL_assertion(points[4].second[3] == 0); + + return EXIT_SUCCESS; +} From 04e90b7eb43d8457784df46ce956b4f2f6879397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 30 Aug 2024 15:58:57 +0200 Subject: [PATCH 02/10] do not use empty variable --- Stream_support/test/Stream_support/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Stream_support/test/Stream_support/CMakeLists.txt b/Stream_support/test/Stream_support/CMakeLists.txt index 9c41b5b2dac3..a58a12410cc1 100644 --- a/Stream_support/test/Stream_support/CMakeLists.txt +++ b/Stream_support/test/Stream_support/CMakeLists.txt @@ -39,7 +39,7 @@ foreach(cppfile ${cppfiles}) if("${cppfile}" STREQUAL "test_LAS.cpp") if(TARGET CGAL::LASLIB_support) create_single_source_cgal_program("test_LAS.cpp") - target_link_libraries(test_LAS PRIVATE ${CGAL_libs} CGAL::LASLIB_support) + target_link_libraries(test_LAS PRIVATE CGAL::LASLIB_support) else() message(STATUS "NOTICE: Some tests require the LASlib library, and will not be compiled.") endif() From 21f0f805c7a55a6908b8dec13d4c3feb6286b1aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 30 Aug 2024 16:17:38 +0200 Subject: [PATCH 03/10] fix condition --- .../test/Point_set_processing_3/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt index 895fae529074..733ce26de22a 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt @@ -39,7 +39,7 @@ create_single_source_cgal_program( "structuring_test.cpp" ) #Use LAS #disable if MSVC 2017 -if(NOT MSVC_VERSION OR (MSVC_VERSION GREATER_EQUAL 1919 AND MSVC_VERSION LESS 1910)) +if(NOT MSVC_VERSION OR MSVC_VERSION GREATER_EQUAL 1919 OR MSVC_VERSION LESS 1910) find_package(LASLIB) include(CGAL_LASLIB_support) if (TARGET CGAL::LASLIB_support) From ce3e8ae0dea37bb15d285a47f5c4976cd494dfe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 30 Aug 2024 16:23:27 +0200 Subject: [PATCH 04/10] update macro --- Point_set_processing_3/include/CGAL/IO/write_las_points.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_processing_3/include/CGAL/IO/write_las_points.h b/Point_set_processing_3/include/CGAL/IO/write_las_points.h index 661bdf86977d..22e93b232b98 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_las_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_las_points.h @@ -38,7 +38,7 @@ # pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif -#define USE_AS_DLL +#define USE_AS_DLL 1 #include #include #include From e791122b35571b00bbed673b70552615e2b68ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 3 Sep 2024 09:59:02 +0200 Subject: [PATCH 05/10] handle cases when LASZIP and LASLIB have different include paths --- Installation/cmake/modules/FindLASLIB.cmake | 11 +++++++---- Installation/cmake/modules/UseLASLIB.cmake | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Installation/cmake/modules/FindLASLIB.cmake b/Installation/cmake/modules/FindLASLIB.cmake index 2353480c2452..9c557a6dce5b 100644 --- a/Installation/cmake/modules/FindLASLIB.cmake +++ b/Installation/cmake/modules/FindLASLIB.cmake @@ -9,14 +9,15 @@ # first look in user defined locations find_path(LASLIB_INCLUDE_DIR NAMES lasreader.hpp - PATHS /usr/local/include/LASlib/ + PATHS /usr/local/include/LASlib/ ENV LASLIB_INC_DIR ) - + find_path(LASZIP_INCLUDE_DIR NAMES mydefs.hpp PATHS /usr/local/include/LASzip/ ${LASLIB_INCLUDE_DIR}/../../LASzip/src + ${LASLIB_INCLUDE_DIR} ) find_library(LASLIB_LIBRARIES @@ -28,8 +29,10 @@ find_library(LASLIB_LIBRARIES ENV LASLIB_LIB_DIR ) -if(LASLIB_LIBRARIES AND LASLIB_INCLUDE_DIR) +if(LASLIB_LIBRARIES AND LASLIB_INCLUDE_DIR AND LASZIP_INCLUDE_DIR) + if (NOT ${LASLIB_INCLUDE_DIR} STREQUAL ${LASZIP_INCLUDE_DIR}) + list(APPEND LASLIB_INCLUDE_DIR ${LASZIP_INCLUDE_DIR}) + endif() set(LASLIB_FOUND TRUE) set(LASLIB_USE_FILE "UseLASLIB") endif() - diff --git a/Installation/cmake/modules/UseLASLIB.cmake b/Installation/cmake/modules/UseLASLIB.cmake index 1af7a023ceb0..f1ffb0bd9065 100644 --- a/Installation/cmake/modules/UseLASLIB.cmake +++ b/Installation/cmake/modules/UseLASLIB.cmake @@ -3,4 +3,4 @@ add_definitions(-DCGAL_LINKED_WITH_LASLIB) -message(DEPRECATION "This file UseLASLIB.cmake is deprecated, and the imported target `CGAL::TBB_support` from CGAL_LASLIB_support.cmake should be used instead.") +message(DEPRECATION "This file UseLASLIB.cmake is deprecated, and the imported target `CGAL::LASLIB_support` from CGAL_LASLIB_support.cmake should be used instead.") From cb78abd603526cb0af3f4f0b696e08470dc0bc2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 3 Sep 2024 14:20:20 +0200 Subject: [PATCH 06/10] fixes for latest version of LAStools + be compatible with CONFIG mode provided CMAKE_FIND_PACKAGE_PREFER_CONFIG is set to TRUE --- .../cmake/modules/CGAL_LASLIB_support.cmake | 25 +++++++++++++------ Installation/cmake/modules/FindLASLIB.cmake | 11 ++++++++ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Installation/cmake/modules/CGAL_LASLIB_support.cmake b/Installation/cmake/modules/CGAL_LASLIB_support.cmake index e541326fdd83..e471c93f02b9 100644 --- a/Installation/cmake/modules/CGAL_LASLIB_support.cmake +++ b/Installation/cmake/modules/CGAL_LASLIB_support.cmake @@ -1,8 +1,19 @@ -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}" - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${LASLIB_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${LASLIB_LIBRARIES}") +if(LASLIB_FOUND) + if (NOT TARGET CGAL::LASLIB_support) + if (NOT TARGET LASlib) + # message(STATUS "Found using MODULE mode") + 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}" + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${LASLIB_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${LASLIB_LIBRARIES}") + else() + # message(STATUS "Found using CONFIG mode") + add_library(CGAL::LASLIB_support INTERFACE IMPORTED) + set_target_properties(CGAL::LASLIB_support PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_LASLIB") + target_link_libraries(CGAL::LASLIB_support INTERFACE LASlib) + endif() + endif() endif() diff --git a/Installation/cmake/modules/FindLASLIB.cmake b/Installation/cmake/modules/FindLASLIB.cmake index 9c557a6dce5b..00377657ee75 100644 --- a/Installation/cmake/modules/FindLASLIB.cmake +++ b/Installation/cmake/modules/FindLASLIB.cmake @@ -28,6 +28,17 @@ find_library(LASLIB_LIBRARIES ${LASLIB_INCLUDE_DIR}/../../lib ENV LASLIB_LIB_DIR ) +if (NOT LASLIB_LIBRARIES) + #library was renamed in recent versions of LAStools + find_library(LASLIB_LIBRARIES + NAMES LASlib + PATHS ENV LD_LIBRARY_PATH + ENV LIBRARY_PATH + /usr/local/lib + ${LASLIB_INCLUDE_DIR}/../../lib + ENV LASLIB_LIB_DIR + ) +endif() if(LASLIB_LIBRARIES AND LASLIB_INCLUDE_DIR AND LASZIP_INCLUDE_DIR) if (NOT ${LASLIB_INCLUDE_DIR} STREQUAL ${LASZIP_INCLUDE_DIR}) From b46e4359b1ca49926d5c682c46e7a9620a33b242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 3 Sep 2024 15:52:51 +0200 Subject: [PATCH 07/10] make it work also for installed version --- Installation/cmake/modules/FindLASLIB.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Installation/cmake/modules/FindLASLIB.cmake b/Installation/cmake/modules/FindLASLIB.cmake index 00377657ee75..76c090e7edd8 100644 --- a/Installation/cmake/modules/FindLASLIB.cmake +++ b/Installation/cmake/modules/FindLASLIB.cmake @@ -17,6 +17,7 @@ find_path(LASZIP_INCLUDE_DIR NAMES mydefs.hpp PATHS /usr/local/include/LASzip/ ${LASLIB_INCLUDE_DIR}/../../LASzip/src + ${LASLIB_INCLUDE_DIR}/../LASzip ${LASLIB_INCLUDE_DIR} ) From d7601bc1325f855a89378c448418b95cdffdbd24 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Tue, 3 Sep 2024 16:01:37 +0200 Subject: [PATCH 08/10] update CMakeLists.txt condition for Visual Studio 2017 --- Point_set_3/test/Point_set_3/CMakeLists.txt | 6 +++--- .../test/Point_set_processing_3/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Point_set_3/test/Point_set_3/CMakeLists.txt b/Point_set_3/test/Point_set_3/CMakeLists.txt index bb283d437711..82424d516a6f 100644 --- a/Point_set_3/test/Point_set_3/CMakeLists.txt +++ b/Point_set_3/test/Point_set_3/CMakeLists.txt @@ -32,7 +32,7 @@ create_single_source_cgal_program("test_deprecated_io_ps.cpp") #Use LAS #disable if MSVC 2017 -if(NOT MSVC_VERSION OR (MSVC_VERSION GREATER_EQUAL 1919 AND MSVC_VERSION LESS 1910)) +if(NOT MSVC_VERSION OR MSVC_VERSION GREATER_EQUAL 1919 OR MSVC_VERSION LESS 1910) find_package(LASLIB) include(CGAL_LASLIB_support) if (TARGET CGAL::LASLIB_support) @@ -41,5 +41,5 @@ if(NOT MSVC_VERSION OR (MSVC_VERSION GREATER_EQUAL 1919 AND MSVC_VERSION LESS 1 message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.") endif() else() - message(STATUS "NOTICE : the LAS reader does not work with Visual Studio 2017.") -endif() + message(STATUS "NOTICE : the LAS reader does not work with your version of Visual Studio 2017.") +endif() \ No newline at end of file diff --git a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt index 733ce26de22a..4112a9e035aa 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt @@ -49,7 +49,7 @@ if(NOT MSVC_VERSION OR MSVC_VERSION GREATER_EQUAL 1919 OR MSVC_VERSION LESS 1910 message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.") endif() else() - message(STATUS "NOTICE : the LAS reader does not work with Visual Studio 2017.") + message(STATUS "NOTICE : the LAS reader does not work with your version of Visual Studio 2017.") endif() # Use Eigen From 1cf6fe884d965eb20c46b3b9adb50729b7292642 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Tue, 3 Sep 2024 16:05:37 +0200 Subject: [PATCH 09/10] missing end of line --- Point_set_3/test/Point_set_3/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_3/test/Point_set_3/CMakeLists.txt b/Point_set_3/test/Point_set_3/CMakeLists.txt index 82424d516a6f..75a8b79c7bf7 100644 --- a/Point_set_3/test/Point_set_3/CMakeLists.txt +++ b/Point_set_3/test/Point_set_3/CMakeLists.txt @@ -42,4 +42,4 @@ if(NOT MSVC_VERSION OR MSVC_VERSION GREATER_EQUAL 1919 OR MSVC_VERSION LESS 1910 endif() else() message(STATUS "NOTICE : the LAS reader does not work with your version of Visual Studio 2017.") -endif() \ No newline at end of file +endif() From e3b65d3c7557f00de8b7940bb48679fe27422844 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Wed, 4 Sep 2024 10:39:53 +0200 Subject: [PATCH 10/10] changing LAS_TOOLS_VERSION check to proper version --- Point_set_processing_3/include/CGAL/IO/read_las_points.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_las_points.h b/Point_set_processing_3/include/CGAL/IO/read_las_points.h index e7d70470ff13..e22ffa59369e 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_las_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_las_points.h @@ -385,7 +385,7 @@ bool read_LAS_with_properties(std::istream& is, if(!is) return false; -#if LAS_TOOLS_VERSION <= 170805 +#if LAS_TOOLS_VERSION < 240319 LASreaderLAS lasreader; #else LASreaderLAS lasreader(nullptr);