spack/var/spack/repos/builtin/packages/vtk/package.py

118 lines
4.6 KiB
Python
Raw Normal View History

##############################################################################
# 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 *
2016-08-10 16:50:00 +08:00
class Vtk(CMakePackage):
"""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/7.1/VTK-7.1.0.tar.gz"
Overhaul Spack's URL parsing (#2972) * Remove fake URLs from Spack * Ignore long lines for URLs that start with ftp: * Preliminary changes to version regexes * New redesign of version regexes * Allow letters in version-only * Fix detection of versions that end in Final * Rearrange a few regexes and add examples * Add tests for common download repositories * Add test cases for common tarball naming schemes * Finalize version regexes * spack url test -> spack url summary * Clean up comments * Rearrange suffix checks * Use query strings for name detection * Remove no longer necessary url_for_version functions * Strip off extraneous information after package name * Add one more test * Dot in square brackets does not need to be escaped * Move renaming outside of parse_name_offset * Fix versions for a couple more packages * Fix flake8 and doc tests * Correctly parse Python, Lua, and Bio++ package names * Use effective URLs for mfem * Add checksummed version to mitos * Remove url_for_version from STAR-CCM+ package * Revert changes to version numbers with underscores and dashes * Fix name detection for tbb * Correctly parse Ruby gems * Reverted mfem back to shortened URLs. * Updated instructions for better security * Remove preferred=True from newest version * Add tests for new `spack url list` flags * Add tests for strip_name_suffixes * Add unit tests for version separators * Fix bugs related to parseable name but in parseable version * Remove dead code, update docstring * Ignore 'binary' at end of version string * Remove platform from version * Flip libedit version numbers * Re-support weird NCO alpha/beta versions * Rebase and remove one new fake URL * Add / to beginning of regex to avoid picking up similarly named packages * Ignore weird tar versions * Fix bug in url parse --spider when no versions found * Less strict version matching for spack versions * Don't rename Python packages * Be a little more selective, version must begin with a digit * Re-add fake URLs * Fix up several other packages * Ignore more file endings * Add parsing support for Miniconda * Update tab completion * XFAILS are now PASSES for 2 web tests
2017-04-04 06:34:16 +08:00
list_url = "http://www.vtk.org/download/"
version('7.1.0', 'a7e814c1db503d896af72458c2d0228f')
version('7.0.0', '5fe35312db5fb2341139b8e4955c367d')
version('6.3.0', '0231ca4840408e9dd60af48b314c5b6d')
version('6.1.0', '25e4dfb3bad778722dcaec80cd5dab7d')
2016-03-26 01:25:29 +08:00
# 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')
2016-03-26 01:25:29 +08:00
patch('gcc.patch', when='@6.1.0')
depends_on('qt')
depends_on('hdf5')
depends_on('netcdf')
depends_on('netcdf-cxx')
extends('python', when='+python')
def url_for_version(self, version):
url = "http://www.vtk.org/files/release/{0}/VTK-{1}.tar.gz"
return url.format(version.up_to(2), version)
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',
'-DNETCDF_DIR={0}'.format(spec['netcdf'].prefix),
'-DNETCDF_C_ROOT={0}'.format(spec['netcdf'].prefix),
'-DNETCDF_CXX_ROOT={0}'.format(spec['netcdf-cxx'].prefix),
# Enable/Disable wrappers for Python.
'-DVTK_WRAP_PYTHON={0}'.format(
'ON' if '+python' in spec else 'OFF'),
# 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',
])
if spec.satisfies('@:6.1.0'):
cmake_args.extend([
'-DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY',
'-DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY'
])
# VTK 6.1.0 (and possibly earlier) does not use
# NETCDF_CXX_ROOT to detect NetCDF C++ bindings, so
# NETCDF_CXX_INCLUDE_DIR and NETCDF_CXX_LIBRARY must be
# used instead to detect these bindings
netcdf_cxx_lib = spec['netcdf-cxx'].libs.joined()
cmake_args.extend([
'-DNETCDF_CXX_INCLUDE_DIR={0}'.format(
spec['netcdf-cxx'].prefix.include),
'-DNETCDF_CXX_LIBRARY={0}'.format(netcdf_cxx_lib),
])
return cmake_args