From 4e73831c74de96dbff5ace23aff99db9d8d8b62d Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 20 Aug 2024 15:45:02 -0400 Subject: [PATCH 1/2] breaking: drop C++ 11 Fix #4060. --- doc/install/install-from-source.md | 3 ++- source/CMakeLists.txt | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/install/install-from-source.md b/doc/install/install-from-source.md index c0b78004d0..b9eabeccc2 100644 --- a/doc/install/install-from-source.md +++ b/doc/install/install-from-source.md @@ -108,7 +108,8 @@ Check the compiler version on your machine gcc --version ``` -The compiler GCC 4.8 or later is supported in the DeePMD-kit. +By default, DeePMD-kit uses C++ 14, so the compiler needs to support C++ 14 (GCC 5 or later). +The backend package may use a higher C++ standard version, and thus require a higher compiler version (for example, GCC 7 for C++ 17). ::::{tab-set} diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 4f23a85fd5..6e96f4a411 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -16,6 +16,10 @@ macro(set_if_higher VARIABLE VALUE) set(${VARIABLE} ${VALUE}) endif() endmacro() +if (NOT DEEPMD_C_ROOT) + # we can still allow C++ 11 for programs linked to the C library + set_if_higher(CMAKE_CXX_STANDARD 14) +endif() if(BUILD_TESTING) enable_testing() From a1a869860012006c26ec4fb9b4368ecb0723c2d7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 19:46:59 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/install/install-from-source.md | 2 +- source/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/install/install-from-source.md b/doc/install/install-from-source.md index b9eabeccc2..c3ae67a6f1 100644 --- a/doc/install/install-from-source.md +++ b/doc/install/install-from-source.md @@ -109,7 +109,7 @@ gcc --version ``` By default, DeePMD-kit uses C++ 14, so the compiler needs to support C++ 14 (GCC 5 or later). -The backend package may use a higher C++ standard version, and thus require a higher compiler version (for example, GCC 7 for C++ 17). +The backend package may use a higher C++ standard version, and thus require a higher compiler version (for example, GCC 7 for C++ 17). ::::{tab-set} diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 6e96f4a411..71b3dca1ea 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -16,7 +16,7 @@ macro(set_if_higher VARIABLE VALUE) set(${VARIABLE} ${VALUE}) endif() endmacro() -if (NOT DEEPMD_C_ROOT) +if(NOT DEEPMD_C_ROOT) # we can still allow C++ 11 for programs linked to the C library set_if_higher(CMAKE_CXX_STANDARD 14) endif()