Skip to content

Commit

Permalink
Merge pull request #369 from bluescarni/pr/cpp20
Browse files Browse the repository at this point in the history
C++20
  • Loading branch information
bluescarni authored Dec 7, 2023
2 parents 52cc140 + e577f91 commit 793d3a2
Show file tree
Hide file tree
Showing 78 changed files with 2,099 additions and 1,148 deletions.
2 changes: 1 addition & 1 deletion .clangd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CompileFlags:
Add: '-std=c++17'
Add: '-std=c++20'
46 changes: 6 additions & 40 deletions .github/workflows/gha_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,8 @@ jobs:
- uses: actions/checkout@v3
- name: Build
run: bash tools/gha_osx_static.sh
windows_2019_llvm12:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: "3.10"
channels: conda-forge
channel-priority: strict
- name: Build
shell: pwsh
run: |
conda install -y cmake 'llvmdev=12.*' tbb-devel tbb boost-cpp xtensor xtensor-blas blas blas-devel fmt spdlog sleef zlib libzlib 'mppp>=0.27'
mkdir build
cd build
cmake ../ -G "Visual Studio 16 2019" -A x64 -DHEYOKA_BUILD_TESTS=yes -DHEYOKA_WITH_MPPP=yes -DHEYOKA_BUILD_TUTORIALS=ON -DHEYOKA_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON -DHEYOKA_WITH_SLEEF=yes -DMPPP_GMP_INCLUDE_DIR=C:\Miniconda\envs\test\Library\include -DMPPP_GMP_LIBRARY=C:\Miniconda\envs\test\Library\lib\mpir.lib
cmake --build . --config Release -j2
copy Release\heyoka.dll test\Release\
ctest -j4 -V -C Release
windows_2019_llvm13:
runs-on: windows-2019
windows_2022_llvm13:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: Add msbuild to PATH
Expand All @@ -59,12 +37,12 @@ jobs:
conda install -y cmake 'llvmdev=13.*' tbb-devel tbb boost-cpp xtensor xtensor-blas blas blas-devel fmt spdlog sleef zlib libzlib 'mppp>=0.27'
mkdir build
cd build
cmake ../ -G "Visual Studio 16 2019" -A x64 -DHEYOKA_BUILD_TESTS=yes -DHEYOKA_WITH_MPPP=yes -DHEYOKA_BUILD_TUTORIALS=ON -DHEYOKA_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON -DHEYOKA_WITH_SLEEF=yes -DMPPP_GMP_INCLUDE_DIR=C:\Miniconda\envs\test\Library\include -DMPPP_GMP_LIBRARY=C:\Miniconda\envs\test\Library\lib\mpir.lib
cmake ../ -G "Visual Studio 17 2022" -A x64 -DHEYOKA_BUILD_TESTS=yes -DHEYOKA_WITH_MPPP=yes -DHEYOKA_BUILD_TUTORIALS=ON -DHEYOKA_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON -DHEYOKA_WITH_SLEEF=yes -DMPPP_GMP_INCLUDE_DIR=C:\Miniconda\envs\test\Library\include -DMPPP_GMP_LIBRARY=C:\Miniconda\envs\test\Library\lib\mpir.lib
cmake --build . --config Release -j2
copy Release\heyoka.dll test\Release\
ctest -j4 -V -C Release
windows_2019_llvm14:
runs-on: windows-2019
windows_2022_llvm14:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: Add msbuild to PATH
Expand All @@ -81,7 +59,7 @@ jobs:
conda install -y cmake 'llvmdev=14.*' tbb-devel tbb boost-cpp xtensor xtensor-blas blas blas-devel fmt spdlog sleef zlib libzlib 'mppp>=0.27'
mkdir build
cd build
cmake ../ -G "Visual Studio 16 2019" -A x64 -DHEYOKA_BUILD_TESTS=yes -DHEYOKA_WITH_MPPP=yes -DHEYOKA_BUILD_TUTORIALS=ON -DHEYOKA_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON -DHEYOKA_WITH_SLEEF=yes -DMPPP_GMP_INCLUDE_DIR=C:\Miniconda\envs\test\Library\include -DMPPP_GMP_LIBRARY=C:\Miniconda\envs\test\Library\lib\mpir.lib
cmake ../ -G "Visual Studio 17 2022" -A x64 -DHEYOKA_BUILD_TESTS=yes -DHEYOKA_WITH_MPPP=yes -DHEYOKA_BUILD_TUTORIALS=ON -DHEYOKA_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON -DHEYOKA_WITH_SLEEF=yes -DMPPP_GMP_INCLUDE_DIR=C:\Miniconda\envs\test\Library\include -DMPPP_GMP_LIBRARY=C:\Miniconda\envs\test\Library\lib\mpir.lib
cmake --build . --config Release -j2
copy Release\heyoka.dll test\Release\
ctest -j4 -V -C Release
Expand Down Expand Up @@ -138,15 +116,3 @@ jobs:
- uses: actions/checkout@v3
- name: Build
run: bash tools/gha_llvm13_conda_asan.sh
conda_llvm12_asan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: bash tools/gha_llvm12_conda_asan.sh
conda_llvm11_asan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: bash tools/gha_llvm11_conda_asan.sh
34 changes: 17 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()

project(heyoka VERSION 3.2.0 LANGUAGES CXX C)
project(heyoka VERSION 4.0.0 LANGUAGES CXX C)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/yacma")

Expand Down Expand Up @@ -158,14 +158,10 @@ endif()
include(GNUInstallDirs)
find_package(LLVM REQUIRED CONFIG)

if(${LLVM_VERSION_MAJOR} LESS 11)
message(FATAL_ERROR "LLVM >= 11 is required.")
if(${LLVM_VERSION_MAJOR} LESS 13 OR ${LLVM_VERSION_MAJOR} GREATER 17)
message(FATAL_ERROR "LLVM >= 13 and <= 17 is required.")
endif()

# Mandatory dependency on fmt.
find_package(fmt REQUIRED CONFIG)
message(STATUS "fmt version: ${fmt_VERSION}")

# List of source files.
set(HEYOKA_SRC_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/src/taylor_00.cpp"
Expand Down Expand Up @@ -313,7 +309,7 @@ if(HEYOKA_WITH_SLEEF)
endif()

# Setup the heyoka ABI version number.
set(HEYOKA_ABI_VERSION 26)
set(HEYOKA_ABI_VERSION 27)

if(HEYOKA_BUILD_STATIC_LIBRARY)
# Setup of the heyoka static library.
Expand All @@ -336,8 +332,8 @@ target_compile_options(heyoka PRIVATE
"$<$<CONFIG:MinSizeRel>:${HEYOKA_CXX_FLAGS_RELEASE}>"
)

# Ensure that C++17 is employed when both compiling and consuming heyoka.
target_compile_features(heyoka PUBLIC cxx_std_17)
# Ensure that C++20 is employed when both compiling and consuming heyoka.
target_compile_features(heyoka PUBLIC cxx_std_20)
# Enforce vanilla C++17 when compiling heyoka.
set_property(TARGET heyoka PROPERTY CXX_EXTENSIONS NO)

Expand Down Expand Up @@ -461,6 +457,12 @@ if(_HEYOKA_LLVM_STATIC_LINK AND HEYOKA_HIDE_LLVM_SYMBOLS)
endif()

# Mandatory dependency on fmt.
set(_HEYOKA_SUPPORTED_FMT_VERSIONS 9 10)
find_package(fmt REQUIRED CONFIG)
if(NOT ${fmt_VERSION_MAJOR} IN_LIST _HEYOKA_SUPPORTED_FMT_VERSIONS)
message(FATAL_ERROR "The supported fmt versions are (${_HEYOKA_SUPPORTED_FMT_VERSIONS}), but version ${fmt_VERSION_MAJOR} was found instead.")
endif()
message(STATUS "fmt version: ${fmt_VERSION}")
target_link_libraries(heyoka PUBLIC fmt::fmt)

# Mandatory dependency on spdlog.
Expand Down Expand Up @@ -493,13 +495,10 @@ if(APPLE AND Boost_VERSION VERSION_LESS "1.81.0")
endif()

# Optional dependency on mp++.
# NOTE: put this into a separate variable for reuse later.
set(_HEYOKA_MIN_MPPP_VERSION "0.27")
set(_HEYOKA_MPPP_VERSION "1.0.0")
if(HEYOKA_WITH_MPPP)
find_package(mp++ REQUIRED CONFIG)
if(${mp++_VERSION} VERSION_LESS ${_HEYOKA_MIN_MPPP_VERSION})
message(FATAL_ERROR "mp++ >= ${_HEYOKA_MIN_MPPP_VERSION} is required, but version ${mp++_VERSION} was found instead.")
endif()
find_package(mp++ ${_HEYOKA_MPPP_VERSION} REQUIRED CONFIG)
message(STATUS "mp++ version: ${mp++_VERSION}")

# NOTE: this is necessary for the serialisation of several classes.
if(NOT mp++_WITH_BOOST_S11N)
Expand Down Expand Up @@ -562,10 +561,11 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/heyoka-config-version.cmake" DESTINAT

# Cleanup.
unset(_HEYOKA_MIN_BOOST_VERSION)
unset(_HEYOKA_MIN_MPPP_VERSION)
unset(_HEYOKA_MPPP_VERSION)
unset(_HEYOKA_WITH_REAL128)
unset(_HEYOKA_WITH_REAL)
unset(_HEYOKA_LLVM_STATIC_LINK)
unset(_HEYOKA_SUPPORTED_FMT_VERSIONS)

if(HEYOKA_BUILD_TESTS)
enable_testing()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ heyoka
[![Build Status](https://img.shields.io/circleci/project/github/bluescarni/heyoka/master.svg?style=for-the-badge)](https://circleci.com/gh/bluescarni/heyoka)
[![Build Status](https://img.shields.io/github/actions/workflow/status/bluescarni/heyoka/gha_ci.yml?branch=master&style=for-the-badge)](https://github.com/bluescarni/heyoka/actions?query=workflow%3A%22GitHub+CI%22)
<!-- [![Build Status](https://img.shields.io/travis/com/bluescarni/heyoka?style=for-the-badge)](https://travis-ci.com/bluescarni/heyoka) -->
![language](https://img.shields.io/badge/language-C%2B%2B17-red.svg?style=for-the-badge)
![language](https://img.shields.io/badge/language-C%2B%2B20-green.svg?style=for-the-badge)
[![Code Coverage](https://img.shields.io/codecov/c/github/bluescarni/heyoka.svg?style=for-the-badge)](https://codecov.io/github/bluescarni/heyoka?branch=master)

[![Anaconda-Server Badge](https://img.shields.io/conda/vn/conda-forge/heyoka.svg?style=for-the-badge)](https://anaconda.org/conda-forge/heyoka)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function(ADD_HEYOKA_BENCHMARK arg1)
"$<$<CONFIG:MinSizeRel>:${HEYOKA_CXX_FLAGS_RELEASE}>"
)
# Setup the C++ standard.
target_compile_features(${arg1} PRIVATE cxx_std_17)
target_compile_features(${arg1} PRIVATE cxx_std_20)
set_property(TARGET ${arg1} PROPERTY CXX_EXTENSIONS NO)
endfunction()

Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ coverage:
- "tutorial/.*"
- "src/detail/vsop2013/.*"
- "src/detail/elp2000/.*"
- "include/heyoka/detail/tanuki*"

comment: off
15 changes: 15 additions & 0 deletions doc/breaking_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
Breaking changes
================

.. _bchanges_4_0_0:

4.0.0
-----

heyoka 4 includes several backwards-incompatible changes.

General
~~~~~~~

- heyoka now requires LLVM>=13.
- heyoka is now a C++20 project.
- heyoka now requires fmt>=9.
- heyoka now requires mp++ 1.x.

.. _bchanges_2_0_0:

2.0.0
Expand Down
19 changes: 19 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
Changelog
=========

4.0.0 (unreleased)
------------------

Changes
~~~~~~~

- **BREAKING**: the minimum supported LLVM version is now 13
(`#369 <https://github.com/bluescarni/heyoka/pull/369>`__).
This is a :ref:`breaking change <bchanges_4_0_0>`.
- **BREAKING**: heyoka now requires C++20
(`#369 <https://github.com/bluescarni/heyoka/pull/369>`__).
This is a :ref:`breaking change <bchanges_4_0_0>`.
- **BREAKING**: heyoka now requires fmt>=9
(`#369 <https://github.com/bluescarni/heyoka/pull/369>`__).
This is a :ref:`breaking change <bchanges_4_0_0>`.
- **BREAKING**: heyoka now requires mp++ 1.x
(`#369 <https://github.com/bluescarni/heyoka/pull/369>`__).
This is a :ref:`breaking change <bchanges_4_0_0>`.

3.2.0 (2023-11-29)
------------------

Expand Down
29 changes: 9 additions & 20 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,16 @@ Introduction
------------

heyoka is written in modern C++, and it requires a compiler able to understand
at least C++17. The library is regularly tested on
a continuous integration pipeline which currently includes:

* GCC 9 on Linux,
* Clang 11 on OSX,
* MSVC 2019 and Clang 12 on Windows.

.. note::

When using MSVC, heyoka currently requires MSVC>=2019. It is also possible
to compile heyoka using the standard library from MSVC 2017 in conjunction
with the ``clang-cl`` compiler.

The tested and supported CPU architectures at this time are x86-64,
64-bit ARM and 64-bit PowerPC.
at least C++20. The library is regularly tested on
a continuous integration pipeline which currently includes several
compilers (GCC, Clang, MSVC) on several operating systems (Linux, OSX, Windows)
and several CPU architectures (x86-64, 64-bit ARM and 64-bit PowerPC).

heyoka has the following **mandatory** dependencies:

* the `LLVM <https://llvm.org/>`__ compiler infrastructure library (version >= 11),
* the `LLVM <https://llvm.org/>`__ compiler infrastructure library (version >= 13 and <=17),
* the `Boost <https://www.boost.org/>`__ C++ libraries (version >= 1.69),
* the `{fmt} <https://fmt.dev/latest/index.html>`__ library,
* the `{fmt} <https://fmt.dev/latest/index.html>`__ library (version 9 or 10),
* the `spdlog <https://github.com/gabime/spdlog>`__ library,
* the `TBB <https://github.com/oneapi-src/oneTBB>`__ library.

Expand All @@ -40,7 +29,7 @@ Additionally, heyoka has the following **optional** dependencies:
an mp++ installation with support for Boost.serialization and for the
{fmt} library
(see the :ref:`mp++ installation instructions <mppp:installation>`).
The minimum required version of mp++ is 0.27;
heyoka currently requires mp++ 1.x;
* the `SLEEF <https://sleef.org/>`__ vectorized math library (improves the performance
of integrations in batch mode),
* the `xtensor and xtensor-blas <https://xtensor.readthedocs.io/en/latest/>`__
Expand Down Expand Up @@ -287,5 +276,5 @@ dependencies heyoka was compiled:
heyoka's config-file package also exports a
``heyoka_LLVM_VERSION_MAJOR`` variable containing
the major number of the LLVM version against which heyoka
was compiled. E.g., if heyoka was compiled against LLVM 12.0.1,
then ``heyoka_LLVM_VERSION_MAJOR`` is ``12``.
was compiled. E.g., if heyoka was compiled against LLVM 13.0.1,
then ``heyoka_LLVM_VERSION_MAJOR`` is ``13``.
16 changes: 13 additions & 3 deletions heyoka-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@ set(heyoka_ABI_VERSION @HEYOKA_ABI_VERSION@)
# Mandatory public dependencies on Boost and fmt.
find_package(Boost @_HEYOKA_MIN_BOOST_VERSION@ REQUIRED serialization)
find_package(fmt REQUIRED CONFIG)
if(NOT ${fmt_VERSION_MAJOR} IN_LIST "@_HEYOKA_SUPPORTED_FMT_VERSIONS@")
message(FATAL_ERROR "The supported fmt versions are (@_HEYOKA_SUPPORTED_FMT_VERSIONS@), but version ${fmt_VERSION_MAJOR} was found instead.")
endif()

# Optional public dependency on mp++.
if(${heyoka_WITH_MPPP})
find_package(mp++ REQUIRED CONFIG)
if(${mp++_VERSION} VERSION_LESS @_HEYOKA_MIN_MPPP_VERSION@)
message(FATAL_ERROR "mp++ >= @_HEYOKA_MIN_MPPP_VERSION@ is required.")
find_package(mp++ @_HEYOKA_MPPP_VERSION@ REQUIRED CONFIG)

# NOTE: this is necessary for the serialisation of several classes.
if(NOT mp++_WITH_BOOST_S11N)
message(FATAL_ERROR "mp++ must be installed with support for Boost.serialization.")
endif()

# NOTE: needed for formatting numbers.
if(NOT mp++_WITH_FMT)
message(FATAL_ERROR "mp++ must be installed with support for fmt.")
endif()
endif()

Expand Down
Loading

0 comments on commit 793d3a2

Please sign in to comment.