Skip to content

Commit e85ec92

Browse files
authored
cppduals: add version 0.9.2 (#860)
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.
1 parent fbe3e8d commit e85ec92

6 files changed

Lines changed: 89 additions & 0 deletions

File tree

‎cmake/configs/default.cmake‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ hunter_default_version(cpp-statsd-client VERSION 1.0.1-42f02b4-p0)
237237
hunter_default_version(cpp_redis VERSION 3.5.0-h1)
238238
hunter_default_version(cppast VERSION 0.0.0-b155d6a-p0)
239239
hunter_default_version(cppcodec VERSION 0.2-p0)
240+
hunter_default_version(cppduals VERSION 0.9.2)
240241
hunter_default_version(cppfs VERSION 1.3.0)
241242
hunter_default_version(cpr VERSION 1.3.0)
242243
hunter_default_version(cpuinfo VERSION 0.0.0-d5e37ad-p0)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (c) 2026, Michael Tesch
2+
# All rights reserved.
3+
4+
# !!! DO NOT PLACE HEADER GUARDS HERE !!!
5+
6+
include(hunter_add_version)
7+
include(hunter_cacheable)
8+
include(hunter_cmake_args)
9+
include(hunter_download)
10+
include(hunter_pick_scheme)
11+
12+
hunter_add_version(
13+
PACKAGE_NAME
14+
cppduals
15+
VERSION
16+
0.9.2
17+
URL
18+
"https://gitlab.com/tesch1/cppduals/-/archive/v0.9.2/cppduals-v0.9.2.tar.gz"
19+
SHA1
20+
1478c1fe45269470182f0222056c27ab0e22dda8
21+
)
22+
23+
hunter_cmake_args(
24+
cppduals
25+
CMAKE_ARGS
26+
CPPDUALS_TESTING=OFF
27+
CPPDUALS_BENCHMARK=OFF
28+
)
29+
30+
hunter_pick_scheme(DEFAULT url_sha1_cmake)
31+
hunter_cacheable(cppduals)
32+
hunter_download(PACKAGE_NAME cppduals)

‎docs/packages/math.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Math
1010
- :ref:`pkg.GSL` - GNU Scientific Library
1111
- :ref:`pkg.HastyNoise` - SIMD open source noise generation library with a large collection of different noise algorithms.
1212
- :ref:`pkg.OpenBLAS` - OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version
13+
- :ref:`pkg.cppduals` - header-only dual number library for exact forward-mode automatic differentiation.
1314
- :ref:`pkg.double-conversion` - provides binary-decimal and decimal-binary routines for IEEE doubles.
1415
- :ref:`pkg.gemmlowp` - Low-precision matrix multiplication.
1516
- :ref:`pkg.glm` - header only C++ mathematics library for graphics software based on the OpenGL Shading Language (GLSL) specifications.

‎docs/packages/pkg/cppduals.rst‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. spelling:word-list::
2+
3+
cppduals
4+
autodiff
5+
6+
.. index:: math ; cppduals
7+
8+
.. _pkg.cppduals:
9+
10+
cppduals
11+
========
12+
13+
- https://gitlab.com/tesch1/cppduals
14+
- `Documentation <https://tesch1.gitlab.io/cppduals/>`__
15+
- Maintainer: https://github.com/tesch1
16+
17+
Header-only dual number library for exact forward-mode automatic
18+
differentiation, with optional Eigen integration.
19+
20+
If you use this in research, please cite
21+
`doi:10.21105/joss.01487 <https://doi.org/10.21105/joss.01487>`__
22+
(Tesch, JOSS 4(43):1487, 2019).
23+
24+
.. literalinclude:: /../examples/cppduals/CMakeLists.txt
25+
:language: cmake
26+
:start-after: # DOCUMENTATION_START {
27+
:end-before: # DOCUMENTATION_END }

‎examples/cppduals/CMakeLists.txt‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2026, Michael Tesch
2+
# All rights reserved.
3+
4+
cmake_minimum_required(VERSION 3.10)
5+
6+
# Emulate HunterGate:
7+
# * https://github.com/hunter-packages/gate
8+
include("../common.cmake")
9+
10+
project(download-cppduals)
11+
12+
# DOCUMENTATION_START {
13+
hunter_add_package(cppduals)
14+
find_package(cppduals CONFIG REQUIRED)
15+
16+
add_executable(foo foo.cpp)
17+
target_link_libraries(foo cppduals::duals)
18+
# DOCUMENTATION_END }
19+
20+
set_target_properties(foo PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED YES)

‎examples/cppduals/foo.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <duals/dual> // duals::dual
2+
#include <iostream> // std::cout
3+
4+
int main() {
5+
using namespace duals::literals;
6+
auto y = (2.0 + 1.0_e) * sin(2.0 + 1.0_e);
7+
std::cout << "f(2) = " << rpart(y) << ", f'(2) = " << dpart(y) << std::endl;
8+
}

0 commit comments

Comments
 (0)