diff --git a/CMake/MakefileBuildOptions.cmake b/CMake/MakefileBuildOptions.cmake index a22a00bb7..7aef0c549 100644 --- a/CMake/MakefileBuildOptions.cmake +++ b/CMake/MakefileBuildOptions.cmake @@ -75,8 +75,7 @@ endforeach() # ============================================================================= # compile flags : common to all backend # ============================================================================= -# PGI compiler adds --c++14;-A option for C++14, remove ";" -string(REPLACE ";" " " CXX14_STD_FLAGS "${CMAKE_CXX14_STANDARD_COMPILE_OPTION}") +string(JOIN " " CMAKE_CXX17_STANDARD_COMPILE_OPTION_STRING ${CMAKE_CXX17_STANDARD_COMPILE_OPTION}) string(TOUPPER "${CMAKE_BUILD_TYPE}" _BUILD_TYPE) list(TRANSFORM CORENRN_COMPILE_DEFS PREPEND -D OUTPUT_VARIABLE CORENRN_COMPILE_DEF_FLAGS) string( @@ -85,7 +84,7 @@ string( CORENRN_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_BUILD_TYPE}} - ${CXX14_STD_FLAGS} + ${CMAKE_CXX17_STANDARD_COMPILE_OPTION_STRING} ${NVHPC_ACC_COMP_FLAGS} ${NVHPC_CXX_INLINE_FLAGS} ${CORENRN_COMPILE_DEF_FLAGS} diff --git a/CMake/OpenAccHelper.cmake b/CMake/OpenAccHelper.cmake index bb09f8966..1c18225b6 100644 --- a/CMake/OpenAccHelper.cmake +++ b/CMake/OpenAccHelper.cmake @@ -85,8 +85,6 @@ if(CORENRN_ENABLE_GPU) else() message(FATAL_ERROR "${CORENRN_ACCELERATOR_OFFLOAD} not supported with NVHPC compilers") endif() - # avoid PGI adding standard compliant "-A" flags - set(CMAKE_CXX14_STANDARD_COMPILE_OPTION --c++14) string(APPEND CMAKE_EXE_LINKER_FLAGS " ${NVHPC_ACC_COMP_FLAGS}") # Use `-Mautoinline` option to compile .cpp files generated from .mod files only. This is # especially needed when we compile with -O0 or -O1 optimisation level where we get link errors. diff --git a/CMakeLists.txt b/CMakeLists.txt index a7829b3d5..cb1c96b6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,18 +23,17 @@ math(EXPR CORENEURON_VERSION_COMBINED # ============================================================================= # CMake common project settings # ============================================================================= -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Empty or one of Debug, Release, RelWithDebInfo") -if(NOT "cxx_std_14" IN_LIST CMAKE_CXX_COMPILE_FEATURES OR NOT "cxx_digit_separators" IN_LIST - CMAKE_CXX_COMPILE_FEATURES) +if(NOT "cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES) message( FATAL_ERROR - "This compiler does not fully support C++14, choose an higher version or an other compiler.") + "This compiler does not fully support C++17, choose a higher version or another compiler.") endif() # ============================================================================= @@ -297,6 +296,11 @@ if(CORENRN_HAVE_NVHPC_COMPILER) # problem. If GPU support is disabled, we define R123_USE_INTRIN_H=0 to avoid the problem. list(APPEND CORENRN_COMPILE_DEFS R123_USE_INTRIN_H=0) endif() + # CMake versions <3.19 used to add -A when using NVHPC/PGI, which makes the compiler excessively + # pedantic. See https://gitlab.kitware.com/cmake/cmake/-/issues/20997. + if(CMAKE_VERSION VERSION_LESS 3.19) + list(REMOVE_ITEM CMAKE_CXX17_STANDARD_COMPILE_OPTION -A) + endif() endif() # ~~~ diff --git a/external/nmodl b/external/nmodl index d38eb74b7..58456d101 160000 --- a/external/nmodl +++ b/external/nmodl @@ -1 +1 @@ -Subproject commit d38eb74b71728e9ab3e9dc43c986d662faa3ff9e +Subproject commit 58456d1018a177691ce4d63ac2ef436d1e535000