pressio: new package (#49592)

* pressio: add packages for pressio, pressio-ops, and pressio-log

* pressio: use symlinks for pressio-ops/log; specify compatible versions

* pressio: refactor supported versions, update pressio-ops to use main branch

* pressio: update package after renaming repository to pressio-rom

* pressio: remove unneeded if statement

---------

Co-authored-by: Caleb Schilly <cwschilly@gmail.com>
This commit is contained in:
Francesco Rizzi 2025-04-04 14:56:47 -06:00 committed by GitHub
parent 8ab1011192
commit 87bbcefba9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PressioLog(Package):
"""
pressio-log is a header-only logging library designed
for use with Pressio repositories.
"""
homepage = "https://github.com/Pressio/pressio-log/blob/main/README.md"
git = "https://github.com/pressio/pressio-log.git"
license("BSD-3-Clause")
maintainers("fnrizzi", "cwschilly")
version("main", branch="main")
version("0.15.0", branch="0.15.0")
def install(self, spec, prefix):
install_tree("include", prefix.include)

View File

@ -0,0 +1,25 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PressioOps(Package):
"""
pressio-ops is a header-only library containing
essential operations for the Pressio ecosystem.
"""
homepage = "https://pressio.github.io/pressio-ops"
git = "https://github.com/pressio/pressio-ops.git"
license("BSD-3-Clause")
maintainers("fnrizzi", "cwschilly")
version("main", branch="main")
version("0.15.0", branch="0.15.0")
def install(self, spec, prefix):
install_tree("include", prefix.include)

View File

@ -0,0 +1,49 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from os.path import join as pjoin
from spack.package import *
class PressioRom(Package):
"""
Pressio is an ecosystem for developing, applying and
using projection-based model reduction (pROM) methods.
A key goal is to mitigate the intrusive nature of pROMs
for large-scale codes, and providing a framework to
foster research of new ideas as well as incentivize broader
adoption and usability.
"""
homepage = "https://pressio.github.io/pressio-rom/"
git = "https://github.com/pressio/pressio-rom.git"
license("BSD-3-Clause")
maintainers("fnrizzi", "cwschilly")
supported_versions = ["main", "0.15.0"]
# For now, assume each repo is compatible only with the same version of the other repos
for supported_version in supported_versions:
version(supported_version, branch=supported_version)
depends_on(f"pressio-ops@{supported_version}", type="build", when=f"@{supported_version}")
depends_on(f"pressio-log@{supported_version}", type="build", when=f"@{supported_version}")
def install(self, spec, prefix):
include_dir = prefix.include
install_tree("include", include_dir)
# Add symlinks to pressio-ops headers inside main include/pressio directory
pressio_includes = pjoin(include_dir, "pressio")
ops_include = pjoin(self.spec["pressio-ops"].prefix.include, "pressio")
for item in os.listdir(ops_include):
src_item = pjoin(ops_include, item)
dest_item = pjoin(pressio_includes, item)
symlink(src_item, dest_item, target_is_directory=os.path.isdir(src_item))
# Add symlink to pressio-log headers in include/pressio-log
log_include = pjoin(self.spec["pressio-log"].prefix.include, "pressio-log")
symlink(log_include, pjoin(include_dir, "pressio-log"), target_is_directory=True)