Skip to content

Commit 9afbdb8

Browse files
author
ralfeckel
committed
Merge branch 'master' into cmake_with_default_warnings
2 parents 3a59c54 + b7f3dc2 commit 9afbdb8

112 files changed

Lines changed: 1451 additions & 304 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
tag: rolling
142142
cc: gcc
143143
cxx: g++
144-
configureflags: --enable-std-classes
144+
configureflags: --enable-std-classes --enable-std-any --enable-std-optional
145145
- name: "Thread-safe observer enabled"
146146
shortname: threadsafe
147147
tag: rolling

.github/workflows/linux-nondefault.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
cc: gcc
131131
cxx: g++
132132
cxxflags: "-std=c++17"
133-
configureflags: --enable-std-classes
133+
configureflags: --enable-std-classes --enable-std-any --enable-std-optional
134134
- name: "OpenMP enabled"
135135
shortname: openmp
136136
tag: rolling

.github/workflows/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
tag: rolling
145145
cc: gcc
146146
cxx: g++
147-
configureflags: --enable-std-classes
147+
configureflags: --enable-std-classes --enable-std-any --enable-std-optional
148148
tests: true
149149
- name: "Thread-safe observer enabled"
150150
shortname: threadsafe

.github/workflows/macos-nondefault.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ jobs:
1515
- os: [macos-11]
1616
shortname: stdclasses-11
1717
cxxflags: "-std=c++17"
18-
configureflags: --enable-std-classes
18+
configureflags: --enable-std-classes --enable-std-optional
1919
- os: [macos-12]
2020
shortname: default-12
2121
- os: [macos-12]
2222
shortname: stdclasses-12
2323
cxxflags: "-std=c++17"
24-
configureflags: --enable-std-classes
24+
configureflags: --enable-std-classes --enable-std-optional
2525
steps:
2626
- uses: actions/checkout@v3
2727
- name: Setup

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
staleness-check:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/stale@v7
9+
- uses: actions/stale@v8
1010
with:
1111
repo-token: ${{ secrets.GITHUB_TOKEN }}
1212
stale-issue-message: 'This issue was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks.'

CMakeLists.txt

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -60,49 +60,15 @@ option(QL_INSTALL_TEST_SUITE "Install test suite" ON)
6060
option(QL_TAGGED_LAYOUT "Library names use layout tags" ${MSVC})
6161
option(QL_USE_CLANG_TIDY "Use clang-tidy when building" OFF)
6262
option(QL_USE_INDEXED_COUPON "Use indexed coupons instead of par coupons" OFF)
63+
option(QL_USE_STD_ANY "Use std::any instead of boost::any" OFF)
6364
option(QL_USE_STD_CLASSES "Enable all QL_USE_STD_ options" OFF)
64-
option(QL_USE_STD_SHARED_PTR "Use standard smart pointers instead of Boost ones" OFF)
6565
option(QL_USE_STD_FUNCTION "Use std::function and std::bind instead of Boost ones" OFF)
66+
option(QL_USE_STD_OPTIONAL "Use std::optional instead of boost::optional" OFF)
67+
option(QL_USE_STD_SHARED_PTR "Use standard smart pointers instead of Boost ones" OFF)
6668
option(QL_USE_STD_TUPLE "Use std::tuple instead of boost::tuple" OFF)
6769
set(QL_EXTERNAL_SUBDIRECTORIES "" CACHE STRING "Optional list of external source directories to be added to the build (semicolon-separated)")
6870
set(QL_EXTRA_LINK_LIBRARIES "" CACHE STRING "Optional extra link libraries to add to QuantLib")
6971

70-
# Convenience option to activate all STD options
71-
if (QL_USE_STD_CLASSES)
72-
set(QL_USE_STD_SHARED_PTR ON)
73-
set(QL_USE_STD_FUNCTION ON)
74-
set(QL_USE_STD_TUPLE ON)
75-
endif()
76-
77-
if (QL_USE_CLANG_TIDY)
78-
if (NOT DEFINED QL_CLANG_TIDY)
79-
set(QL_CLANG_TIDY clang-tidy)
80-
endif()
81-
if (NOT DEFINED QL_CLANG_TIDY_OPTIONS)
82-
set(QL_CLANG_TIDY_OPTIONS)
83-
endif()
84-
if (QL_CLANG_TIDY_OPTIONS)
85-
set(CMAKE_CXX_CLANG_TIDY "${QL_CLANG_TIDY};${QL_CLANG_TIDY_OPTIONS}")
86-
else()
87-
set(CMAKE_CXX_CLANG_TIDY "${QL_CLANG_TIDY}")
88-
endif()
89-
endif()
90-
91-
# Project shared libs ON for UNIX
92-
if (NOT DEFINED BUILD_SHARED_LIBS)
93-
set(BUILD_SHARED_LIBS ${UNIX})
94-
endif()
95-
96-
# Boost static libs ON for MSVC
97-
if (NOT DEFINED Boost_USE_STATIC_LIBS)
98-
set(Boost_USE_STATIC_LIBS ${MSVC})
99-
endif()
100-
101-
# Boost static runtime ON for MSVC
102-
if (NOT DEFINED Boost_USE_STATIC_RUNTIME)
103-
set(Boost_USE_STATIC_RUNTIME ${MSVC})
104-
endif()
105-
10672
# Require C++14 or higher
10773
if (NOT DEFINED CMAKE_CXX_STANDARD)
10874
set(CMAKE_CXX_STANDARD 14)
@@ -117,6 +83,26 @@ if (NOT DEFINED CMAKE_CXX_EXTENSIONS)
11783
set(CMAKE_CXX_EXTENSIONS FALSE)
11884
endif()
11985

86+
# Convenience option to activate all STD options
87+
if (QL_USE_STD_CLASSES)
88+
if (CMAKE_CXX_STANDARD GREATER_EQUAL 17)
89+
set(QL_USE_STD_ANY ON)
90+
set(QL_USE_STD_OPTIONAL ON)
91+
endif()
92+
set(QL_USE_STD_FUNCTION ON)
93+
set(QL_USE_STD_SHARED_PTR ON)
94+
set(QL_USE_STD_TUPLE ON)
95+
endif()
96+
97+
if (CMAKE_CXX_STANDARD LESS 17)
98+
if (QL_USE_STD_ANY)
99+
message(FATAL_ERROR "QL_USE_STD_ANY requires at least C++17")
100+
endif()
101+
if (QL_USE_STD_OPTIONAL)
102+
message(FATAL_ERROR "QL_USE_STD_OPTIONAL requires at least C++17")
103+
endif()
104+
endif ()
105+
120106
# Set the default warning level we use to pass the GitHub workflows
121107
if (QL_ENABLE_DEFAULT_WARNING_LEVEL)
122108
if (MSVC)
@@ -145,6 +131,35 @@ if (QL_COMPILE_WARNING_AS_ERROR)
145131
endif()
146132
endif()
147133

134+
if (QL_USE_CLANG_TIDY)
135+
if (NOT DEFINED QL_CLANG_TIDY)
136+
set(QL_CLANG_TIDY clang-tidy)
137+
endif()
138+
if (NOT DEFINED QL_CLANG_TIDY_OPTIONS)
139+
set(QL_CLANG_TIDY_OPTIONS)
140+
endif()
141+
if (QL_CLANG_TIDY_OPTIONS)
142+
set(CMAKE_CXX_CLANG_TIDY "${QL_CLANG_TIDY};${QL_CLANG_TIDY_OPTIONS}")
143+
else()
144+
set(CMAKE_CXX_CLANG_TIDY "${QL_CLANG_TIDY}")
145+
endif()
146+
endif()
147+
148+
# Project shared libs ON for UNIX
149+
if (NOT DEFINED BUILD_SHARED_LIBS)
150+
set(BUILD_SHARED_LIBS ${UNIX})
151+
endif()
152+
153+
# Boost static libs ON for MSVC
154+
if (NOT DEFINED Boost_USE_STATIC_LIBS)
155+
set(Boost_USE_STATIC_LIBS ${MSVC})
156+
endif()
157+
158+
# Boost static runtime ON for MSVC
159+
if (NOT DEFINED Boost_USE_STATIC_RUNTIME)
160+
set(Boost_USE_STATIC_RUNTIME ${MSVC})
161+
endif()
162+
148163
if (NOT DEFINED QL_BOOST_VERSION)
149164
# Boost 1.75.0 or greater required for compiling with C++20
150165
if (CMAKE_CXX_STANDARD GREATER_EQUAL 20)

LICENSE.TXT

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ QuantLib is
162162
Copyright (C) 2022 Jonghee Lee
163163
Copyright (C) 2022, 2023 Ignacio Anguita
164164

165+
Copyright (C) 2023 Jonathan Sweemer
166+
165167
QuantLib includes code taken from Peter Jäckel's book "Monte Carlo
166168
Methods in Finance".
167169

QuantLib.vcxproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@
517517
<ClInclude Include="ql\cashflows\digitaliborcoupon.hpp" />
518518
<ClInclude Include="ql\cashflows\dividend.hpp" />
519519
<ClInclude Include="ql\cashflows\duration.hpp" />
520+
<ClInclude Include="ql\cashflows\equitycashflow.hpp" />
520521
<ClInclude Include="ql\cashflows\fixedratecoupon.hpp" />
521522
<ClInclude Include="ql\cashflows\floatingratecoupon.hpp" />
522523
<ClInclude Include="ql\cashflows\iborcoupon.hpp" />
@@ -1849,6 +1850,7 @@
18491850
<ClInclude Include="ql\utilities\steppingiterator.hpp" />
18501851
<ClInclude Include="ql\utilities\tracing.hpp" />
18511852
<ClInclude Include="ql\utilities\vectors.hpp" />
1853+
<ClInclude Include="ql\any.hpp" />
18521854
<ClInclude Include="ql\auto_link.hpp" />
18531855
<ClInclude Include="ql\auto_ptr.hpp" />
18541856
<ClInclude Include="ql\cashflow.hpp" />
@@ -1874,6 +1876,7 @@
18741876
<ClInclude Include="ql\money.hpp" />
18751877
<ClInclude Include="ql\numericalmethod.hpp" />
18761878
<ClInclude Include="ql\option.hpp" />
1879+
<ClInclude Include="ql\optional.hpp" />
18771880
<ClInclude Include="ql\payoff.hpp" />
18781881
<ClInclude Include="ql\position.hpp" />
18791882
<ClInclude Include="ql\prices.hpp" />
@@ -1911,6 +1914,7 @@
19111914
<ClCompile Include="ql\cashflows\digitaliborcoupon.cpp" />
19121915
<ClCompile Include="ql\cashflows\dividend.cpp" />
19131916
<ClCompile Include="ql\cashflows\duration.cpp" />
1917+
<ClCompile Include="ql\cashflows\equitycashflow.cpp" />
19141918
<ClCompile Include="ql\cashflows\fixedratecoupon.cpp" />
19151919
<ClCompile Include="ql\cashflows\floatingratecoupon.cpp" />
19161920
<ClCompile Include="ql\cashflows\iborcoupon.cpp" />
@@ -2810,6 +2814,7 @@
28102814
<ClCompile Include="ql\index.cpp" />
28112815
<ClCompile Include="ql\interestrate.cpp" />
28122816
<ClCompile Include="ql\money.cpp" />
2817+
<ClCompile Include="ql\optional.cpp" />
28132818
<ClCompile Include="ql\position.cpp" />
28142819
<ClCompile Include="ql\prices.cpp" />
28152820
<ClCompile Include="ql\rebatedexercise.cpp" />
@@ -2823,4 +2828,4 @@
28232828
<Import Project=".\Build.props" Condition="Exists('.\Build.props')" />
28242829
<ImportGroup Label="ExtensionTargets">
28252830
</ImportGroup>
2826-
</Project>
2831+
</Project>

QuantLib.vcxproj.filters

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3738,6 +3738,7 @@
37383738
<ClCompile Include="ql\pricingengines\barrier\discretizedbarrieroption.cpp">
37393739
<Filter>pricingengines\barrier</Filter>
37403740
</ClCompile>
3741+
<ClInclude Include="ql\any.hpp" />
37413742
<ClInclude Include="ql\auto_link.hpp" />
37423743
<ClInclude Include="ql\auto_ptr.hpp" />
37433744
<ClInclude Include="ql\cashflow.hpp" />
@@ -3764,6 +3765,7 @@
37643765
<ClInclude Include="ql\money.hpp" />
37653766
<ClInclude Include="ql\numericalmethod.hpp" />
37663767
<ClInclude Include="ql\option.hpp" />
3768+
<ClInclude Include="ql\optional.hpp" />
37673769
<ClInclude Include="ql\payoff.hpp" />
37683770
<ClInclude Include="ql\position.hpp" />
37693771
<ClInclude Include="ql\prices.hpp" />
@@ -4439,6 +4441,9 @@
44394441
<ClInclude Include="ql\instruments\equitytotalreturnswap.hpp">
44404442
<Filter>instruments</Filter>
44414443
</ClInclude>
4444+
<ClInclude Include="ql\cashflows\equitycashflow.hpp">
4445+
<Filter>cashflows</Filter>
4446+
</ClInclude>
44424447
</ItemGroup>
44434448
<ItemGroup>
44444449
<ClCompile Include="ql\methods\montecarlo\brownianbridge.cpp">
@@ -6630,6 +6635,7 @@
66306635
<ClCompile Include="ql\index.cpp" />
66316636
<ClCompile Include="ql\interestrate.cpp" />
66326637
<ClCompile Include="ql\money.cpp" />
6638+
<ClCompile Include="ql\optional.cpp" />
66336639
<ClCompile Include="ql\position.cpp" />
66346640
<ClCompile Include="ql\prices.cpp" />
66356641
<ClCompile Include="ql\settings.cpp" />
@@ -7168,5 +7174,8 @@
71687174
<ClCompile Include="ql\instruments\equitytotalreturnswap.cpp">
71697175
<Filter>instruments</Filter>
71707176
</ClCompile>
7177+
<ClCompile Include="ql\cashflows\equitycashflow.cpp">
7178+
<Filter>cashflows</Filter>
7179+
</ClCompile>
71717180
</ItemGroup>
7172-
</Project>
7181+
</Project>

configure.ac

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,37 @@ if test "$ql_use_intraday" = "yes" ; then
331331
fi
332332
AC_MSG_RESULT([$ql_use_intraday])
333333

334+
AC_MSG_CHECKING([whether to enable std::any instead of boost::any])
335+
AC_ARG_ENABLE([std-any],
336+
AS_HELP_STRING([--enable-std-any],
337+
[If enabled, std::any and related classes and
338+
functions will be used instead of boost::any.
339+
This requires C++17. If disabled (the default)
340+
the Boost facilities are used.]),
341+
[ql_use_std_any=$enableval],
342+
[ql_use_std_any=no])
343+
if test "$ql_use_std_any" = "yes" ; then
344+
AC_DEFINE([QL_USE_STD_ANY],[1],
345+
[Define this if you want to use std::any.])
346+
fi
347+
AC_MSG_RESULT([$ql_use_std_any])
348+
349+
AC_MSG_CHECKING([whether to enable std::optional instead of boost::optional])
350+
AC_ARG_ENABLE([std-optional],
351+
AS_HELP_STRING([--enable-std-optional],
352+
[If enabled, std::optional and related
353+
classes and functions will be used instead
354+
of boost::optional. This requires C++17.
355+
If disabled (the default) the Boost facilities
356+
are used.]),
357+
[ql_use_std_optional=$enableval],
358+
[ql_use_std_optional=no])
359+
if test "$ql_use_std_optional" = "yes" ; then
360+
AC_DEFINE([QL_USE_STD_OPTIONAL],[1],
361+
[Define this if you want to use std::optional.])
362+
fi
363+
AC_MSG_RESULT([$ql_use_std_optional])
364+
334365
AC_MSG_CHECKING([whether to enable standard smart pointers])
335366
AC_ARG_ENABLE([std-pointers],
336367
AS_HELP_STRING([--enable-std-pointers],

0 commit comments

Comments
 (0)