From cdc010416006c3e3e89016c82c1acaa89621f343 Mon Sep 17 00:00:00 2001 From: michael tesch Date: Thu, 20 Aug 2026 23:21:33 -0500 Subject: [PATCH 1/2] cppduals: add version 0.9.1 --- cmake/configs/default.cmake | 1 + cmake/projects/cppduals/hunter.cmake | 32 ++++++++++++++++++++++++++++ docs/packages/math.rst | 1 + docs/packages/pkg/cppduals.rst | 27 +++++++++++++++++++++++ examples/cppduals/CMakeLists.txt | 20 +++++++++++++++++ examples/cppduals/foo.cpp | 8 +++++++ 6 files changed, 89 insertions(+) create mode 100644 cmake/projects/cppduals/hunter.cmake create mode 100644 docs/packages/pkg/cppduals.rst create mode 100644 examples/cppduals/CMakeLists.txt create mode 100644 examples/cppduals/foo.cpp diff --git a/cmake/configs/default.cmake b/cmake/configs/default.cmake index 4f516cb36b..f7ea23d6c0 100644 --- a/cmake/configs/default.cmake +++ b/cmake/configs/default.cmake @@ -237,6 +237,7 @@ hunter_default_version(cpp-statsd-client VERSION 1.0.1-42f02b4-p0) hunter_default_version(cpp_redis VERSION 3.5.0-h1) hunter_default_version(cppast VERSION 0.0.0-b155d6a-p0) hunter_default_version(cppcodec VERSION 0.2-p0) +hunter_default_version(cppduals VERSION 0.9.1) hunter_default_version(cppfs VERSION 1.3.0) hunter_default_version(cpr VERSION 1.3.0) hunter_default_version(cpuinfo VERSION 0.0.0-d5e37ad-p0) diff --git a/cmake/projects/cppduals/hunter.cmake b/cmake/projects/cppduals/hunter.cmake new file mode 100644 index 0000000000..ecef361ce6 --- /dev/null +++ b/cmake/projects/cppduals/hunter.cmake @@ -0,0 +1,32 @@ +# Copyright (c) 2026, Michael Tesch +# All rights reserved. + +# !!! DO NOT PLACE HEADER GUARDS HERE !!! + +include(hunter_add_version) +include(hunter_cacheable) +include(hunter_cmake_args) +include(hunter_download) +include(hunter_pick_scheme) + +hunter_add_version( + PACKAGE_NAME + cppduals + VERSION + 0.9.1 + URL + "https://gitlab.com/tesch1/cppduals/-/archive/v0.9.1/cppduals-v0.9.1.tar.gz" + SHA1 + e9cab4fbcfab1da73ed95871bc11c30e32c5d9c4 +) + +hunter_cmake_args( + cppduals + CMAKE_ARGS + CPPDUALS_TESTING=OFF + CPPDUALS_BENCHMARK=OFF +) + +hunter_pick_scheme(DEFAULT url_sha1_cmake) +hunter_cacheable(cppduals) +hunter_download(PACKAGE_NAME cppduals) diff --git a/docs/packages/math.rst b/docs/packages/math.rst index 9fb93fbff2..c4321bd6a1 100644 --- a/docs/packages/math.rst +++ b/docs/packages/math.rst @@ -10,6 +10,7 @@ Math - :ref:`pkg.GSL` - GNU Scientific Library - :ref:`pkg.HastyNoise` - SIMD open source noise generation library with a large collection of different noise algorithms. - :ref:`pkg.OpenBLAS` - OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version + - :ref:`pkg.cppduals` - header-only dual number library for exact forward-mode automatic differentiation. - :ref:`pkg.double-conversion` - provides binary-decimal and decimal-binary routines for IEEE doubles. - :ref:`pkg.gemmlowp` - Low-precision matrix multiplication. - :ref:`pkg.glm` - header only C++ mathematics library for graphics software based on the OpenGL Shading Language (GLSL) specifications. diff --git a/docs/packages/pkg/cppduals.rst b/docs/packages/pkg/cppduals.rst new file mode 100644 index 0000000000..2a03288c98 --- /dev/null +++ b/docs/packages/pkg/cppduals.rst @@ -0,0 +1,27 @@ +.. spelling:word-list:: + + cppduals + autodiff + +.. index:: math ; cppduals + +.. _pkg.cppduals: + +cppduals +======== + +- https://gitlab.com/tesch1/cppduals +- `Documentation `__ +- Maintainer: https://github.com/tesch1 + +Header-only dual number library for exact forward-mode automatic +differentiation, with optional Eigen integration. + +If you use this in research, please cite +`doi:10.21105/joss.01487 `__ +(Tesch, JOSS 4(43):1487, 2019). + +.. literalinclude:: /../examples/cppduals/CMakeLists.txt + :language: cmake + :start-after: # DOCUMENTATION_START { + :end-before: # DOCUMENTATION_END } diff --git a/examples/cppduals/CMakeLists.txt b/examples/cppduals/CMakeLists.txt new file mode 100644 index 0000000000..e22b414afc --- /dev/null +++ b/examples/cppduals/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright (c) 2026, Michael Tesch +# All rights reserved. + +cmake_minimum_required(VERSION 3.10) + +# Emulate HunterGate: +# * https://github.com/hunter-packages/gate +include("../common.cmake") + +project(download-cppduals) + +# DOCUMENTATION_START { +hunter_add_package(cppduals) +find_package(cppduals CONFIG REQUIRED) + +add_executable(foo foo.cpp) +target_link_libraries(foo cppduals::duals) +# DOCUMENTATION_END } + +set_target_properties(foo PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED YES) diff --git a/examples/cppduals/foo.cpp b/examples/cppduals/foo.cpp new file mode 100644 index 0000000000..d0710ed17e --- /dev/null +++ b/examples/cppduals/foo.cpp @@ -0,0 +1,8 @@ +#include // duals::dual +#include // std::cout + +int main() { + using namespace duals::literals; + auto y = (2.0 + 1.0_e) * sin(2.0 + 1.0_e); + std::cout << "f(2) = " << rpart(y) << ", f'(2) = " << dpart(y) << std::endl; +} From 126fef063019bca42acbf9547038ab3e6b856a38 Mon Sep 17 00:00:00 2001 From: michael tesch Date: Thu, 20 Aug 2026 23:47:17 -0500 Subject: [PATCH 2/2] cppduals: use version 0.9.2 0.9.1 does not configure under a toolchain that sets CMAKE_CXX_STANDARD as a normal variable; 0.9.2 fixes that. --- cmake/configs/default.cmake | 2 +- cmake/projects/cppduals/hunter.cmake | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/configs/default.cmake b/cmake/configs/default.cmake index f7ea23d6c0..d4e6e5ff86 100644 --- a/cmake/configs/default.cmake +++ b/cmake/configs/default.cmake @@ -237,7 +237,7 @@ hunter_default_version(cpp-statsd-client VERSION 1.0.1-42f02b4-p0) hunter_default_version(cpp_redis VERSION 3.5.0-h1) hunter_default_version(cppast VERSION 0.0.0-b155d6a-p0) hunter_default_version(cppcodec VERSION 0.2-p0) -hunter_default_version(cppduals VERSION 0.9.1) +hunter_default_version(cppduals VERSION 0.9.2) hunter_default_version(cppfs VERSION 1.3.0) hunter_default_version(cpr VERSION 1.3.0) hunter_default_version(cpuinfo VERSION 0.0.0-d5e37ad-p0) diff --git a/cmake/projects/cppduals/hunter.cmake b/cmake/projects/cppduals/hunter.cmake index ecef361ce6..fa22f330cb 100644 --- a/cmake/projects/cppduals/hunter.cmake +++ b/cmake/projects/cppduals/hunter.cmake @@ -13,11 +13,11 @@ hunter_add_version( PACKAGE_NAME cppduals VERSION - 0.9.1 + 0.9.2 URL - "https://gitlab.com/tesch1/cppduals/-/archive/v0.9.1/cppduals-v0.9.1.tar.gz" + "https://gitlab.com/tesch1/cppduals/-/archive/v0.9.2/cppduals-v0.9.2.tar.gz" SHA1 - e9cab4fbcfab1da73ed95871bc11c30e32c5d9c4 + 1478c1fe45269470182f0222056c27ab0e22dda8 ) hunter_cmake_args(