Skip to content

Commit

Permalink
breaking: drop C++ 11 (deepmodeling#4068)
Browse files Browse the repository at this point in the history
Fix deepmodeling#4060.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Documentation**
- Updated installation documentation to clarify C++ compiler
requirements, specifying that GCC 5 or higher is necessary for C++ 14
and potentially GCC 7 for C++ 17.
  
- **Chores**
- Enhanced CMake configuration to support C++ 14 in specific scenarios,
improving compatibility with older codebases.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and Mathieu Taillefumier committed Sep 18, 2024
1 parent 3238359 commit 623cbb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/install/install-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
4 changes: 4 additions & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 623cbb5

Please sign in to comment.