dftd4, mctc-lib: enable cmake builds and add multicharge package (#48594)

* enable cmake builds

* [@spackbot] updating style on behalf of RMeli

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

Co-authored-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>

* Update var/spack/repos/builtin/packages/mctc-lib/package.py

* include

* fix

* use sha256

* update

---------

Co-authored-by: RMeli <RMeli@users.noreply.github.com>
Co-authored-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>
This commit is contained in:
Rocco Meli 2025-01-28 09:53:22 +01:00 committed by GitHub
parent c054cb818d
commit 56495a8cd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 97 additions and 16 deletions

View File

@ -2,10 +2,11 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.build_systems import cmake, meson
from spack.package import *
class Dftd4(MesonPackage):
class Dftd4(MesonPackage, CMakePackage):
"""Generally Applicable Atomic-Charge Dependent London Dispersion Correction"""
homepage = "https://www.chemie.uni-bonn.de/pctc/mulliken-center/software/dftd4"
@ -16,6 +17,8 @@ class Dftd4(MesonPackage):
license("LGPL-3.0-only")
build_system("cmake", "meson", default="meson")
version("main", branch="main")
version("3.7.0", sha256="4e8749df6852bf863d5d1831780a2d30e9ac4afcfebbbfe5f6a6a73d06d6c6ee")
version("3.6.0", sha256="56b3b4650853a34347d3d56c93d7596ecbe2208c4a14dbd027959fd4a009679d")
@ -26,22 +29,39 @@ class Dftd4(MesonPackage):
version("3.1.0", sha256="b652aa7cbf8d087c91bcf80f2d5801459ecf89c5d4176ebb39e963ee740ed54b")
version("3.0.0", sha256="a7539d68d48d851bf37b79e37ea907c9da5eee908d0aa58a0a7dc15f04f8bc35")
depends_on("c", type="build") # generated
depends_on("fortran", type="build") # generated
depends_on("c", type="build")
depends_on("fortran", type="build")
variant("openmp", default=True, description="Use OpenMP parallelisation")
variant("python", default=False, description="Build Python extension module")
variant(
"python",
default=False,
when="build_system=meson",
description="Build Python extension module",
)
depends_on("meson@0.57.1:", type="build", when="build_system=meson") # mesonbuild/meson#8377
depends_on("blas")
depends_on("lapack")
depends_on("mctc-lib")
depends_on("meson@0.57.1:", type="build") # mesonbuild/meson#8377
depends_on("pkgconfig", type="build")
depends_on("py-cffi", when="+python")
depends_on("python@3.6:", when="+python")
for build_system in ["cmake", "meson"]:
depends_on(f"mctc-lib build_system={build_system}", when=f"build_system={build_system}")
depends_on(f"multicharge build_system={build_system}", when=f"build_system={build_system}")
extends("python", when="+python")
def url_for_version(self, version):
if version <= Version("3.6.0"):
return f"https://github.com/dftd4/dftd4/releases/download/v{version}/dftd4-{version}-source.tar.xz"
return super().url_for_version(version)
class MesonBuilder(meson.MesonBuilder):
def meson_args(self):
lapack = self.spec["lapack"].libs.names[0]
if lapack == "lapack":
@ -57,7 +77,7 @@ def meson_args(self):
"-Dpython={0}".format(str("+python" in self.spec).lower()),
]
def url_for_version(self, version):
if version <= Version("3.6.0"):
return f"https://github.com/dftd4/dftd4/releases/download/v{version}/dftd4-{version}-source.tar.xz"
return super().url_for_version(version)
class CMakeBuilder(cmake.CMakeBuilder):
def cmake_args(self):
return [self.define_from_variant("WITH_OPENMP", "openmp")]

View File

@ -25,9 +25,9 @@ class Elsi(CMakePackage, CudaPackage):
)
version("master", branch="master")
depends_on("c", type="build") # generated
depends_on("cxx", type="build") # generated
depends_on("fortran", type="build") # generated
depends_on("c", type="build")
depends_on("cxx", type="build")
depends_on("fortran", type="build")
generator("ninja")

View File

@ -2,20 +2,23 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.build_systems import cmake, meson
from spack.package import *
class MctcLib(MesonPackage):
class MctcLib(MesonPackage, CMakePackage):
"""Modular computation toolchain library for quantum chemistry file IO"""
homepage = "https://github.com/grimme-lab/mctc-lib"
url = "https://github.com/grimme-lab/mctc-lib/releases/download/v0.3.0/mctc-lib-0.3.0.tar.xz"
url = "https://github.com/grimme-lab/mctc-lib/releases/download/v0.0.0/mctc-lib-0.0.0.tar.xz"
git = "https://github.com/grimme-lab/mctc-lib"
maintainers("awvwgk")
license("Apache-2.0")
build_system("cmake", "meson", default="meson")
version("main", branch="main")
version("0.3.1", sha256="a5032a0bbbbacc952037c5215b71aa6b438767a84bafb60fda25ba43c8835513")
version("0.3.0", sha256="81f3edbf322e6e28e621730a796278498b84af0f221f785c537a315312059bf0")
@ -24,9 +27,17 @@ class MctcLib(MesonPackage):
variant("json", default=False, description="Enable support for JSON")
depends_on("meson@0.57.2:", type="build")
depends_on("meson@0.57.2:", type="build", when="build_system=meson")
depends_on("json-fortran@8:", when="+json")
depends_on("pkgconfig", type="build")
class CMakeBuilder(cmake.CMakeBuilder):
def cmake_args(self):
return [self.define_from_variant("WITH_JSON", "json")]
class MesonBuilder(meson.MesonBuilder):
def meson_args(self):
return ["-Djson={0}".format("enabled" if "+json" in self.spec else "disabled")]

View File

@ -0,0 +1,50 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.build_systems import cmake, meson
from spack.package import *
class Multicharge(CMakePackage, MesonPackage):
"""Electronegativity equilibration model for atomic partial charges"""
homepage = "https://github.com/grimme-lab/multicharge"
url = "https://github.com/grimme-lab/multicharge/releases/download/v0.0.0/multicharge-0.0.0.tar.xz"
git = "https://github.com/grimme-lab/multicharge.git"
maintainers("RMeli", "awvwgk")
license("Apache-2.0", checked_by="RMeli")
build_system("cmake", "meson", default="meson")
version("0.3.0", sha256="e8f6615d445264798b12d2854e25c93938373dc149bb79e6eddd23fc4309749d")
variant("openmp", default=True, description="Enable OpenMP support")
depends_on("lapack")
depends_on("mctc-lib build_system=cmake", when="build_system=cmake")
depends_on("mctc-lib build_system=meson", when="build_system=meson")
class CMakeBuilder(cmake.CMakeBuilder):
def cmake_args(self):
args = [self.define_from_variant("WITH_OpenMP", "openmp")]
return args
class MesonBuilder(meson.MesonBuilder):
def meson_args(self):
lapack = self.spec["lapack"].libs.names[0]
if lapack == "lapack":
lapack = "netlib"
elif lapack.startswith("mkl"):
lapack = "mkl"
elif lapack != "openblas":
lapack = "auto"
return [
"-Dopenmp={0}".format(str("+openmp" in self.spec).lower()),
"-Dlapack={0}".format(lapack),
]