Skip to content

Commit

Permalink
up feelpp package
Browse files Browse the repository at this point in the history
- c++ standard handled by multiple choice variants
- use mpi c, cxx and fortran virtual deps

#4
  • Loading branch information
prudhomm authored Sep 18, 2024
1 parent efbae8c commit 05423f0
Showing 1 changed file with 16 additions and 36 deletions.
52 changes: 16 additions & 36 deletions var/spack/repos/builtin/packages/feelpp/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,26 @@ class Feelpp(CMakePackage):
version("preset", branch="2284-add-spack-environment-to-the-main-ci")

# Define variants
variant("toolboxes", default=False, description="Enable the Feel++ toolboxes")
variant("mor", default=False, description="Enable Model Order Reduction (MOR)")
variant("python", default=False, description="Enable Python wrappers")
variant("quickstart", default=False, description="Enable the quickstart examples")
variant("toolboxes", default=True, description="Enable the Feel++ toolboxes")
variant("mor", default=True, description="Enable Model Order Reduction (MOR)")
variant("python", default=True, description="Enable Python wrappers")
variant("quickstart", default=True, description="Enable the quickstart examples")
variant("tests", default=False, description="Enable the tests")

# MPI Variants
variant("mpi", default="openmpi4", description="Choose MPI version", values=("openmpi4", "openmpi5", "cray-mpich8", "mpich3", "mpich4"), multi=False)

# Add variants for C++ standards
variant("cpp17", default=False, description="Use C++17 standard")
variant("cpp20", default=True, description="Use C++20 standard")
variant("cpp23", default=False, description="Use C++23 standard")

# Conflicts between C++ standard variants
conflicts("+cpp17", when="+cpp20", msg="Cannot enable both C++17 and C++20")
conflicts("+cpp17", when="+cpp23", msg="Cannot enable both C++17 and C++23")
conflicts("+cpp20", when="+cpp23", msg="Cannot enable both C++20 and C++23")
variant(
"cxxstd", default="20", description="C++ standard", values=["17", "20", "23"], multi=False
)

# Specify dependencies with required versions
depends_on("c", type="build")
depends_on("cxx", type="build")
depends_on("fortran", type="build")
depends_on("[email protected]:", type="build")
depends_on("[email protected]:")
depends_on("mpi")
depends_on("[email protected]: +filesystem+iostreams+mpi+multithreaded+shared")
depends_on("[email protected] +mumps+hwloc+ptscotch +suite-sparse+hdf5 +hypre+kokkos")
depends_on("llvm@18:", type="build")
depends_on("slepc")
depends_on("[email protected]")
depends_on("fftw")
Expand All @@ -64,13 +60,6 @@ class Feelpp(CMakePackage):
depends_on("ruby")
depends_on("gmsh +opencascade+mmg+fltk")
depends_on("curl")

# MPI dependencies
depends_on("[email protected]:4.999", when="mpi=openmpi4")
depends_on("[email protected]:5.999", when="mpi=openmpi5")
depends_on("[email protected]:8.999", when="mpi=cray-mpich8")
depends_on("[email protected]:3.999", when="mpi=mpich3")
depends_on("[email protected]:4.999", when="mpi=mpich4")

# Python dependencies if +python variant is enabled
depends_on("py-pytest", when="+python")
Expand All @@ -85,22 +74,13 @@ class Feelpp(CMakePackage):
depends_on("py-tabulate", when="+python")
depends_on("py-ipykernel", when="+python")
depends_on("py-mpi4py", when="+python")
depends_on("py-tqdm", when="+python")
depends_on("[email protected]:", when="+python", type=("build", "run"))

def get_cpp_version(self):
"""Helper function to determine the C++ standard preset."""
if "+cpp17" in self.spec:
return "cpp17"
elif "+cpp20" in self.spec:
return "cpp20"
elif "+cpp23" in self.spec:
return "cpp23"
else:
return "cpp20" # default

def get_preset_name(self):
cpp_version = self.get_cpp_version()
preset_name = f"feelpp-clang-{cpp_version}-default-release"
spec = self.spec
cpp_version = spec.variants["cxxstd"].value
preset_name = f"feelpp-clang-cpp{cpp_version}-default-release"
return preset_name

def cmake_args(self):
Expand Down

0 comments on commit 05423f0

Please sign in to comment.