Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimum c++ std to c++17 #3348

Merged
merged 10 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Notable changes to QMCPACK are documented in this file.

## [Unreleased]

* C++17 is required [\#3348](https://github.com/QMCPACK/qmcpack/pull/3348).
* Quantum ESPRESSO (QE) v6.8 support. [\#3301](https://github.com/QMCPACK/qmcpack/pull/3301).
* To aid coexistence of real and complex builds, the qmcpack executable is now named qmcpack_complex for builds with QMC_COMPLEX=1

Expand Down
2 changes: 1 addition & 1 deletion CMake/Testlibstdc++.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ try_compile(
${CMAKE_BINARY_DIR}
${PROJECT_CMAKE}/try_compile_sources/check_libstdcxx.cpp
CXX_STANDARD
14
17
CXX_STANDARD_REQUIRED
ON
OUTPUT_VARIABLE COMPILE_OUTPUT)
Expand Down
12 changes: 4 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ set(EXECUTABLE_OUTPUT_PATH
# Set C++ standard used by QMCPACK
##################################
set(QMC_CXX_STANDARD
14
17
CACHE STRING "QMCPACK C++ language standard")
if(NOT QMC_CXX_STANDARD EQUAL 14)
message(WARNING "C++14 is the only language standard officially supported by this QMCPACK version. "
if(NOT QMC_CXX_STANDARD EQUAL 17)
message(WARNING "C++17 is the only language standard officially supported by this QMCPACK version. "
"Using other versions of the C++ standard is unsupported and done entirely at user's own risk.")
endif()

Expand Down Expand Up @@ -407,11 +407,7 @@ include(CMake/Testlibstdc++.cmake)
#---------------------------------------------------------
# Check that a C++ standard library is configured properly
#---------------------------------------------------------
if(QMC_CXX_STANDARD GREATER_EQUAL 17)
include(CMake/TestCxx17Library.cmake)
else()
include(CMake/TestCxx14Library.cmake)
endif()
include(CMake/TestCxx17Library.cmake)

if(ENABLE_GCOV)
if(NOT GCOV_SUPPORTED)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ particular emphasis is placed on code quality and reproducibility.

# Prerequisites

* C++ 14 and C99 capable compilers.
* C++ 17 and C99 capable compilers.
* CMake v3.14.0 or later, build utility, http://www.cmake.org
* BLAS/LAPACK, numerical library. Use platform-optimized libraries.
* LibXml2, XML parser, http://xmlsoft.org/
Expand Down
19 changes: 9 additions & 10 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ newer versions are faster; see :ref:`buildperformance` for performance suggestio
unsupported and untested by the developers although they may still work.

- C/C++ compilers such as GNU, Clang, Intel, and IBM XL. C++ compilers
are required to support the C++ 14 standard. Use of recent (“current
are required to support the C++ 17 standard. Use of recent (“current
year version”) compilers is strongly encouraged.

- An MPI library such as OpenMPI (http://open-mpi.org) or a
Expand Down Expand Up @@ -143,23 +143,23 @@ Many of the utilities provided with QMCPACK require Python (v3). The numpy
and matplotlib libraries are required for full functionality.


C++ 14 standard library
C++ 17 standard library
-----------------------

The C++ standard consists of language features—which are implemented in
the compiler—and library features—which are implemented in the standard
library. GCC includes its own standard library and headers, but many
compilers do not and instead reuse those from an existing GCC install.
Depending on setup and installation, some of these compilers might not
default to using a GCC with C++ 14 headers (e.g., GCC 4.8 is common as a
default to using a GCC with C++ 17 headers (e.g., GCC 4.8 is common as a
base system compiler, but its standard library only supports C++ 11).

The symptom of having header files that do not support the C++ 14
The symptom of having header files that do not support the C++ 17
standard is usually compile errors involving standard include header
files. Look for the GCC library version, which should be present in the
path to the include file in the error message, and ensure that it is 5.0
path to the include file in the error message, and ensure that it is 8.1
or greater. To avoid these errors occurring at compile time, QMCPACK
tests for a C++ 14 standard library during configuration and will halt
tests for a C++ 17 standard library during configuration and will halt
with an error if one is not found.

At sites that use modules, it is often sufficient to simply load a newer
Expand All @@ -168,14 +168,14 @@ GCC.
Intel compiler
~~~~~~~~~~~~~~

The Intel compiler version must be 19 or newer due to use of C++14 and bugs and limitations in earlier versions.
The Intel compiler version must be 19 or newer due to use of C++17 and bugs and limitations in earlier versions.

If a newer GCC is needed, the ``-cxxlib`` option can be used to point to a different
GCC installation. (Alternately, the ``-gcc-name`` or ``-gxx-name`` options can be used.) Be sure to
pass this flag to the C compiler in addition to the C++ compiler. This
is necessary because CMake extracts some library paths from the C
compiler, and those paths usually also contain to the C++ library. The
symptom of this problem is C++ 14 standard library functions not found
symptom of this problem is C++ 17 standard library functions not found
at link time.

.. _cmake:
Expand All @@ -186,8 +186,7 @@ Building with CMake
The build system for QMCPACK is based on CMake. It will autoconfigure
based on the detected compilers and libraries. The most recent version
of CMake has the best detection for the greatest variety of systems. The
minimum required version of CMake is 3.6, which is the oldest version to
support correct application of C++ 14 flags for the Intel compiler. Most
minimum required version of CMake is 3.14.0 (I think its actually higher). Most
computer installations have a sufficiently recent CMake, though it might
not be the default.

Expand Down