From 5edb0fe96ae1cc984f5b3cf765a3c4131dfa2961 Mon Sep 17 00:00:00 2001 From: Ryan Mast <3969255+nightlark@users.noreply.github.com> Date: Mon, 22 Aug 2022 10:49:57 -0700 Subject: [PATCH] helics: update v3 options and add missing versions (#32121) * helics: update v3 options and add missing versions * helics: allow using openssl 3.x for encryption support * helics: fix style errors * helics: Apply suggestion from code review Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> --- .../repos/builtin/packages/helics/package.py | 57 +++++++++++++++---- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/var/spack/repos/builtin/packages/helics/package.py b/var/spack/repos/builtin/packages/helics/package.py index fe99fb84b8..aeb7f8b874 100644 --- a/var/spack/repos/builtin/packages/helics/package.py +++ b/var/spack/repos/builtin/packages/helics/package.py @@ -23,6 +23,9 @@ class Helics(CMakePackage): version("master", branch="main", submodules=True) version("3.2.1", sha256="9df8a7a687c7cf8ea6f157e748e57e8bf5cefa9a49a24e7c590fe9191291da95") version("3.2.0", sha256="b9cec50b9e767113b2e04a5623437885f76196cc9a58287e21f5c0f62c32cca1") + version("3.1.2", sha256="eed5daff8ce131c86e972383a1e67933ddac97be5345d41b41ef71663eb097bb") + version("3.1.1", sha256="65791ddede5f06aff58daa7cf0b9d244baa6c4e08e119ca010ddcc6137a479d9") + version("3.1.0", sha256="b6f97c8ce3c4c18dce8e868a366782b726077165204d631a5c580682f872ffd7") version("3.0.1", sha256="512afc18e25311477ec82804de74c47a674aa213d2173c276b6caf555b8421dd") version("3.0.0", sha256="928687e95d048f3f9f9d67cec4ac20866a98cbc00090a2d62abaa11c2a20958c") version("2.8.1", sha256="9485091fb1bf5d0dd3b21a2641dd78051bbf5374cd823425e458053abafdfa1f") @@ -43,7 +46,8 @@ class Helics(CMakePackage): description="CMake build type", values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"), ) - variant("apps", default=True, description="Install the HELICS apps") + variant("apps", default=True, description="Install the HELICS apps executables") + variant("apps_lib", default=True, description="Install the HELICS apps library") variant("benchmarks", default=False, description="Install the HELICS benchmarks") variant("c_shared", default=True, description="Install the C shared library") variant("cxx_shared", default=True, description="Install the CXX shared library") @@ -61,11 +65,24 @@ class Helics(CMakePackage): default=True, description="Enable the integrated webserver in the HELICS broker server", ) - variant("python", default=False, description="Enable Python interface") + variant( + "encryption", + default=True, + when="@3.2.0:", + description="Enable support for encrypted communication", + ) + variant( + "python", + default=False, + when="@:2", + description="Enable building Python interface (split into separate repo in v3)", + ) # Build dependency depends_on("git", type="build", when="@master:") - depends_on("cmake@3.4:", type="build") + depends_on("cmake@3.4:", type="build", when="@:2") + depends_on("cmake@3.10:", type="build", when="@3.0.0:3.2.1") + depends_on("cmake@3.11:", type="build", when="@3.3.0:") depends_on("boost@1.70:", type="build", when="+boost") # TODO: replace this with an explicit list of components of Boost, @@ -76,7 +93,17 @@ class Helics(CMakePackage): depends_on("libzmq@4.3:", when="+zmq") depends_on("mpi@2", when="+mpi") - depends_on("python@3:", when="+python") + depends_on("openssl@1.1.1:", when="+encryption") + + # SWIG generated Python interface only works with HELICS <=2.x + depends_on("python@3:", when="@:2 +python") + + # Compiler restrictions based on C++ standard supported + conflicts("%gcc@:6", when="@3.0.0:", msg="HELICS 3+ cannot be built with GCC older than 7.0") + conflicts( + "%clang@:4", when="@3.0.0:", msg="HELICS 3+ cannot be built with Clang older than 5.0" + ) + conflicts("%intel@:18", when="@3.0.0:", msg="HELICS 3+ cannot be built with ICC older than 19") # OpenMPI doesn't work with HELICS <=2.4.1 conflicts("^openmpi", when="@:2.4.1 +mpi") @@ -100,12 +127,14 @@ def cmake_args(self): ] # HELICS core type CMake options - args.append(from_variant("ENABLE_ZMQ_CORE", "zmq")) - args.append(from_variant("ENABLE_TCP_CORE", "tcp")) - args.append(from_variant("ENABLE_UDP_CORE", "udp")) - args.append(from_variant("ENABLE_IPC_CORE", "ipc")) - args.append(from_variant("ENABLE_INPROC_CORE", "inproc")) - args.append(from_variant("ENABLE_MPI_CORE", "mpi")) + # Options were renamed in v3 + pre = "HELICS_" if spec.satisfies("@3:") else "" + args.append(from_variant("{0}ENABLE_ZMQ_CORE".format(pre), "zmq")) + args.append(from_variant("{0}ENABLE_TCP_CORE".format(pre), "tcp")) + args.append(from_variant("{0}ENABLE_UDP_CORE".format(pre), "udp")) + args.append(from_variant("{0}ENABLE_IPC_CORE".format(pre), "ipc")) + args.append(from_variant("{0}ENABLE_INPROC_CORE".format(pre), "inproc")) + args.append(from_variant("{0}ENABLE_MPI_CORE".format(pre), "mpi")) # HELICS shared library options args.append( @@ -115,6 +144,7 @@ def cmake_args(self): # HELICS executable app options args.append(from_variant("HELICS_BUILD_APP_EXECUTABLES", "apps")) + args.append(from_variant("HELICS_BUILD_APP_LIBRARY", "apps_lib")) args.append( "-DHELICS_DISABLE_WEBSERVER={0}".format("OFF" if "+webserver" in spec else "ON") ) @@ -124,11 +154,16 @@ def cmake_args(self): args.append("-DHELICS_DISABLE_BOOST={0}".format("OFF" if "+boost" in spec else "ON")) args.append("-DHELICS_DISABLE_ASIO={0}".format("OFF" if "+asio" in spec else "ON")) + # Encryption + args.append(from_variant("HELICS_ENABLE_ENCRYPTION", "encryption")) + # SWIG args.append(from_variant("HELICS_ENABLE_SWIG", "swig")) # Python - args.append(from_variant("BUILD_PYTHON_INTERFACE", "python")) + if spec.satisfies("@:2"): + # Python interface was removed from the main HELICS build in v3 + args.append(from_variant("BUILD_PYTHON_INTERFACE", "python")) return args