[autodiff] new package for optional dependency of acts (#28028)

This commit is contained in:
Wouter Deconinck 2021-12-17 07:22:46 -06:00 committed by GitHub
parent 23cb7d761e
commit 956bb91cfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 3 deletions

View File

@ -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 @@ def plugin_cmake_variant(plugin_name, spack_variant):
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'):

View File

@ -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