summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/vtk/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/vtk/package.py')
-rw-r--r--var/spack/repos/builtin/packages/vtk/package.py85
1 files changed, 51 insertions, 34 deletions
diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py
index d2296dbc26..c2d5ff399f 100644
--- a/var/spack/repos/builtin/packages/vtk/package.py
+++ b/var/spack/repos/builtin/packages/vtk/package.py
@@ -22,61 +22,78 @@
# 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 Vtk(Package):
"""The Visualization Toolkit (VTK) is an open-source, freely
available software system for 3D computer graphics, image
processing and visualization. """
+
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('7.0.0', '5fe35312db5fb2341139b8e4955c367d')
+ version('6.3.0', '0231ca4840408e9dd60af48b314c5b6d')
+ version('6.1.0', '25e4dfb3bad778722dcaec80cd5dab7d')
- version("6.3.0", '0231ca4840408e9dd60af48b314c5b6d', url="http://www.vtk.org/files/release/6.3/VTK-6.3.0.tar.gz")
+ # 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')
- version('6.1.0', '25e4dfb3bad778722dcaec80cd5dab7d')
+ patch('gcc.patch')
- depends_on("qt")
+ depends_on('cmake', type='build')
+ depends_on('qt')
- # VTK7 defaults to OpenGL2 rendering backend
- variant('opengl2', default=True, description='Build with OpenGL instead of OpenGL2 as rendering backend')
+ extends('python', when='+python')
+ depends_on('python', when='+python')
+
+ def url_for_version(self, ver):
+ return '{0}/{1}/VTK-{2}.tar.gz'.format(Vtk.base_url, ver.up_to(2), ver)
def install(self, spec, prefix):
def feature_to_bool(feature, on='ON', off='OFF'):
- if feature in spec:
- return on
- return off
+ return on if '+{0}'.format(feature) in spec else off
with working_dir('spack-build', create=True):
- cmake_args = [
- "..",
- "-DBUILD_SHARED_LIBS=ON",
- # Disable wrappers for other languages.
- "-DVTK_WRAP_PYTHON=OFF",
- "-DVTK_WRAP_JAVA=OFF",
- "-DVTK_WRAP_TCL=OFF"]
- cmake_args.extend(std_cmake_args)
+ 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
- # Enable Qt support here.
+ cmake_args = std_cmake_args[:]
cmake_args.extend([
- "-DQT_QMAKE_EXECUTABLE:PATH=%s/qmake" % spec['qt'].prefix.bin,
- "-DVTK_Group_Qt:BOOL=ON",
- # Ignore webkit because it's hard to build w/Qt
- "-DVTK_Group_Qt=OFF",
- "-DModule_vtkGUISupportQt:BOOL=ON",
- "-DModule_vtkGUISupportQtOpenGL:BOOL=ON"
- ])
+ '-DBUILD_SHARED_LIBS=ON',
+ '-DVTK_RENDERING_BACKEND:STRING={0}'.format(opengl_ver),
- if spec['qt'].satisfies('@5'):
- cmake_args.append("-DVTK_QT_VERSION:STRING=5")
+ # Enable/Disable wrappers for Python.
+ '-DVTK_WRAP_PYTHON={0}'.format(feature_to_bool('python')),
- if spec.satisfies("@6.1.0"):
- cmake_args.append("-DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY")
- cmake_args.append("-DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY")
+ # 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']:
+ cmake_args.extend([
+ '-DVTK_Group_Qt:BOOL=OFF',
+ '-DModule_vtkGUISupportQt:BOOL=ON',
+ '-DModule_vtkGUISupportQtOpenGL:BOOL=ON',
+ ])
- cmake_args.append('-DVTK_RENDERING_BACKEND:STRING=%s' % feature_to_bool('+opengl2', 'OpenGL2', 'OpenGL'))
+ if spec.satisfies('@:6.1.0'):
+ cmake_args.append('-DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY')
+ cmake_args.append('-DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY')
- cmake(*cmake_args)
+ cmake('..', *cmake_args)
make()
- make("install")
+ make('install')