Skip to content

Commit

Permalink
Add CABLE package.py file
Browse files Browse the repository at this point in the history
To test installing the package, run

```
spack install -U -v [email protected] %[email protected] ^[email protected]
```

for compiling the serial executable, and

```
spack install -U -v [email protected] +mpi %[email protected] ^[email protected] ^[email protected]
```

for compiling the MPI executable.
  • Loading branch information
SeanBryan51 committed Jan 29, 2024
1 parent e57dc31 commit 67ddd8f
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions packages/cable/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# Copyright 2022 ACCESS-NRI
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *

# See https://spack.readthedocs.io/en/latest/packaging_guide.html for a guide
# on how this file works.


class Cable(CMakePackage):
"""The CSIRO Atmosphere Biosphere Land Exchange (CABLE) model."""

homepage = "https://github.com/CABLE-LSM/CABLE.git"
git = "[email protected]:CABLE-LSM/CABLE.git"

maintainers("SeanBryan51")

variant(
"mpi",
default=False,
description="Build MPI executable.",
)
variant(
"build_type",
default="Release",
description="CMake build type",
values=("Debug", "Release"),
)

depends_on("netcdf-fortran")
depends_on("mpi", when="+mpi")

def cmake_args(self):
args = []
if self.spec.satisfies("+mpi"):
args += [
self.define_from_variant("CABLE_MPI", "mpi"),
# TODO(Sean): we should let CMake find the MPI compiler instead
# of specifying it explicitly. However, this requires adding
# find_package(MPI) to the CMakeLists.txt file. This was not
# done in https://github.com/CABLE-LSM/CABLE/pull/200 so that
# we can demonstrate binary equivalence in the executables when
# transitioning from a Makefile based to a CMake based build
# system. Once find_package(MPI) is added, this file should be
# updated.
self.define(
"CMAKE_Fortran_COMPILER",
self.spec["mpi"].mpifc,
),
]
return args

0 comments on commit 67ddd8f

Please sign in to comment.