Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to C++17 #536

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -235,21 +235,21 @@ check_symbol_exists(_POSIX_TIMERS "unistd.h;time.h" POSIX_TIMERS)

#========================== libpointmatcher itself ==============================

# Check the compiler version as we need full C++11 support.
# Check the compiler version as we need full C++17 support.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# using Clang
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.3")
message(WARNING, "Your clang compiler has version ${CMAKE_CXX_COMPILER_VERSION}, while only version 3.3 or later is supported")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5")
message(WARNING, "Your clang compiler has version ${CMAKE_CXX_COMPILER_VERSION}, while only version 5 or later is supported")
endif ()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# using AppleClang
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.1")
message(WARNING "Your XCode environment has version ${CMAKE_CXX_COMPILER_VERSION}, while only version 5.1 or later is supported")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "7.0")
message(WARNING "Your XCode environment has version ${CMAKE_CXX_COMPILER_VERSION}, while only version 7.0 or later is supported")
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using GCC
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.2")
message(WARNING, "Your g++ compiler has version ${CMAKE_CXX_COMPILER_VERSION}, while only version 4.8.2 or later is supported")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9")
message(WARNING, "Your g++ compiler has version ${CMAKE_CXX_COMPILER_VERSION}, while only version 9 or later is supported")
endif ()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# using MSVC
Expand All @@ -258,18 +258,18 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
endif()
endif ()

# enable C++11 support.
if (CMAKE_VERSION VERSION_LESS "3.1")
# enable C++17 support.
if (CMAKE_VERSION VERSION_LESS "3.8")
if (MSVC)
message(FATAL_ERROR, "CMake version 3.1 or later is required to compiler ${PROJECT_NAME} with Microsoft Visual C++")
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
else ()
set (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}")
endif ()
else ()
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 17)
endif ()

# SOURCE
Expand Down
2 changes: 1 addition & 1 deletion pointmatcher/DataPointsFilters/NormalSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void NormalSpaceDataPointsFilter<T>::inPlaceFilter(DataPoints& cloud)
// Generate a random sequence of indices so that elements are placed in buckets in random order
std::vector<std::size_t> randIdcs(nbPoints);
std::iota(randIdcs.begin(), randIdcs.end(), 0);
std::random_shuffle(randIdcs.begin(), randIdcs.end());
std::shuffle(randIdcs.begin(), randIdcs.end(), gen);

///(1) put all points of the data into buckets based on their normal direction
for (auto randIdx : randIdcs)
Expand Down