Skip to content

Commit

Permalink
Merge pull request #3348 from PDoakORNL/drop_c++14
Browse files Browse the repository at this point in the history
Minimum c++ std to c++17
  • Loading branch information
ye-luo authored Aug 11, 2021
2 parents 0066161 + 2000a0c commit 5716f3e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 68 deletions.
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
48 changes: 0 additions & 48 deletions CMake/TestCxx14Library.cmake

This file was deleted.

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
${QMC_CXX_STANDARD}
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. Most
computer installations have a sufficiently recent CMake, though it might
not be the default.

Expand Down

0 comments on commit 5716f3e

Please sign in to comment.