diff --git a/repos/spack_repo/builtin/packages/axom/package.py b/repos/spack_repo/builtin/packages/axom/package.py index 0f8262df5f9..5d9c8123c47 100644 --- a/repos/spack_repo/builtin/packages/axom/package.py +++ b/repos/spack_repo/builtin/packages/axom/package.py @@ -5,6 +5,7 @@ import os import shutil import socket +import tempfile from os.path import join as pjoin from spack_repo.builtin.build_systems.cached_cmake import ( @@ -113,8 +114,11 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): variant("tools", default=True, description="Build tools") variant("tutorials", default=True, description="Build tutorials") - # Hard requirement after Axom 0.6.1 - variant("cpp14", default=True, description="Build with C++14 support") + variant( + "cpp14", + default=False, + description="Build with C++14 support. Deprecated -- use the cxxstd variant version.", + ) variant("fortran", default=True, description="Build with Fortran support") @@ -150,20 +154,30 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): variant("adiak", default=False, when="@0.13:", description="Build with adiak") variant("caliper", default=False, when="@0.13:", description="Build with caliper") variant("conduit", default=True, description="Build with conduit") - - variant("opencascade", default=False, description="Build with opencascade") - - variant("mfem", default=False, description="Build with mfem") variant("hdf5", default=True, description="Build with hdf5") variant("lua", default=True, description="Build with Lua") + variant("mfem", default=False, description="Build with mfem") + variant("opencascade", default=False, description="Build with opencascade") + variant("raja", default=True, description="Build with raja") variant("scr", default=False, description="Build with SCR") variant("umpire", default=True, description="Build with umpire") - variant("raja", default=True, description="Build with raja") - varmsg = "Build development tools (such as Sphinx, Doxygen, etc...)" variant("devtools", default=False, description=varmsg) + variant( + "cxxstd", + default="20", + values=( + conditional("11", when="@:0.6.1"), + conditional("14", when="@:0.11.0"), + conditional("17", when="@:0.14.0"), + "20", + ), + multi=False, + description="C++ standard to build with", + ) + # ----------------------------------------------------------------------- # Dependencies # ----------------------------------------------------------------------- @@ -278,14 +292,20 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("mfem~mpi", when="~mpi") depends_on("mfem@4.5.0:", when="@0.7.0:") - depends_on("python", when="+python") - # Python with when("+python"): + depends_on("python") + + # extending python allows spack environment views to import axom from python + extends("python") + depends_on("py-nanobind@2.7.0:") depends_on("py-pytest") + depends_on("py-packaging") + depends_on("py-pygments") depends_on("py-numpy") - depends_on("conduit+python") + depends_on("py-mpi4py", when="+mpi") + depends_on("conduit+python", when="+conduit") # Devtools with when("+devtools"): @@ -302,6 +322,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): # (ENABLE_CLANGFORMAT will be OFF if not the exact version) depends_on("llvm+clang@19", type="build") + # ----------------------------------------------------------------------- # Component requirements # ----------------------------------------------------------------------- # Hard inter-component dependencies taken from Axom's dependency graph. @@ -329,8 +350,6 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): # ----------------------------------------------------------------------- # Conflicts # ----------------------------------------------------------------------- - # Hard requirement after Axom 0.6.1 - conflicts("~cpp14", when="@0.6.2:") # Conduit's cmake config files moved and < 0.4.0 can't find it conflicts("^conduit@0.7.2:", when="@:0.4.0") @@ -388,6 +407,10 @@ def cache_name(self): special_case, ) + @property + def cxx_std(self): + return self.spec.variants.get("cxxstd").value + def initconfig_compiler_entries(self): spec = self.spec entries = super().initconfig_compiler_entries() @@ -409,8 +432,10 @@ def initconfig_compiler_entries(self): else: entries.append(cmake_cache_option("ENABLE_FORTRAN", False)) - if spec.satisfies("+cpp14") and spec.satisfies("@:0.6.1"): + if (spec.satisfies("+cpp14") or self.cxx_std == "14") and spec.satisfies("@:0.6.1"): entries.append(cmake_cache_string("BLT_CXX_STD", "c++14", "")) + else: + entries.append(cmake_cache_string("BLT_CXX_STD", f"c++{self.cxx_std}")) # Add optimization flag workaround for builds with cray compiler if spec.satisfies("%cce"): @@ -449,7 +474,7 @@ def initconfig_hardware_entries(self): if spec.satisfies("^blt@:0.5.1"): # This is handled internally by BLT now - if spec.satisfies("+cpp14"): + if spec.satisfies("+cpp14") or self.cxx_std == "14": cudaflags += " -std=c++14" else: cudaflags += " -std=c++11" @@ -499,25 +524,26 @@ def initconfig_hardware_entries(self): hip_link_flags += "-lflang -lflangrti " # Additional library path for cray compiler - if self.spec.satisfies("%cce"): - lib_path = "/opt/cray/pe/cce/{0}/cce/x86_64/lib".format(self.spec.compiler.version) + if spec.satisfies("%cce"): + lib_path = "/opt/cray/pe/cce/{0}/cce/x86_64/lib".format(spec.compiler.version) hip_link_flags += "-L{0} -Wl,-rpath,{0}".format(lib_path) if spec.satisfies("+fortran"): - link_remove_list = [] + link_lib_remove_list = [] # Remove extra link library for crayftn if self.is_fortran_compiler("crayftn"): - link_remove_list += ["unwind"] + link_lib_remove_list += ["unwind"] # Remove injected OpenMP stub library if spec.satisfies("+openmp"): - link_remove_list += ["ompstub"] + link_lib_remove_list += ["ompstub"] - if link_remove_list: + if link_lib_remove_list: entries.append( cmake_cache_string( - "BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE", ";".join(link_remove_list) + "BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE", + ";".join(link_lib_remove_list), ) ) @@ -579,7 +605,8 @@ def initconfig_hardware_entries(self): cmake_cache_string("BLT_OPENMP_LINK_FLAGS", openmp_gen_exp, description) ) - if spec.satisfies("+openmp") and spec.satisfies("+rocm") and self.spec.satisfies("%cce"): + # For cce up to version 20.0.0 + if spec.satisfies("+openmp") and spec.satisfies("+rocm") and spec.satisfies("%cce@:20"): openmp_gen_exp = ( "$<$>:" "-fopenmp=libomp>;$<$