summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWouter Deconinck <wdconinc@gmail.com>2021-12-17 07:22:46 -0600
committerGitHub <noreply@github.com>2021-12-17 14:22:46 +0100
commit956bb91cfe8eaca0205dd016e1753bdf5d59a72c (patch)
tree8e5a444184471026de7edf8a163627352d2114fb
parent23cb7d761e208843737769e7ff6326499beb86d0 (diff)
downloadspack-956bb91cfe8eaca0205dd016e1753bdf5d59a72c.tar.gz
spack-956bb91cfe8eaca0205dd016e1753bdf5d59a72c.tar.bz2
spack-956bb91cfe8eaca0205dd016e1753bdf5d59a72c.tar.xz
spack-956bb91cfe8eaca0205dd016e1753bdf5d59a72c.zip
[autodiff] new package for optional dependency of acts (#28028)
-rw-r--r--var/spack/repos/builtin/packages/acts/package.py7
-rw-r--r--var/spack/repos/builtin/packages/autodiff/package.py35
2 files changed, 39 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/acts/package.py b/var/spack/repos/builtin/packages/acts/package.py
index 81c931db9f..8186fae3ad 100644
--- a/var/spack/repos/builtin/packages/acts/package.py
+++ b/var/spack/repos/builtin/packages/acts/package.py
@@ -139,9 +139,9 @@ class Acts(CMakePackage, CudaPackage):
variant('analysis', default=False, description='Build analysis applications in the examples')
# Build dependencies
- # FIXME: Use spack's autodiff package once there is one
# FIXME: Use spack's vecmem package once there is one
# (https://github.com/acts-project/acts/pull/998)
+ depends_on('autodiff @0.5.11:', when='@1.2: +autodiff')
depends_on('boost @1.62:1.69 +program_options +test', when='@:0.10.3')
depends_on('boost @1.71: +filesystem +program_options +test', when='@0.10.4:')
depends_on('cmake @3.14:', type='build')
@@ -228,8 +228,9 @@ class Acts(CMakePackage, CudaPackage):
cxxstd = spec['root'].variants['cxxstd'].value
args.append("-DCMAKE_CXX_STANDARD={0}".format(cxxstd))
- # FIXME: Once we can use spack's autodiff package, set
- # ACTS_USE_SYSTEM_AUTODIFF too.
+ if spec.satisfies('+autodiff'):
+ args.append("-DACTS_USE_SYSTEM_AUTODIFF=ON")
+
if spec.satisfies('@0.33: +json'):
args.append("-DACTS_USE_SYSTEM_NLOHMANN_JSON=ON")
elif spec.satisfies('@0.14.0: +json'):
diff --git a/var/spack/repos/builtin/packages/autodiff/package.py b/var/spack/repos/builtin/packages/autodiff/package.py
new file mode 100644
index 0000000000..013b011f85
--- /dev/null
+++ b/var/spack/repos/builtin/packages/autodiff/package.py
@@ -0,0 +1,35 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class Autodiff(CMakePackage):
+ """autodiff is automatic differentiation made easier for C++."""
+
+ homepage = "https://autodiff.github.io"
+ url = "https://github.com/autodiff/autodiff/archive/refs/tags/v0.6.4.tar.gz"
+ list_url = "https://github.com/autodiff/autodiff/releases"
+ git = "https://github.com/autodiff/autodiff.git"
+
+ maintainers = ['wdconinc', 'HadrienG2']
+
+ version('0.6.4', sha256='cfe0bb7c0de10979caff9d9bfdad7e6267faea2b8d875027397486b47a7edd75')
+ version('0.5.13', sha256='a73dc571bcaad6b44f74865fed51af375f5a877db44321b5568d94a4358b77a1')
+
+ variant('python', default='False', description='Enable the compilation of the python bindings.')
+ variant('examples', default='False', description='Enable the compilation of the example files.')
+
+ depends_on('cmake@3.0:', type='build')
+ depends_on('eigen')
+ depends_on('py-pybind11', type=('build', 'run'))
+
+ def cmake_args(self):
+ args = [
+ self.define('AUTODIFF_BUILD_TESTS', self.run_tests),
+ self.define_from_variant('AUTODIFF_BUILD_PYTHON', 'python'),
+ self.define_from_variant('AUTODIFF_BUILD_EXAMPLES', 'examples',)
+ ]
+ return args