
This enforces conventions that allow for correct handling of multi-valued variants where specifying no value is an option, and adds convenience functionality for specifying multi-valued variants with conflicting sets of values. This also adds a notion of "feature values" for variants, which are those that are understood by the build system (e.g. those that would appear as configure options). In more detail: * Add documentation on variants to the packaging guide * Forbid usage of '' or None as a possible variant value, in particular as a default. To indicate choosing no value, the user must explicitly define an option like 'none'. Without this, multi-valued variants with default set to None were not parsable from the command line (Fixes #6314) * Add "disjoint_sets" function to support the declaration of multi-valued variants with conflicting sets of options. For example a variant "foo" with possible values "a", "b", and "c" where "c" is exclusive of the other values ("foo=a,b" and "foo=c" are valid but "foo=a,c" is not). * Add "any_combination_of" function to support the declaration of multi-valued variants where it is valid to choose none of the values. This automatically defines "none" as an option (exclusive with all other choices); this value does not appear when iterating over the variant's values, for example in "with_or_without" (which constructs autotools option strings from variant values). * The "disjoint_sets" and "any_combination_of" methods return an object which tracks the possible values. It is also possible to indicate that some of these values do not correspond to options understood by the package's build system, such that methods like "with_or_without" will not define options for those values (this occurs automatically for "none") * Add documentation for usage of new functions for specifying multi-valued variants
57 lines
1.9 KiB
Python
57 lines
1.9 KiB
Python
# Copyright 2013-2019 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 *
|
|
from spack.error import SpackError
|
|
|
|
|
|
def async_api_validator(pkg_name, variant_name, values):
|
|
if 'none' in values and len(values) != 1:
|
|
raise SpackError("The value 'none' is not usable"
|
|
" with other async_api values.")
|
|
if 'ibm_bbapi' in values and 'cray_dw' in values:
|
|
raise SpackError("The 'ibm_bbapi' and 'cray_dw' asynchronous"
|
|
" APIs are incompatible.")
|
|
|
|
|
|
class Axl(CMakePackage):
|
|
"""Asynchronous transfer library"""
|
|
|
|
homepage = "https://github.com/ECP-VeloC/AXL"
|
|
url = "https://github.com/ECP-VeloC/AXL/archive/v0.1.0.zip"
|
|
git = "https://github.com/ecp-veloc/axl.git"
|
|
|
|
tags = ['ecp']
|
|
|
|
version('master', branch='master')
|
|
version('0.1.1', sha256='ebbf231bb542a6c91efb79fce05d4c8a346d5506d88ae1899fb670be52e81933')
|
|
|
|
variant('async_api', default='daemon',
|
|
description="Set of async transfer APIs to enable",
|
|
values=['cray_dw', 'ibm_bbapi', 'daemon', 'none'], multi=True,
|
|
validator=async_api_validator)
|
|
|
|
# not-yet implemented functionality
|
|
conflicts('async_api=cray_dw', when='@0.1.0')
|
|
conflicts('async_api=ibm_bbapi', when='@0.1.0')
|
|
|
|
depends_on('kvtree')
|
|
|
|
def cmake_args(self):
|
|
args = []
|
|
if self.spec.satisfies('platform=cray'):
|
|
args.append("-DAXL_LINK_STATIC=ON")
|
|
args.append("-DWITH_KVTREE_PREFIX=%s" % self.spec['kvtree'].prefix)
|
|
|
|
apis = list(self.spec.variants['async_api'].value)
|
|
if 'daemon' in apis:
|
|
args.append('-DAXL_ASYNC_DAEMON=ON')
|
|
apis.remove('daemon')
|
|
|
|
for api in apis:
|
|
args.append('-DAXL_ASYNC_API={0}'.format(api))
|
|
|
|
return args
|