Skip to content

Commit

Permalink
Require at least C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
mvieth committed Dec 15, 2024
1 parent 6c1a9db commit 2d4a3fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@
cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR)

# Set target C++ standard and required compiler features
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The target C++ standard. PCL requires C++14 or higher.")
set(CMAKE_CXX_STANDARD 17 CACHE STRING "The target C++ standard. PCL requires C++14 or higher.")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(PCL_CXX_COMPILE_FEATURES cxx_std_14)
if("${CMAKE_CXX_STANDARD}" GREATER_EQUAL 17)
set(PCL_CXX_COMPILE_FEATURES cxx_std_17)
set(PCL__cplusplus 201703L)
set(PCL_REQUIRES_MSC_VER 1912)
elseif("${CMAKE_CXX_STANDARD}" EQUAL 14)
set(PCL_CXX_COMPILE_FEATURES cxx_std_14)
set(PCL__cplusplus 201402L)
set(PCL_REQUIRES_MSC_VER 1900)
else()
message(FATAL_ERROR "Unknown or unsupported C++ standard specified")
endif()

set(CMAKE_CUDA_STANDARD 14 CACHE STRING "The target CUDA/C++ standard. PCL requires CUDA/C++ 14 or higher.")
set(CMAKE_CUDA_STANDARD 17 CACHE STRING "The target CUDA/C++ standard. PCL requires CUDA/C++ 14 or higher.")
set(CMAKE_CUDA_STANDARD_REQUIRED ON)

set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "possible configurations" FORCE)
Expand Down
4 changes: 2 additions & 2 deletions pcl_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// Ensure the compiler is meeting the minimum C++ standard
// MSVC is not checked via __cplusplus due to
// https://developercommunity.visualstudio.com/content/problem/120156/-cplusplus-macro-still-defined-as-pre-c11-value.html
#if defined(__cplusplus) && ((!defined(_MSC_VER) && __cplusplus < 201402L) || (defined(_MSC_VER) && _MSC_VER < 1900))
#error PCL requires C++14 or above
#if defined(__cplusplus) && ((!defined(_MSC_VER) && __cplusplus < ${PCL__cplusplus}) || (defined(_MSC_VER) && _MSC_VER < ${PCL_REQUIRES_MSC_VER}) || (defined(_MSVC_LANG) && _MSVC_LANG < ${PCL__cplusplus}))
#error C++ standard too low (PCL requires ${PCL__cplusplus} or above)
#endif

#define BUILD_@CMAKE_BUILD_TYPE@
Expand Down
2 changes: 1 addition & 1 deletion test/fuzz/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ $CXX $CXXFLAGS -DPCLAPI_EXPORTS \
-I/src/pcl/build/include -I/src/pcl/common/include \
-I/src/pcl/dssdk/include \
-I/src/pcl/io/include -isystem /usr/include/eigen3 \
-O2 -g -DNDEBUG -fPIC -std=c++14 \
-O2 -g -DNDEBUG -fPIC -std=c++17 \
-o ply_reader_fuzzer.o -c ply_reader_fuzzer.cpp

$CXX $CXXFLAGS $LIB_FUZZING_ENGINE ply_reader_fuzzer.o \
Expand Down

0 comments on commit 2d4a3fe

Please sign in to comment.