Update and Clean Up the Visit and VTK Packages (#2167)

* Made some refactoring improvements to the 'visit' and 'vtk' packages.

* Added a small fix for the 'vtk' package when building with 'qt+webkit'.
This commit is contained in:
Joseph Ciurej 2016-10-28 17:59:21 -07:00 committed by Todd Gamblin
parent 58409a2eaf
commit c82985cb5e
2 changed files with 70 additions and 63 deletions

View file

@ -35,28 +35,30 @@ class Visit(Package):
version('2.10.2', '253de0837a9d69fb689befc98ea4d068') version('2.10.2', '253de0837a9d69fb689befc98ea4d068')
version('2.10.1', '3cbca162fdb0249f17c4456605c4211e') version('2.10.1', '3cbca162fdb0249f17c4456605c4211e')
depends_on("vtk@6.1.0~opengl2") depends_on('cmake', type='build')
depends_on("qt@4.8.6") depends_on('vtk@6.1.0~opengl2')
depends_on("python") depends_on('qt@4.8.6')
depends_on("silo+shared") depends_on('python')
depends_on("hdf5~mpi") depends_on('silo+shared')
depends_on('hdf5~mpi')
def install(self, spec, prefix): def install(self, spec, prefix):
qt_bin = spec['qt'].prefix.bin
python_bin = spec['python'].prefix.bin
with working_dir('spack-build', create=True): with working_dir('spack-build', create=True):
cmake_args = std_cmake_args[:]
cmake_args.extend([
'-DVTK_MAJOR_VERSION=6',
'-DVTK_MINOR_VERSION=1',
'-DVISIT_USE_GLEW=OFF',
'-DVISIT_LOC_QMAKE_EXE:FILEPATH={0}/qmake-qt4'.format(qt_bin),
'-DPYTHON_EXECUTABLE:FILEPATH={0}/python'.format(python_bin),
'-DVISIT_SILO_DIR:PATH={0}'.format(spec['silo'].prefix),
'-DVISIT_HDF5_DIR:PATH={0}'.format(spec['hdf5'].prefix),
'-DVISIT_VTK_DIR:PATH={0}'.format(spec['vtk'].prefix),
])
feature_args = std_cmake_args[:] cmake(join_path('..', 'src'), *cmake_args)
feature_args.extend([
"-DVTK_MAJOR_VERSION=6",
"-DVTK_MINOR_VERSION=1",
"-DVISIT_USE_GLEW=OFF",
"-DVISIT_LOC_QMAKE_EXE:FILEPATH=%s/qmake-qt4" % spec[
'qt'].prefix.bin,
"-DPYTHON_EXECUTABLE:FILEPATH=%s/python" % spec[
'python'].prefix.bin,
"-DVISIT_SILO_DIR:PATH=%s" % spec['silo'].prefix,
"-DVISIT_HDF5_DIR:PATH=%s" % spec['hdf5'].prefix])
cmake('../src', *feature_args)
make() make()
make("install") make('install')

View file

@ -22,6 +22,7 @@
# License along with this program; if not, write to the Free Software # License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
from spack import * from spack import *
@ -29,66 +30,70 @@ class Vtk(Package):
"""The Visualization Toolkit (VTK) is an open-source, freely """The Visualization Toolkit (VTK) is an open-source, freely
available software system for 3D computer graphics, image available software system for 3D computer graphics, image
processing and visualization. """ processing and visualization. """
homepage = "http://www.vtk.org" homepage = "http://www.vtk.org"
url = "http://www.vtk.org/files/release/6.1/VTK-6.1.0.tar.gz" base_url = "http://www.vtk.org/files/release"
version("7.0.0", "5fe35312db5fb2341139b8e4955c367d",
url="http://www.vtk.org/files/release/7.0/VTK-7.0.0.tar.gz")
version("6.3.0", '0231ca4840408e9dd60af48b314c5b6d',
url="http://www.vtk.org/files/release/6.3/VTK-6.3.0.tar.gz")
version('7.0.0', '5fe35312db5fb2341139b8e4955c367d')
version('6.3.0', '0231ca4840408e9dd60af48b314c5b6d')
version('6.1.0', '25e4dfb3bad778722dcaec80cd5dab7d') version('6.1.0', '25e4dfb3bad778722dcaec80cd5dab7d')
patch("gcc.patch") # 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')
patch('gcc.patch')
depends_on('cmake', type='build')
depends_on('qt')
extends('python', when='+python') extends('python', when='+python')
depends_on('python', when='+python') depends_on('python', when='+python')
depends_on('cmake', type='build')
depends_on("qt")
# VTK7 defaults to OpenGL2 rendering backend def url_for_version(self, ver):
variant('opengl2', default=True, return '{0}/{1}/VTK-{2}.tar.gz'.format(Vtk.base_url, ver.up_to(2), ver)
description='Build with OpenGL instead of OpenGL2 backend')
variant('python', default=False,
description='Build the python modules')
def install(self, spec, prefix): def install(self, spec, prefix):
def feature_to_bool(feature, on='ON', off='OFF'): def feature_to_bool(feature, on='ON', off='OFF'):
if feature in spec: return on if '+{0}'.format(feature) in spec else off
return on
return off
with working_dir('spack-build', create=True): with working_dir('spack-build', create=True):
cmake_args = [ opengl_ver = 'OpenGL{0}'.format('2' if '+opengl2' in spec else '')
"..", qt_ver = spec['qt'].version.up_to(1)
"-DBUILD_SHARED_LIBS=ON", qt_bin = spec['qt'].prefix.bin
"-DVTK_WRAP_PYTHON=" + ("ON" if "+python" in spec else "OFF"),
# Disable wrappers for other languages.
"-DVTK_WRAP_JAVA=OFF",
"-DVTK_WRAP_TCL=OFF"]
cmake_args.extend(std_cmake_args)
# Enable Qt support here. cmake_args = std_cmake_args[:]
cmake_args.extend([ cmake_args.extend([
"-DQT_QMAKE_EXECUTABLE:PATH=%s/qmake" % spec['qt'].prefix.bin, '-DBUILD_SHARED_LIBS=ON',
"-DVTK_Group_Qt:BOOL=ON", '-DVTK_RENDERING_BACKEND:STRING={0}'.format(opengl_ver),
# Ignore webkit because it's hard to build w/Qt
"-DVTK_Group_Qt=OFF", # Enable/Disable wrappers for Python.
"-DModule_vtkGUISupportQt:BOOL=ON", '-DVTK_WRAP_PYTHON={0}'.format(feature_to_bool('python')),
"-DModule_vtkGUISupportQtOpenGL:BOOL=ON"
# 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',
]) ])
if spec['qt'].satisfies('@5'): # NOTE: The following definitions are required in order to allow
cmake_args.append("-DVTK_QT_VERSION:STRING=5") # 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 spec.satisfies("@6.1.0"): if spec.satisfies('@:6.1.0'):
cmake_args.append("-DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY") cmake_args.append('-DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY')
cmake_args.append("-DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY") cmake_args.append('-DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY')
cmake_args.append('-DVTK_RENDERING_BACKEND:STRING=%s' % cmake('..', *cmake_args)
feature_to_bool('+opengl2', 'OpenGL2', 'OpenGL'))
cmake(*cmake_args)
make() make()
make("install") make('install')