summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorScott Wittenburg <scott.wittenburg@kitware.com>2018-01-22 11:46:44 -0700
committerscheibelp <scheibel1@llnl.gov>2018-01-22 10:46:44 -0800
commitd2c344152739999c48420c7382cda9855fba7a71 (patch)
treead194bd0381a4745cb98cb109301c75d539ad4ca /var
parent55c3451b87ef5c921c9ff12233b2568f89228cd7 (diff)
downloadspack-d2c344152739999c48420c7382cda9855fba7a71.tar.gz
spack-d2c344152739999c48420c7382cda9855fba7a71.tar.bz2
spack-d2c344152739999c48420c7382cda9855fba7a71.tar.xz
spack-d2c344152739999c48420c7382cda9855fba7a71.zip
Update gl/qt options for vtk package (#6551)
This provides options for hardware and software rendering with the gl API and updates the vtk package to make use of those options: * Create new "gl" virtual package, provided by mesa * Add external-only "opengl" package, which represents a system install that provides gl * For vtk: prefer system gl implementation by default to get speed up from hardware rendering. When software rendering is specifically requested (+osmesa), try to use the llvmpipe approach, as it is much faster. * Make qt dependency optional for vtk * Add basic support for VTK on osx * qt: Depend on virtual gl package, rather than mesa impl
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/mesa/package.py4
-rw-r--r--var/spack/repos/builtin/packages/opengl/package.py58
-rw-r--r--var/spack/repos/builtin/packages/qt/package.py3
-rw-r--r--var/spack/repos/builtin/packages/vtk/package.py124
4 files changed, 167 insertions, 22 deletions
diff --git a/var/spack/repos/builtin/packages/mesa/package.py b/var/spack/repos/builtin/packages/mesa/package.py
index 7d10632806..2912f6c789 100644
--- a/var/spack/repos/builtin/packages/mesa/package.py
+++ b/var/spack/repos/builtin/packages/mesa/package.py
@@ -46,6 +46,10 @@ class Mesa(AutotoolsPackage):
version('12.0.6', '1a3d4fea0656c208db59289e4ed33b3f')
version('12.0.3', '1113699c714042d8c4df4766be8c57d8')
+ provides('gl@:4.5', when='@17:')
+ provides('gl@:4.4', when='@13:')
+ provides('gl@:4.3', when='@12:')
+
variant('swrender', default=True,
description="Build with (gallium) software rendering.")
variant('hwrender', default=False,
diff --git a/var/spack/repos/builtin/packages/opengl/package.py b/var/spack/repos/builtin/packages/opengl/package.py
new file mode 100644
index 0000000000..9d9e52f959
--- /dev/null
+++ b/var/spack/repos/builtin/packages/opengl/package.py
@@ -0,0 +1,58 @@
+##############################################################################
+# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# LLNL-CODE-647188
+#
+# For details, see https://github.com/spack/spack
+# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License (as
+# published by the Free Software Foundation) version 2.1, February 1999.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
+# conditions of the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##############################################################################
+from spack import *
+
+
+class Opengl(Package):
+ """Placeholder for external OpenGL libraries from hardware vendors"""
+
+ homepage = "https://www.opengl.org/"
+ url = "https://www.opengl.org/"
+
+ version('3.2', 'N/A')
+
+ provides('gl@:4.5', when='@4.5:')
+ provides('gl@:4.4', when='@4.4:')
+ provides('gl@:4.3', when='@4.3:')
+
+ def install(self, spec, prefix):
+ msg = """This package is intended to be a placeholder for
+ system-provided OpenGL libraries from hardware vendors. Please
+ download and install OpenGL drivers/libraries for your graphics
+ hardware separately, and then set that up as an external package.
+ An example of a working packages.yaml:
+
+ packages:
+ opengl:
+ paths:
+ opengl@4.5.0: /opt/opengl
+ buildable: False
+
+ In that case, /opt/opengl/ should contain these two folders:
+
+ include/GL/ (opengl headers, including "gl.h")
+ lib (opengl libraries, including "libGL.so")"""
+
+ raise InstallError(msg)
diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py
index 1505eff61a..c345e693f1 100644
--- a/var/spack/repos/builtin/packages/qt/package.py
+++ b/var/spack/repos/builtin/packages/qt/package.py
@@ -126,8 +126,7 @@ class Qt(Package):
depends_on("python", when='@5.7.0:', type='build')
# OpenGL hardware acceleration
- depends_on("mesa", when='@4:+opengl')
-
+ depends_on("gl@3.2:", when='@4:+opengl')
depends_on("libxcb", when=sys.platform != 'darwin')
depends_on("libx11", when=sys.platform != 'darwin')
diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py
index caf11b1fc7..3ed2016a0f 100644
--- a/var/spack/repos/builtin/packages/vtk/package.py
+++ b/var/spack/repos/builtin/packages/vtk/package.py
@@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
+import os
from spack import *
@@ -32,24 +33,55 @@ class Vtk(CMakePackage):
processing and visualization. """
homepage = "http://www.vtk.org"
- url = "http://www.vtk.org/files/release/7.1/VTK-7.1.0.tar.gz"
+ url = "http://www.vtk.org/files/release/8.0/VTK-8.0.1.tar.gz"
list_url = "http://www.vtk.org/download/"
+ version('8.0.1', '692d09ae8fadc97b59d35cab429b261a')
version('7.1.0', 'a7e814c1db503d896af72458c2d0228f')
version('7.0.0', '5fe35312db5fb2341139b8e4955c367d')
version('6.3.0', '0231ca4840408e9dd60af48b314c5b6d')
version('6.1.0', '25e4dfb3bad778722dcaec80cd5dab7d')
# VTK7 defaults to OpenGL2 rendering backend
- variant('opengl2', default=True, description='Build with OpenGL2 instead of OpenGL as rendering backend')
- variant('python', default=False, description='Build the python modules')
+ variant('opengl2', default=True, description='Enable OpenGL2 backend')
+ variant('osmesa', default=False, description='Enable OSMesa support')
+ variant('python', default=False, description='Enable Python support')
+ variant('qt', default=False, description='Build with support for Qt')
patch('gcc.patch', when='@6.1.0')
- depends_on('qt')
+ # At the moment, we cannot build with both osmesa and qt, but as of
+ # VTK 8.1, that should change
+ conflicts('+osmesa', when='+qt')
+
+ # The use of the OpenGL2 backend requires at least OpenGL Core Profile
+ # version 3.2 or higher.
+ depends_on('gl@3.2:', when='+opengl2')
+
+ # If you didn't ask for osmesa, then hw rendering using vendor-specific
+ # drivers is faster, but it must be done externally.
+ depends_on('opengl', when='~osmesa')
+
+ # mesa default is software rendering, make it faster with llvm
+ depends_on('mesa+llvm', when='+osmesa')
+
+ # VTK will need Qt5OpenGL, and qt needs '-opengl' for that
+ depends_on('qt+opengl', when='+qt')
+
+ depends_on('expat')
+ depends_on('freetype')
+ depends_on('glew')
depends_on('hdf5')
+ depends_on('libjpeg')
+ depends_on('jsoncpp')
+ depends_on('libharu')
+ depends_on('libxml2')
+ depends_on('lz4')
depends_on('netcdf')
depends_on('netcdf-cxx')
+ depends_on('libpng')
+ depends_on('libtiff')
+ depends_on('zlib')
extends('python', when='+python')
@@ -57,18 +89,29 @@ class Vtk(CMakePackage):
url = "http://www.vtk.org/files/release/{0}/VTK-{1}.tar.gz"
return url.format(version.up_to(2), version)
+ def setup_environment(self, spack_env, run_env):
+ # VTK has some trouble finding freetype unless it is set in
+ # the environment
+ spack_env.set('FREETYPE_DIR', self.spec['freetype'].prefix)
+
def cmake_args(self):
spec = self.spec
opengl_ver = 'OpenGL{0}'.format('2' if '+opengl2' in spec else '')
- qt_ver = spec['qt'].version.up_to(1)
- qt_bin = spec['qt'].prefix.bin
cmake_args = [
'-DBUILD_SHARED_LIBS=ON',
'-DVTK_RENDERING_BACKEND:STRING={0}'.format(opengl_ver),
- '-DVTK_USE_SYSTEM_HDF5=ON',
- '-DVTK_USE_SYSTEM_NETCDF=ON',
+
+ # In general, we disable use of VTK "ThirdParty" libs, preferring
+ # spack-built versions whenever possible
+ '-DVTK_USE_SYSTEM_LIBRARIES=ON',
+
+ # However, in a few cases we can't do without them yet
+ '-DVTK_USE_SYSTEM_GL2PS=OFF',
+ '-DVTK_USE_SYSTEM_LIBPROJ4=OFF',
+ '-DVTK_USE_SYSTEM_OGGTHEORA=OFF',
+
'-DNETCDF_DIR={0}'.format(spec['netcdf'].prefix),
'-DNETCDF_C_ROOT={0}'.format(spec['netcdf'].prefix),
'-DNETCDF_CXX_ROOT={0}'.format(spec['netcdf-cxx'].prefix),
@@ -80,21 +123,62 @@ class Vtk(CMakePackage):
# Disable wrappers for other languages.
'-DVTK_WRAP_JAVA=OFF',
'-DVTK_WRAP_TCL=OFF',
-
- # Enable Qt support here.
- '-DVTK_QT_VERSION:STRING={0}'.format(qt_ver),
- '-DQT_QMAKE_EXECUTABLE:PATH={0}/qmake'.format(qt_bin),
- '-DVTK_Group_Qt:BOOL=ON',
]
- # NOTE: The following definitions are required in order to allow
- # VTK to build with qt~webkit versions (see the documentation for
- # more info: http://www.vtk.org/Wiki/VTK/Tutorials/QtSetup).
- if '~webkit' in spec['qt']:
+ if 'darwin' in spec.architecture:
+ cmake_args.extend([
+ '-DCMAKE_MACOSX_RPATH=ON'
+ ])
+
+ if '+qt' in spec:
+ qt_ver = spec['qt'].version.up_to(1)
+ qt_bin = spec['qt'].prefix.bin
+ qmake_exe = os.path.join(qt_bin, 'qmake')
+
+ cmake_args.extend([
+ # Enable Qt support here.
+ '-DVTK_QT_VERSION:STRING={0}'.format(qt_ver),
+ '-DQT_QMAKE_EXECUTABLE:PATH={0}'.format(qmake_exe),
+ '-DVTK_Group_Qt:BOOL=ON',
+ ])
+
+ # NOTE: The following definitions are required in order to allow
+ # VTK to build with qt~webkit versions (see the documentation for
+ # more info: http://www.vtk.org/Wiki/VTK/Tutorials/QtSetup).
+ if '~webkit' in spec['qt']:
+ cmake_args.extend([
+ '-DVTK_Group_Qt:BOOL=OFF',
+ '-DModule_vtkGUISupportQt:BOOL=ON',
+ '-DModule_vtkGUISupportQtOpenGL:BOOL=ON',
+ ])
+
+ if '+osmesa' in spec:
+ prefix = spec['mesa'].prefix
+ osmesaIncludeDir = prefix.include
+ osmesaLibrary = os.path.join(prefix.lib, 'libOSMesa.so')
+
+ useParam = 'VTK_USE_X'
+ if 'darwin' in spec.architecture:
+ useParam = 'VTK_USE_COCOA'
+
+ cmake_args.extend([
+ '-D{0}:BOOL=OFF'.format(useParam),
+ '-DVTK_OPENGL_HAS_OSMESA:BOOL=ON',
+ '-DOSMESA_INCLUDE_DIR:PATH={0}'.format(osmesaIncludeDir),
+ '-DOSMESA_LIBRARY:FILEPATH={0}'.format(osmesaLibrary),
+ ])
+ else:
+ prefix = spec['opengl'].prefix
+
+ openglIncludeDir = prefix.include
+ openglLibrary = os.path.join(prefix.lib, 'libGL.so')
+ if 'darwin' in spec.architecture:
+ openglIncludeDir = prefix
+ openglLibrary = prefix
+
cmake_args.extend([
- '-DVTK_Group_Qt:BOOL=OFF',
- '-DModule_vtkGUISupportQt:BOOL=ON',
- '-DModule_vtkGUISupportQtOpenGL:BOOL=ON',
+ '-DOPENGL_INCLUDE_DIR:PATH={0}'.format(openglIncludeDir),
+ '-DOPENGL_gl_LIBRARY:FILEPATH={0}'.format(openglLibrary)
])
if spec.satisfies('@:6.1.0'):