Skip to content

Commit

Permalink
Require C++17 (BlueBrain/CoreNeuron#834)
Browse files Browse the repository at this point in the history
* Bump submodule past nmodlBlueBrain/CoreNeuron#889.

CoreNEURON Repo SHA: BlueBrain/CoreNeuron@511613e
  • Loading branch information
olupton authored Jul 6, 2022
1 parent d16a93c commit e606ee2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
12 changes: 8 additions & 4 deletions cmake/coreneuron/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

# =============================================================================
Expand Down Expand Up @@ -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()

# ~~~
Expand Down
5 changes: 2 additions & 3 deletions cmake/coreneuron/MakefileBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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}
Expand Down
2 changes: 0 additions & 2 deletions cmake/coreneuron/OpenAccHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion external/nmodl
Submodule nmodl updated from d38eb7 to 58456d

0 comments on commit e606ee2

Please sign in to comment.