From 94536d2b66541353cfaf83d9820797fafe1e8881 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 23 May 2024 22:17:51 +0200 Subject: [PATCH] Enforce consistency of `gl` providers (#44307) * glew: rework dependency on gl This simplifies the package and ensures a single gl implementation is pulled in. Before we were adding direct dependencies, and those are not unified through the virtual. * mesa-demos: rework dependency on gl This simplifies the package and ensures a single gl implementation is pulled in. Before we were adding direct dependencies, and those are not unified through the virtual. * mesa-glu: rework dependency on gl This simplifies the package and ensures a single gl implementation is pulled in. Before we were adding direct dependencies, and those are not unified through the virtual. * paraview: fix dependency on glew * mesa: group dependency on when("+glx") * Add missing dependency on libxml2 * paraview: remove the "osmesa" and "egl" variant Instead, enforce consistency using the "gl" virtual that allows only one provider. * visit: remove osmesa variant * Disable paraview in the aws-isc stacks * data-vis-sdk: rework constrains to enforce front-ends * e4s-power: remove redundant paraview * Pipelines: update osmesa variants * trilinos-catalyst-ioss-adapter: make gl a run dependency --- .../stacks/aws-isc-aarch64/spack.yaml | 2 +- .../cloud_pipelines/stacks/aws-isc/spack.yaml | 2 +- .../stacks/data-vis-sdk/spack.yaml | 14 ++++---- .../stacks/e4s-cray-rhel/spack.yaml | 2 +- .../stacks/e4s-cray-sles/spack.yaml | 2 +- .../stacks/e4s-power/spack.yaml | 1 - .../stacks/e4s-rocm-external/spack.yaml | 2 +- .../cloud_pipelines/stacks/e4s/spack.yaml | 2 +- .../stacks/gpu-tests/spack.yaml | 2 +- .../repos/builtin/packages/glew/package.py | 35 ++++-------------- .../builtin/packages/mesa-demos/package.py | 24 +++---------- .../builtin/packages/mesa-glu/package.py | 20 +---------- .../repos/builtin/packages/mesa/package.py | 14 ++++---- .../builtin/packages/of-catalyst/package.py | 6 +++- .../builtin/packages/paraview/package.py | 36 ++++++++----------- .../trilinos-catalyst-ioss-adapter/package.py | 4 ++- .../repos/builtin/packages/visit/package.py | 12 +++---- 17 files changed, 60 insertions(+), 120 deletions(-) diff --git a/share/spack/gitlab/cloud_pipelines/stacks/aws-isc-aarch64/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/aws-isc-aarch64/spack.yaml index 3db29ee697..1fef3594e7 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/aws-isc-aarch64/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/aws-isc-aarch64/spack.yaml @@ -79,7 +79,7 @@ spack: - openfoam - osu-micro-benchmarks - parallel - - paraview + # - paraview - picard - quantum-espresso - raja diff --git a/share/spack/gitlab/cloud_pipelines/stacks/aws-isc/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/aws-isc/spack.yaml index 185282e0ab..8d079b2ee3 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/aws-isc/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/aws-isc/spack.yaml @@ -85,7 +85,7 @@ spack: - openfoam - osu-micro-benchmarks - parallel - - paraview + # - paraview - picard - quantum-espresso # Build broken for gcc@7.3.1 x86_64_v4 (error: '_mm512_loadu_epi32' was not declared in this scope) diff --git a/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml index 512c4f47d6..be0ec9b235 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml @@ -25,16 +25,16 @@ spack: - paraview_specs: - matrix: - - paraview +raytracing - - - +qt~osmesa # GUI Support w/ GLX Rendering - - ~qt~osmesa # GLX Rendering - - ~qt+osmesa # OSMesa Rendering + - - +qt ^[virtuals=gl] glx # GUI Support w/ GLX Rendering + - ~qt ^[virtuals=gl] glx # GLX Rendering + - ^[virtuals=gl] osmesa # OSMesa Rendering - visit_specs: - matrix: - - - visit - - - ~gui~osmesa # GLX Rendering - - ~gui+osmesa # OSMesa Rendering + - - visit~gui + - - ^[virtuals=gl] glx # GLX Rendering + - ^[virtuals=gl] osmesa # OSMesa Rendering # VisIt GUI does not work with Qt 5.14.2 - # - +gui~osmesa # GUI Support w/ GLX Rendering + # - +gui ^[virtuals=gl] glx # GUI Support w/ GLX Rendering - sdk_base_spec: - matrix: - - ecp-data-vis-sdk +ascent +adios2 +cinema +darshan +faodel +hdf5 +pnetcdf diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-rhel/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-rhel/spack.yaml index b8ef26faf5..37834d60f6 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-rhel/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-rhel/spack.yaml @@ -50,7 +50,7 @@ spack: variants: +termlib paraview: # Don't build GUI support or GLX rendering for HPC/container deployments - require: "@5.11 ~qt+osmesa" + require: "@5.11 ~qt ^[virtuals=gl] osmesa" python: version: [3.8.13] trilinos: diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-sles/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-sles/spack.yaml index d4dadd8053..376ad7d086 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-sles/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-sles/spack.yaml @@ -43,7 +43,7 @@ spack: variants: +termlib paraview: # Don't build GUI support or GLX rendering for HPC/container deployments - require: "@5.11 ~qt+osmesa" + require: "@5.11 ~qt ^[virtuals=gl] osmesa" python: version: [3.8.13] trilinos: diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-power/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-power/spack.yaml index 597ff0a875..3fa3c9b045 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-power/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-power/spack.yaml @@ -168,7 +168,6 @@ spack: - hdf5 - libcatalyst - parallel-netcdf - - paraview - py-cinemasci - sz - unifyfs diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml index c234339d8d..7677a375cb 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml @@ -21,7 +21,7 @@ spack: variants: threads=openmp paraview: # Don't build GUI support or GLX rendering for HPC/container deployments - require: "@5.11 ~qt+osmesa" + require: "@5.11 ~qt ^[virtuals=gl] osmesa" # ROCm 5.4.3 comgr: diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml index 3e49aa2ce5..d274690629 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml @@ -52,7 +52,7 @@ spack: version: [11.8.0] paraview: # Don't build GUI support or GLX rendering for HPC/container deployments - require: "@5.11 ~qt+osmesa" + require: "@5.11 ~qt ^[virtuals=gl] osmesa" specs: # CPU diff --git a/share/spack/gitlab/cloud_pipelines/stacks/gpu-tests/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/gpu-tests/spack.yaml index 263d8e29b3..addccd7bd2 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/gpu-tests/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/gpu-tests/spack.yaml @@ -31,7 +31,7 @@ spack: variants: threads=openmp paraview: # Don't build GUI support or GLX rendering for HPC/container deployments - require: "@5.11 ~qt+osmesa" + require: "@5.11 ~qt ^[virtuals=gl] osmesa" trilinos: require: +amesos +amesos2 +anasazi +aztec +boost +epetra +epetraext +ifpack +intrepid +intrepid2 +isorropia +kokkos +ml +minitensor +muelu diff --git a/var/spack/repos/builtin/packages/glew/package.py b/var/spack/repos/builtin/packages/glew/package.py index 6e2e41779f..7183933c4b 100644 --- a/var/spack/repos/builtin/packages/glew/package.py +++ b/var/spack/repos/builtin/packages/glew/package.py @@ -2,9 +2,6 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - -import sys - from spack.package import * @@ -23,29 +20,9 @@ class Glew(CMakePackage): version("2.1.0", sha256="04de91e7e6763039bc11940095cd9c7f880baba82196a7765f727ac05a993c95") version("2.0.0", sha256="c572c30a4e64689c342ba1624130ac98936d7af90c3103f9ce12b8a0c5736764") - variant( - "gl", - default="glx" if sys.platform.startswith("linux") else "other", - values=("glx", "osmesa", "egl", "other"), - multi=False, - description="The OpenGL provider to use", - ) - conflicts("^osmesa", when="gl=glx") - conflicts("^osmesa", when="gl=egl") - conflicts("^osmesa", when="gl=other") - conflicts("^glx", when="gl=osmesa") - conflicts("^glx", when="gl=other") - conflicts("^glx", when="gl=egl") - conflicts("^egl", when="gl=glx") - conflicts("^egl", when="gl=osmesa") - conflicts("^egl", when="gl=other") - depends_on("gl") - depends_on("osmesa", when="gl=osmesa") - depends_on("glx", when="gl=glx") - depends_on("libx11", when="gl=glx") - depends_on("xproto", when="gl=glx") - depends_on("egl", when="gl=egl") + depends_on("libx11", when="^[virtuals=gl] glx") + depends_on("xproto", when="^[virtuals=gl] glx") # glu is already forcibly disabled in the CMakeLists.txt. This prevents # it from showing up in the .pc file @@ -56,15 +33,15 @@ def cmake_args(self): args = [ self.define("BUILD_UTILS", True), self.define("GLEW_REGAL", False), - self.define("GLEW_EGL", "gl=egl" in spec), + self.define("GLEW_EGL", spec.satisfies("^[virtuals=gl] egl")), self.define("OPENGL_INCLUDE_DIR", spec["gl"].headers.directories[0]), self.define("OPENGL_gl_LIBRARY", spec["gl"].libs[0]), self.define("OPENGL_opengl_LIBRARY", "IGNORE"), self.define("OPENGL_glx_LIBRARY", "IGNORE"), self.define("OPENGL_glu_LIBRARY", "IGNORE"), - self.define("GLEW_OSMESA", "gl=osmesa" in spec), + self.define("GLEW_OSMESA", spec.satisfies("^[virtuals=gl] osmesa")), ] - if "gl=egl" in spec: + if spec.satisfies("^[virtuals=gl] egl"): args.append( self.define("OPENGL_egl_LIBRARY", [spec["egl"].libs[0], spec["egl"].libs[1]]) ) @@ -76,4 +53,4 @@ def cmake_args(self): def flag_handler(self, name, flags): if name == "ldflags" and self.spec.satisfies("platform=darwin ^apple-gl"): flags.append("-framework OpenGL") - return (flags, None, None) + return flags, None, None diff --git a/var/spack/repos/builtin/packages/mesa-demos/package.py b/var/spack/repos/builtin/packages/mesa-demos/package.py index c85b2eb2e3..60a923e06a 100644 --- a/var/spack/repos/builtin/packages/mesa-demos/package.py +++ b/var/spack/repos/builtin/packages/mesa-demos/package.py @@ -2,8 +2,6 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import sys - from spack.package import * @@ -20,18 +18,6 @@ class MesaDemos(AutotoolsPackage): version("8.2.0", sha256="5a9f71b815d968d0c3b77edfcc3782d0211f8520b00da9e554ccfed80c8889f6") version("8.1.0", sha256="cc5826105355830208c90047fc38c5b09fa3ab0045366e7e859104935b00b76d") - variant( - "gl", - default="glx" if sys.platform.startswith("linux") else "osmesa", - values=("glx", "osmesa", "other"), - multi=False, - description="The OpenGL provider to use", - ) - conflicts("^osmesa", when="gl=glx") - conflicts("^osmesa", when="gl=other") - conflicts("^glx", when="gl=osmesa") - conflicts("^glx", when="gl=other") - depends_on("autoconf", type="build") depends_on("automake", type="build") depends_on("libtool", type="build") @@ -39,10 +25,8 @@ class MesaDemos(AutotoolsPackage): depends_on("pkgconfig", type="build") depends_on("gl") - depends_on("osmesa", when="gl=osmesa") - depends_on("glx", when="gl=glx") - depends_on("libx11", when="gl=glx") - depends_on("libxext", when="gl=glx") + depends_on("libx11", when="^[virtuals=gl] glx") + depends_on("libxext", when="^[virtuals=gl] glx") depends_on("glu") depends_on("glew@1.5.4:") @@ -64,11 +48,11 @@ def configure_args(self): "--disable-rbug", "--without-glut", ] - if "gl=glx" in spec: + if spec.satisfies("^[virtuals=gl] glx"): args.append("--enable-x11") else: args.append("--disable-x11") - if "gl=osmesa" in spec: + if spec.satisfies("^[virtuals=gl] osmesa"): args.append("--enable-osmesa") else: args.append("--disable-osmesa") diff --git a/var/spack/repos/builtin/packages/mesa-glu/package.py b/var/spack/repos/builtin/packages/mesa-glu/package.py index 071703aa5f..7393398e91 100644 --- a/var/spack/repos/builtin/packages/mesa-glu/package.py +++ b/var/spack/repos/builtin/packages/mesa-glu/package.py @@ -2,9 +2,6 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - -import sys - from spack.package import * @@ -18,22 +15,7 @@ class MesaGlu(AutotoolsPackage): version("9.0.1", sha256="f6f484cfcd51e489afe88031afdea1e173aa652697e4c19ddbcb8260579a10f7") version("9.0.0", sha256="4387476a1933f36fec1531178ea204057bbeb04cc2d8396c9ea32720a1f7e264") - variant( - "gl", - default="glx" if sys.platform.startswith("linux") else "other", - values=("glx", "osmesa", "other"), - multi=False, - description="The OpenGL provider to use", - ) - conflicts("^osmesa", when="gl=glx") - conflicts("^osmesa", when="gl=other") - conflicts("^glx", when="gl=osmesa") - conflicts("^glx", when="gl=other") - depends_on("gl@3:") - depends_on("osmesa", when="gl=osmesa") - depends_on("glx", when="gl=glx") - provides("glu@1.3") # When using -std=c++17, using register long will throw an error. This @@ -43,7 +25,7 @@ class MesaGlu(AutotoolsPackage): def configure_args(self): args = ["--disable-libglvnd"] - if "gl=osmesa" in self.spec: + if self.spec.satisfies("^[virtuals=gl] osmesa"): args.append("--enable-osmesa") else: args.append("--disable-osmesa") diff --git a/var/spack/repos/builtin/packages/mesa/package.py b/var/spack/repos/builtin/packages/mesa/package.py index b46be01968..dbbcee64cb 100644 --- a/var/spack/repos/builtin/packages/mesa/package.py +++ b/var/spack/repos/builtin/packages/mesa/package.py @@ -62,6 +62,7 @@ class Mesa(MesonPackage): depends_on("unwind") depends_on("expat") depends_on("zlib-api") + depends_on("libxml2") # Internal options variant("llvm", default=True, description="Enable LLVM.") @@ -111,12 +112,13 @@ class Mesa(MesonPackage): depends_on("libllvm@:12", when="@:21") depends_on("libllvm@:17", when="@:23") - depends_on("libx11", when="+glx") - depends_on("libxcb", when="+glx") - depends_on("libxext", when="+glx") - depends_on("libxt", when="+glx") - depends_on("xrandr", when="+glx") - depends_on("glproto@1.4.14:", when="+glx") + with when("+glx"): + depends_on("libx11") + depends_on("libxcb") + depends_on("libxext") + depends_on("libxt") + depends_on("xrandr") + depends_on("glproto@1.4.14:") # version specific issue # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96130 diff --git a/var/spack/repos/builtin/packages/of-catalyst/package.py b/var/spack/repos/builtin/packages/of-catalyst/package.py index d7a3821736..b210baa5d3 100644 --- a/var/spack/repos/builtin/packages/of-catalyst/package.py +++ b/var/spack/repos/builtin/packages/of-catalyst/package.py @@ -32,7 +32,11 @@ class OfCatalyst(CMakePackage): depends_on("openfoam@1806", when="@1806", type=("build", "link", "run")) depends_on("openfoam@develop", when="@develop", type=("build", "link", "run")) - depends_on("paraview@5.5:+osmesa~qt", when="+full") + + with when("+full"): + depends_on("paraview@5.5: ~qt") + depends_on("gl") + requires("^[virtuals=gl] osmesa") root_cmakelists_dir = "src/catalyst" diff --git a/var/spack/repos/builtin/packages/paraview/package.py b/var/spack/repos/builtin/packages/paraview/package.py index 2c5882e2a9..0d67b24053 100644 --- a/var/spack/repos/builtin/packages/paraview/package.py +++ b/var/spack/repos/builtin/packages/paraview/package.py @@ -66,8 +66,6 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage): variant("python", default=False, description="Enable Python support", when="@5.6:") variant("fortran", default=False, description="Enable Fortran support") variant("mpi", default=True, description="Enable MPI support") - variant("osmesa", default=False, description="Enable OSMesa support") - variant("egl", default=False, description="Enable EGL in the OpenGL library being used") variant("qt", default=False, description="Enable Qt (gui) support") variant("opengl2", default=True, description="Enable OpenGL2 backend") variant("examples", default=False, description="Build examples") @@ -187,16 +185,12 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage): depends_on("gl@3.2:", when="+opengl2") depends_on("gl@1.2:", when="~opengl2") - depends_on("glew", when="~egl") - depends_on("glew gl=egl", when="+egl") + depends_on("glew") - depends_on("osmesa", when="+osmesa") for p in ["linux", "cray"]: - depends_on("glx", when="~egl ~osmesa platform={}".format(p)) - depends_on("libxt", when="~egl ~osmesa platform={}".format(p)) - conflicts("+qt", when="+osmesa") - conflicts("+qt", when="+egl") - conflicts("+egl", when="+osmesa") + depends_on("libxt", when=f"platform={p} ^[virtuals=gl] glx") + + requires("^[virtuals=gl] glx", when="+qt", msg="Qt support requires GLX") depends_on("ospray@2.1:2", when="+raytracing") depends_on("openimagedenoise", when="+raytracing") @@ -373,7 +367,7 @@ def flag_handler(self, name, flags): if self.spec["hdf5"].satisfies("@1.12:"): flags.append("-DH5_USE_110_API") - return (flags, None, None) + return flags, None, None def setup_run_environment(self, env): # paraview 5.5 and later @@ -421,19 +415,17 @@ def cmake_args(self): def variant_bool(feature, on="ON", off="OFF"): """Ternary for spec variant to ON/OFF string""" - if feature in spec: + if spec.satisfies(feature): return on return off - def nvariant_bool(feature): - """Negated ternary for spec variant to OFF/ON string""" - return variant_bool(feature, on="OFF", off="ON") - def use_x11(): """Return false if osmesa or egl are requested""" - if "+osmesa" in spec or "+egl" in spec: - return "OFF" - if spec.satisfies("platform=windows"): + if ( + spec.satisfies("^[virtuals=gl] osmesa") + or spec.satisfies("^[virtuals=gl] egl") + or spec.satisfies("platform=windows") + ): return "OFF" return "ON" @@ -441,7 +433,7 @@ def use_x11(): includes = variant_bool("+development_files") cmake_args = [ - "-DVTK_OPENGL_HAS_OSMESA:BOOL=%s" % variant_bool("+osmesa"), + "-DVTK_OPENGL_HAS_OSMESA:BOOL=%s" % variant_bool("^[virtuals=gl] osmesa"), "-DVTK_USE_X:BOOL=%s" % use_x11(), "-DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=%s" % includes, "-DBUILD_TESTING:BOOL=OFF", @@ -450,7 +442,7 @@ def use_x11(): self.define_from_variant("VISIT_BUILD_READER_Silo", "visitbridge"), ] - if "+egl" in spec: + if spec.satisfies("^[virtuals=gl] egl"): cmake_args.append("-DVTK_OPENGL_HAS_EGL:BOOL=ON") if spec.satisfies("@5.12:"): @@ -527,7 +519,7 @@ def use_x11(): # The assumed qt version changed to QT5 (as of paraview 5.2.1), # so explicitly specify which QT major version is actually being used - if "+qt" in spec: + if spec.satisfies("+qt"): cmake_args.extend(["-DPARAVIEW_QT_VERSION=%s" % spec["qt"].version[0]]) if "+fortran" in spec: diff --git a/var/spack/repos/builtin/packages/trilinos-catalyst-ioss-adapter/package.py b/var/spack/repos/builtin/packages/trilinos-catalyst-ioss-adapter/package.py index 891929bdb4..c971f46adc 100644 --- a/var/spack/repos/builtin/packages/trilinos-catalyst-ioss-adapter/package.py +++ b/var/spack/repos/builtin/packages/trilinos-catalyst-ioss-adapter/package.py @@ -17,7 +17,9 @@ class TrilinosCatalystIossAdapter(CMakePackage): depends_on("bison", type="build") depends_on("flex", type="build") - depends_on("paraview+mpi+python+osmesa") + depends_on("paraview+mpi+python") + depends_on("gl", type="run") + requires("^[virtuals=gl] osmesa", msg="OSMesa is required for paraview") depends_on("py-numpy", type=("build", "run")) # Here we avoid paraview trying to use netcdf-c~parallel-netcdf # which is netcdf-c's default, even though paraview depends on 'netcdf-c' diff --git a/var/spack/repos/builtin/packages/visit/package.py b/var/spack/repos/builtin/packages/visit/package.py index 987f7f7250..5163725ab8 100644 --- a/var/spack/repos/builtin/packages/visit/package.py +++ b/var/spack/repos/builtin/packages/visit/package.py @@ -75,7 +75,6 @@ class Visit(CMakePackage): generator("ninja") variant("gui", default=True, description="Enable VisIt's GUI") - variant("osmesa", default=False, description="Use OSMesa for off-screen CPU rendering") variant("adios2", default=True, description="Enable ADIOS2 file format") variant("hdf5", default=True, description="Enable HDF5 file format") variant("netcdf", default=True, description="Enable NetCDF file format") @@ -105,14 +104,13 @@ class Visit(CMakePackage): # Fix const-correctness in VTK interface patch("vtk-8.2-constcorrect.patch", when="@3.3.3 ^vtk@8.2.1a") - # Exactly one of 'gui' or 'osmesa' has to be enabled - conflicts("+gui", when="+osmesa") + conflicts( + "+gui", when="^[virtuals=gl] osmesa", msg="GUI cannot be activated with OSMesa front-end" + ) depends_on("cmake@3.14.7:", type="build") depends_on("mpi", when="+mpi") - requires("^[virtuals=gl] osmesa", when="+osmesa") - # VTK flavors depends_on("vtk@8.1:8 +opengl2") depends_on("vtk +qt", when="+gui") @@ -125,7 +123,7 @@ class Visit(CMakePackage): depends_on( "vtk", patches=[patch("vtk_rendering_opengl2_x11.patch")], - when="~osmesa platform=linux ^vtk@8", + when="platform=linux ^[virtuals=gl] glx ^vtk@8", ) depends_on("vtk", patches=[patch("vtk_wrapping_python_x11.patch")], when="+python ^vtk@8") @@ -296,7 +294,7 @@ def cmake_args(self): self.define("OPENGL_glu_LIBRARY", spec["glu"].libs[0]), ] ) - if "+osmesa" in spec: + if spec.satisfies("^[virtuals=gl] osmesa"): args.extend( [ self.define("HAVE_OSMESA", True),