additivefoam: update build scripts for @main (#48223)

This commit is contained in:
Gerry Knapp 2025-01-06 21:32:09 -05:00 committed by GitHub
parent 770d2fe4d7
commit d503f03473
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 42 additions and 3 deletions

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
applications/Allwmake $targetType $*

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmake $targetType solvers/additiveFoam/functionObjects/ExaCA
wmake $targetType solvers/additiveFoam/movingHeatSource
wmake $targetType solvers/additiveFoam

View File

@ -2,10 +2,14 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import inspect
import os
import llnl.util.tty as tty
import spack.pkg.builtin.openfoam as openfoam
from spack.package import *
from spack.pkg.builtin.openfoam import add_extra_files
from spack.version import Version
class Additivefoam(Package):
@ -29,14 +33,36 @@ class Additivefoam(Package):
depends_on("openfoam-org@10")
common = ["spack-derived-Allwmake"]
assets = ["applications/Allwmake", "Allwmake"]
assets = [join_path("applications", "Allwmake"), "Allwmake"]
build_script = "./spack-derived-Allwmake"
phases = ["configure", "build", "install"]
def add_extra_files(self, common, local_prefix, local):
"""Copy additional common and local files into the stage.source_path
from the openfoam/common and the package/assets directories,
respectively. Modified from `spack.pkg.builtin.openfoam.add_extra_files()`.
"""
outdir = self.stage.source_path
indir = join_path(os.path.dirname(inspect.getfile(openfoam)), "common")
for f in common:
tty.info("Added file {0}".format(f))
openfoam.install(join_path(indir, f), join_path(outdir, f))
indir = join_path(self.package_dir, "assets", local_prefix)
for f in local:
tty.info("Added file {0}".format(f))
openfoam.install(join_path(indir, f), join_path(outdir, f))
def patch(self):
add_extra_files(self, self.common, self.assets)
spec = self.spec
asset_dir = ""
if Version("main") in spec.versions:
asset_dir = "assets_main"
elif Version("1.0.0") in spec.versions:
asset_dir = "assets_1.0.0"
self.add_extra_files(self.common, asset_dir, self.assets)
def configure(self, spec, prefix):
pass