mdspan: new package (#40024)

* new package mdspan

* Update var/spack/repos/builtin/packages/mdspan/package.py

Co-authored-by: Alec Scott <alec@bcs.sh>

* mdspan- fix style

---------

Co-authored-by: Alec Scott <alec@bcs.sh>
This commit is contained in:
Andrew-Dunning-NNL 2023-09-18 20:44:17 -04:00 committed by GitHub
parent dbd520f851
commit 7e7d373ab3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,44 @@
# Copyright 2013-2022 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.package import *
class Mdspan(CMakePackage):
"""Extension of std::span to enable multidimensional arrays"""
homepage = "https://github.com/kokkos/mdspan/tree/stable"
url = "https://github.com/kokkos/mdspan/archive/refs/tags/mdspan-0.6.0.zip"
git = "https://github.com/kokkos/mdspan.git"
version("stable", branch="stable")
version("0.6.0", sha256="d6b7b9d4f472106df1d28729bd8383a8a7ea7938adf9f82d3be9c151344830d9")
variant("examples", default=True, description="Enable examples")
variant("tests", default=False, description="Enable tests")
variant("benchmarks", default=False, description="Enable benchmarks")
depends_on("benchmark", when="+benchmarks")
depends_on("googletest@main", when="+tests")
def cmake_args(self):
args = []
if self.spec.satisfies("+tests"):
args.append("-DMDSPAN_ENABLE_TESTS=ON")
args.append("-DMDSPAN_USE_SYSTEM_GTEST=ON")
if self.spec.satisfies("+bencmarks"):
args.append("-DMDSPAN_ENABLE_BENCHMARKS=ON")
if self.spec.satisfies("+examples"):
args.append("-DMDSPAN_ENABLE_EXAMPLES=ON")
args.append("-DCMAKE_CXX_FLAGS='-Wall -Wextra -pedantic'")
args.append("-DCMAKE_CXX_STANDARD=17")
args.append("-DMDSPAN_CXX_STANDARD=17")
args.append("-DCMAKE_CXX_COMPILER=g++")
args.append("-DCMAKE_CXX_EXTENSIONS=OFF")
return args