Skip to content

Commit 3f98c71

Browse files
committed
Require C++17 in autotools and cmake
1 parent 250bd38 commit 3f98c71

9 files changed

+22
-44
lines changed

.github/workflows/linux-full-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,6 @@ jobs:
101101
cc: clang
102102
cxx: clang++
103103
cxxflags: -Wno-deprecated-declarations
104-
- name: "C++14 mode"
105-
shortname: c++14
106-
tag: rolling
107-
cc: gcc
108-
cxx: g++
109-
cxxflags: "-std=c++14"
110104
- name: "C++17 mode"
111105
shortname: c++17
112106
tag: rolling

.github/workflows/linux-nondefault.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ jobs:
9696
cc: clang
9797
cxx: clang++
9898
cxxflags: -Wno-deprecated-declarations
99-
- name: "C++14 mode"
100-
shortname: c++14
101-
tag: rolling
102-
cc: gcc
103-
cxx: g++
104-
cxxflags: "-std=c++14"
10599
- name: "C++17 mode"
106100
shortname: c++17
107101
tag: rolling
@@ -125,7 +119,6 @@ jobs:
125119
tag: rolling
126120
cc: gcc
127121
cxx: g++
128-
cxxflags: "-std=c++17"
129122
configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-any --enable-std-optional
130123
- name: "OpenMP enabled"
131124
shortname: openmp

.github/workflows/linux.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ jobs:
4040
cxx: clang++
4141
cxxflags: -Wno-deprecated-declarations
4242
tests: true
43-
- name: "C++14 mode"
44-
shortname: c++14
45-
tag: rolling
46-
cc: gcc
47-
cxx: g++
48-
cxxflags: "-std=c++14"
4943
- name: "C++17 mode"
5044
shortname: c++17
5145
tag: rolling

.github/workflows/macos-nondefault.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
classes: [boost, std]
1414
include:
1515
- classes: std
16-
cxxflags: "-std=c++17"
1716
configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-optional --enable-std-any
1817
steps:
1918
- uses: actions/checkout@v4
@@ -28,7 +27,7 @@ jobs:
2827
- name: Build
2928
run: |
3029
./autogen.sh
31-
./configure --disable-shared --with-boost-include=`brew --prefix`/include --enable-error-lines --enable-error-functions --enable-tracing --enable-indexed-coupons --enable-extra-safety-checks --enable-sessions --enable-thread-safe-observer-pattern --enable-intraday --disable-faster-lazy-objects --enable-throwing-in-cycles --enable-null-as-functions ${{ matrix.configureflags }} CC="clang" CXX="clang++" CXXFLAGS="-O2 -g0 -Wall -Werror ${{ matrix.cxxflags }}"
30+
./configure --disable-shared --with-boost-include=`brew --prefix`/include --enable-error-lines --enable-error-functions --enable-tracing --enable-indexed-coupons --enable-extra-safety-checks --enable-sessions --enable-thread-safe-observer-pattern --enable-intraday --disable-faster-lazy-objects --enable-throwing-in-cycles --enable-null-as-functions ${{ matrix.configureflags }} CC="clang" CXX="clang++" CXXFLAGS="-O2 -g0 -Wall -Werror"
3231
make -j 3
3332
- name: Run tests
3433
run: |

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ set(QL_EXTERNAL_SUBDIRECTORIES "" CACHE STRING "Optional list of external source
7272
# set -lpapi here
7373
set(QL_EXTRA_LINK_LIBRARIES "" CACHE STRING "Optional extra link libraries to add to QuantLib")
7474

75-
# Require C++14 or higher
75+
# Require C++17 or higher
7676
if (NOT DEFINED CMAKE_CXX_STANDARD)
77-
set(CMAKE_CXX_STANDARD 14)
78-
elseif(CMAKE_CXX_STANDARD LESS 14)
79-
message(FATAL_ERROR "Please specify CMAKE_CXX_STANDARD of 14 or higher")
77+
set(CMAKE_CXX_STANDARD 17)
78+
elseif(CMAKE_CXX_STANDARD LESS 17)
79+
message(FATAL_ERROR "Please specify CMAKE_CXX_STANDARD of 17 or higher")
8080
endif()
8181
if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
8282
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8383
endif()
84-
# Avoid use of compiler language extensions, i.e. -std=c++14 not -std=gnu++14
84+
# Avoid use of compiler language extensions, i.e. -std=c++17 not -std=gnu++17
8585
if (NOT DEFINED CMAKE_CXX_EXTENSIONS)
8686
set(CMAKE_CXX_EXTENSIONS FALSE)
8787
endif()

acinclude.m4

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11

2-
# QL_CHECK_CPP14
2+
# QL_CHECK_CPP17
33
# --------------------
4-
# Check whether C++14 features are supported by default.
5-
# If not (e.g., with Clang on Mac OS) add -std=c++14
6-
AC_DEFUN([QL_CHECK_CPP14],
7-
[AC_MSG_CHECKING([for C++14 support])
4+
# Check whether C++17 features are supported by default.
5+
# If not (e.g., with Clang on Mac OS) add -std=c++17
6+
AC_DEFUN([QL_CHECK_CPP17],
7+
[AC_MSG_CHECKING([for C++17 support])
88
AC_COMPILE_IFELSE(
99
[AC_LANG_PROGRAM(
10-
[[@%:@include <memory>
11-
class C {
12-
public:
13-
C(int) noexcept;
14-
auto f() { return std::make_unique<C>(1); }
15-
};
10+
[[@%:@include <optional>
11+
int main() {
12+
auto x = std::optional<int>{42};
13+
}
1614
]],
1715
[[]])],
1816
[AC_MSG_RESULT([yes])],
19-
[AC_MSG_RESULT([no: adding -std=c++14 to CXXFLAGS])
20-
AC_SUBST([CPP14_CXXFLAGS],["-std=c++14"])
21-
AC_SUBST([CXXFLAGS],["${CXXFLAGS} -std=c++14"])
17+
[AC_MSG_RESULT([no: adding -std=c++17 to CXXFLAGS])
18+
AC_SUBST([CPP17_CXXFLAGS],["-std=c++17"])
19+
AC_SUBST([CXXFLAGS],["${CXXFLAGS} -std=c++17"])
2220
])
2321
])
2422

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ if test "$ql_openmp" = "yes" ; then
6464
AC_SUBST([CXXFLAGS],["${CXXFLAGS} ${OPENMP_CXXFLAGS}"])
6565
fi
6666

67-
# Check for C++14 support
68-
QL_CHECK_CPP14
67+
# Check for C++17 support
68+
QL_CHECK_CPP17
6969

7070
# Check for other compiler flags
7171
QL_CHECK_SYSTEM_HEADER_PREFIX

quantlib-config.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ while test $# -gt 0; do
3939
echo @PACKAGE_VERSION@
4040
;;
4141
--cflags)
42-
echo -I@includedir@ @BOOST_INCLUDE@ @OPENMP_CXXFLAGS@ @PTHREAD_CXXFLAGS@ @CPP14_CXXFLAGS@
42+
echo -I@includedir@ @BOOST_INCLUDE@ @OPENMP_CXXFLAGS@ @PTHREAD_CXXFLAGS@ @CPP17_CXXFLAGS@
4343
;;
4444
--libs)
4545
echo -L@libdir@ -lQuantLib @OPENMP_CXXFLAGS@ @PTHREAD_LIB@

quantlib.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ includedir=@includedir@
66
Name: QuantLib
77
Description: The free/open-source library for quantitative finance.
88
Version: @PACKAGE_VERSION@
9-
Cflags: -I@includedir@ @BOOST_INCLUDE@ @OPENMP_CXXFLAGS@ @PTHREAD_CXXFLAGS@ @CPP14_CXXFLAGS@
9+
Cflags: -I@includedir@ @BOOST_INCLUDE@ @OPENMP_CXXFLAGS@ @PTHREAD_CXXFLAGS@ @CPP17_CXXFLAGS@
1010
Libs: -L@libdir@ -lQuantLib @OPENMP_CXXFLAGS@ @PTHREAD_LIB@

0 commit comments

Comments
 (0)