Skip to content

Commit

Permalink
--enable-std-classes now includes any and optional
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Jul 24, 2024
1 parent ba9ffb9 commit 9896e75
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 31 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
mkdir build
cd build
cmake .. -GNinja -DBOOST_ROOT=/usr -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -L
cat ql/config.hpp
cmake --build . --verbose
sudo cmake --install .
sudo ldconfig
Expand Down Expand Up @@ -53,6 +54,7 @@ jobs:
run: |
cmake --preset linux-ci-build-with-nonstandard-options -L
cd build/linux-ci-build-with-nonstandard-options
cat ql/config.hpp
cmake --build . --verbose
sudo cmake --build . --target install
- name: Test
Expand Down Expand Up @@ -93,6 +95,7 @@ jobs:
mkdir build
cd build
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -L
type ql\config.hpp
cmake --build . --verbose
cmake --install .
dir ql\*.lib
Expand Down Expand Up @@ -134,6 +137,7 @@ jobs:
mkdir build
cd build
cmake .. -GNinja -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -L
type ql\config.hpp
cmake --build . --verbose
cmake --install .
dir ql\*.lib
Expand Down Expand Up @@ -174,6 +178,7 @@ jobs:
run: |
cmake --preset windows-ci-build-with-nonstandard-options -L
cd build/windows-ci-build-with-nonstandard-options
type ql\config.hpp
cmake --build . --verbose
cmake --build . --target install
- name: Test
Expand Down Expand Up @@ -201,6 +206,7 @@ jobs:
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -GNinja -L
cat ql/config.hpp
cmake --build . --verbose
sudo cmake --install .
- name: Test
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/linux-full-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ jobs:
cc: gcc
cxx: g++
configureflags: --enable-indexed-coupons
- name: "Standard Library classes enabled/disabled"
- name: "Standard Library classes enabled"
shortname: stdclasses
tag: rolling
cc: gcc
cxx: g++
configureflags: --enable-std-pointers --enable-std-any --enable-std-optional
configureflags: --enable-std-classes
- name: "Thread-safe observer enabled"
shortname: threadsafe
tag: rolling
Expand Down Expand Up @@ -183,6 +183,7 @@ jobs:
run: |
./autogen.sh
./configure --disable-static ${{ matrix.configureflags }} CC="${{ matrix.cc }}" CXX="${{ matrix.cxx }}" CXXFLAGS="-O2 -g0 -Wall -Wno-unknown-pragmas -Werror ${{ matrix.cxxflags }}"
cat ql/config.hpp
make -j 4
- name: Run tests
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/linux-nondefault.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ jobs:
cc: gcc
cxx: g++
configureflags: --enable-unity-build
- name: "Standard Library classes enabled/disabled"
- name: "Standard Library classes enabled"
shortname: stdclasses
tag: rolling
cc: gcc
cxx: g++
configureflags: --enable-std-pointers --enable-std-any --enable-std-optional
configureflags: --enable-std-classes
- name: "OpenMP enabled"
shortname: openmp
tag: rolling
Expand All @@ -136,6 +136,7 @@ jobs:
run: |
./autogen.sh
./configure --disable-static --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="${{ matrix.cc }}" CXX="${{ matrix.cxx }}" CXXFLAGS="-O2 -g0 -Wall -Wno-unknown-pragmas -Wno-array-bounds -Werror ${{ matrix.cxxflags }}"
cat ql/config.hpp
make -j 4
- name: Run tests
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ jobs:
cxx: g++
configureflags: --enable-indexed-coupons
tests: true
- name: "Standard Library classes enabled/disabled"
- name: "Standard Library classes enabled"
shortname: stdclasses
tag: rolling
cc: gcc
cxx: g++
configureflags: --enable-std-pointers --enable-std-any --enable-std-optional
configureflags: --enable-std-classes
tests: true
- name: "Thread-safe observer enabled"
shortname: threadsafe
Expand Down Expand Up @@ -139,6 +139,7 @@ jobs:
run: |
./autogen.sh
./configure --disable-static ${{ matrix.configureflags }} CC="ccache ${{ matrix.cc }}" CXX="ccache ${{ matrix.cxx }}" CXXFLAGS="-O2 -g0 -Wall -Wno-unknown-pragmas -Werror ${{ matrix.cxxflags }}"
cat ql/config.hpp
make -j 4
- name: Run tests
if: ${{ matrix.tests }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/macos-nondefault.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
classes: [boost, std]
include:
- classes: std
configureflags: --enable-std-pointers --enable-std-optional --enable-std-any
configureflags: --enable-std-classes
steps:
- uses: actions/checkout@v4
- name: Setup
Expand All @@ -28,6 +28,7 @@ jobs:
run: |
./autogen.sh
./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"
cat ql/config.hpp
make -j 3
- name: Run tests
run: |
Expand Down
15 changes: 2 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,11 @@ endif()

# Convenience option to activate all STD options
if (QL_USE_STD_CLASSES)
if (CMAKE_CXX_STANDARD GREATER_EQUAL 17)
set(QL_USE_STD_ANY ON)
set(QL_USE_STD_OPTIONAL ON)
endif()
set(QL_USE_STD_ANY ON)
set(QL_USE_STD_OPTIONAL ON)
set(QL_USE_STD_SHARED_PTR ON)
endif()

if (CMAKE_CXX_STANDARD LESS 17)
if (QL_USE_STD_ANY)
message(FATAL_ERROR "QL_USE_STD_ANY requires at least C++17")
endif()
if (QL_USE_STD_OPTIONAL)
message(FATAL_ERROR "QL_USE_STD_OPTIONAL requires at least C++17")
endif()
endif ()

# Set the default warning level we use to pass the GitHub workflows
if (QL_ENABLE_DEFAULT_WARNING_LEVEL)
if (MSVC)
Expand Down
8 changes: 2 additions & 6 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,7 @@
"QL_THROW_IN_CYCLES": "ON",
"QL_NULL_AS_FUNCTIONS": "ON",
"QL_USE_INDEXED_COUPON": "ON",
"QL_USE_STD_SHARED_PTR": "ON",
"QL_USE_STD_ANY": "ON",
"QL_USE_STD_OPTIONAL": "ON",
"QL_USE_STD_CLASSES": "ON",
"QL_COMPILE_WARNING_AS_ERROR": "ON"
}
},
Expand All @@ -323,9 +321,7 @@
"QL_THROW_IN_CYCLES": "ON",
"QL_NULL_AS_FUNCTIONS": "ON",
"QL_USE_INDEXED_COUPON": "ON",
"QL_USE_STD_SHARED_PTR": "ON",
"QL_USE_STD_ANY": "ON",
"QL_USE_STD_OPTIONAL": "ON",
"QL_USE_STD_CLASSES": "ON",
"QL_COMPILE_WARNING_AS_ERROR": "ON",
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache"
}
Expand Down
13 changes: 8 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ AC_ARG_ENABLE([std-any],
AS_HELP_STRING([--enable-std-any],
[If enabled, std::any and related classes and
functions will be used instead of boost::any.
This requires C++17. If disabled (the default)
the Boost facilities are used.]),
If disabled (the default) the Boost facilities
are used.]),
[ql_use_std_any=$enableval],
[ql_use_std_any=no])
if test "$ql_use_std_any" = "yes" ; then
Expand All @@ -403,9 +403,8 @@ AC_ARG_ENABLE([std-optional],
AS_HELP_STRING([--enable-std-optional],
[If enabled, std::optional and related
classes and functions will be used instead
of boost::optional. This requires C++17.
If disabled (the default) the Boost facilities
are used.]),
of boost::optional. If disabled (the default)
the Boost facilities are used.]),
[ql_use_std_optional=$enableval],
[ql_use_std_optional=no])
if test "$ql_use_std_optional" = "yes" ; then
Expand Down Expand Up @@ -442,6 +441,10 @@ AC_ARG_ENABLE([std-classes],
[ql_use_std_classes=$enableval],
[ql_use_std_classes=no])
if test "$ql_use_std_classes" = "yes" ; then
AC_DEFINE([QL_USE_STD_ANY],[1],
[Define this if you want to use std::any.])
AC_DEFINE([QL_USE_STD_OPTIONAL],[1],
[Define this if you want to use std::optional.])
AC_DEFINE([QL_USE_STD_SHARED_PTR],[1],
[Define this if you want to use standard smart pointers.])
fi
Expand Down

0 comments on commit 9896e75

Please sign in to comment.