summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorRuben Di Battista <rubendibattista@users.noreply.github.com>2018-10-18 19:18:05 +0200
committerPeter Scheibel <scheibel1@llnl.gov>2018-10-18 10:18:05 -0700
commitd1db12e15347567ad23fc6bd6d27b0a415e08691 (patch)
tree9e1d375dfe574437689d5678ab0ddeca46c3d0bd /var
parent3d32e8add2db3d7b72776af5e41a1e08bf7b2695 (diff)
downloadspack-d1db12e15347567ad23fc6bd6d27b0a415e08691.tar.gz
spack-d1db12e15347567ad23fc6bd6d27b0a415e08691.tar.bz2
spack-d1db12e15347567ad23fc6bd6d27b0a415e08691.tar.xz
spack-d1db12e15347567ad23fc6bd6d27b0a415e08691.zip
vtk: add support for Xdmf IO. (#9510)
* vtk: add variants for Xdmf IO support, ffmpeg support, and MPI * vtk: depends on boost when Xdmf support is enabled * vtk: add backported patch for python3.7 * vtk: New policy only for cmake >= 3.12 * mesa: add py-argparse dependency (for build) * lz4: use MOREFLAGS instead of LIBS to add -lrt
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/lz4/package.py2
-rw-r--r--var/spack/repos/builtin/packages/mesa/package.py1
-rw-r--r--var/spack/repos/builtin/packages/vtk/package.py65
-rw-r--r--var/spack/repos/builtin/packages/vtk/python3.7-const-char.patch27
4 files changed, 87 insertions, 8 deletions
diff --git a/var/spack/repos/builtin/packages/lz4/package.py b/var/spack/repos/builtin/packages/lz4/package.py
index 2a64a3cdf2..fed8c3bfe2 100644
--- a/var/spack/repos/builtin/packages/lz4/package.py
+++ b/var/spack/repos/builtin/packages/lz4/package.py
@@ -32,7 +32,7 @@ class Lz4(Package):
def install(self, spec, prefix):
if sys.platform != "darwin":
- make('LIBS=-lrt') # fixes make error on CentOS6
+ make('MOREFLAGS=-lrt') # fixes make error on CentOS6
else:
make()
if self.run_tests:
diff --git a/var/spack/repos/builtin/packages/mesa/package.py b/var/spack/repos/builtin/packages/mesa/package.py
index 9dfe46cd3b..2823a98260 100644
--- a/var/spack/repos/builtin/packages/mesa/package.py
+++ b/var/spack/repos/builtin/packages/mesa/package.py
@@ -47,6 +47,7 @@ class Mesa(AutotoolsPackage):
depends_on('binutils', type='build', when=(sys.platform != 'darwin'))
depends_on('python@2.6.4:', type='build')
depends_on('py-mako@0.3.4:', type='build')
+ depends_on('py-argparse', type='build')
depends_on('gettext')
depends_on('icu4c')
depends_on('expat')
diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py
index 110ff01457..e8f345670c 100644
--- a/var/spack/repos/builtin/packages/vtk/package.py
+++ b/var/spack/repos/builtin/packages/vtk/package.py
@@ -29,6 +29,8 @@ class Vtk(CMakePackage):
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')
+ variant('xdmf', default=False, description='Build XDMF file support')
+ variant('ffmpeg', default=False, description='Build with FFMPEG support')
variant('mpi', default=True, description='Enable MPI support')
# Haru causes trouble on Fedora and Ubuntu in v8.1.1
@@ -41,6 +43,13 @@ class Vtk(CMakePackage):
# VTK 8.1, that should change
conflicts('+osmesa', when='+qt')
+ depends_on('python', when='+python')
+ depends_on('py-mpi4py', when='+mpi +python', type='run')
+ extends('python', when='+python')
+ # python3.7 compatibility patch backported from upstream
+ # https://gitlab.kitware.com/vtk/vtk/commit/706f1b397df09a27ab8981ab9464547028d0c322
+ patch('python3.7-const-char.patch', when='@:8.1.1 ^python@3.7:')
+
# The use of the OpenGL2 backend requires at least OpenGL Core Profile
# version 3.2 or higher.
depends_on('gl@3.2:', when='+opengl2')
@@ -60,6 +69,13 @@ class Vtk(CMakePackage):
depends_on('libharu', when='+haru')
+ depends_on('boost', when='+xdmf')
+ depends_on('boost+mpi', when='+xdmf +mpi')
+
+ depends_on('mpi', when='+mpi')
+
+ depends_on('ffmpeg', when='+ffmpeg')
+
depends_on('expat')
depends_on('freetype')
depends_on('glew')
@@ -74,8 +90,6 @@ class Vtk(CMakePackage):
depends_on('libtiff')
depends_on('zlib')
- 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)
@@ -99,12 +113,12 @@ class Vtk(CMakePackage):
# In general, we disable use of VTK "ThirdParty" libs, preferring
# spack-built versions whenever possible
- '-DVTK_USE_SYSTEM_LIBRARIES=ON',
+ '-DVTK_USE_SYSTEM_LIBRARIES:BOOL=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',
+ '-DVTK_USE_SYSTEM_GL2PS:BOOL=OFF',
+ '-DVTK_USE_SYSTEM_LIBPROJ4:BOOL=OFF',
+ '-DVTK_USE_SYSTEM_OGGTHEORA:BOOL=OFF',
'-DNETCDF_DIR={0}'.format(spec['netcdf'].prefix),
'-DNETCDF_C_ROOT={0}'.format(spec['netcdf'].prefix),
@@ -115,11 +129,21 @@ class Vtk(CMakePackage):
'-DVTK_WRAP_TCL=OFF',
]
+ if '+mpi' in spec:
+ cmake_args.extend([
+ '-DVTK_Group_MPI:BOOL=ON',
+ '-DVTK_USE_SYSTEM_DIY2:BOOL=OFF',
+ ])
+
+ if '+ffmpeg' in spec:
+ cmake_args.extend(['-DModule_vtkIOFFMPEG:BOOL=ON'])
+
# Enable/Disable wrappers for Python.
if '+python' in spec:
cmake_args.extend([
'-DVTK_WRAP_PYTHON=ON',
- '-DPYTHON_EXECUTABLE={0}'.format(spec['python'].command.path)
+ '-DPYTHON_EXECUTABLE={0}'.format(spec['python'].command.path),
+ '-DVTK_USE_SYSTEM_MPI4PY:BOOL=ON'
])
else:
cmake_args.append('-DVTK_WRAP_PYTHON=OFF')
@@ -157,6 +181,33 @@ class Vtk(CMakePackage):
'-DVTK_USE_SYSTEM_DIY2=OFF'
])
+ if '+xdmf' in spec:
+ if spec.satisfies('^cmake@3.12:'):
+ # This policy exists only for CMake >= 3.12
+ cmake_args.extend(["-DCMAKE_POLICY_DEFAULT_CMP0074=NEW"])
+
+ cmake_args.extend([
+ # Enable XDMF Support here
+ "-DModule_vtkIOXdmf2:BOOL=ON",
+ "-DModule_vtkIOXdmf3:BOOL=ON",
+ "-DModule_vtkIOParallelXdmf3:BOOL=ON",
+ "-DBOOST_ROOT={0}".format(spec['boost'].prefix),
+ "-DBOOST_LIBRARY_DIR={0}".format(spec['boost'].prefix.lib),
+ "-DBOOST_INCLUDE_DIR={0}".format(spec['boost'].prefix.include),
+ "-DBOOST_NO_SYSTEM_PATHS:BOOL=ON",
+ # This is needed because VTK has multiple FindBoost
+ # and they stick to system boost if there's a system boost
+ # installed with CMake
+ "-DBoost_NO_BOOST_CMAKE:BOOL=ON",
+ "-DHDF5_ROOT={0}".format(spec['hdf5'].prefix),
+ # The xdmf project does not export any CMake file...
+ "-DVTK_USE_SYSTEM_XDMF3:BOOL=OFF",
+ "-DVTK_USE_SYSTEM_XDMF2:BOOL=OFF"
+ ])
+
+ if '+mpi' in spec:
+ cmake_args.extend(["-DModule_vtkIOParallelXdmf3:BOOL=ON"])
+
if '+osmesa' in spec:
prefix = spec['mesa'].prefix
osmesa_include_dir = prefix.include
diff --git a/var/spack/repos/builtin/packages/vtk/python3.7-const-char.patch b/var/spack/repos/builtin/packages/vtk/python3.7-const-char.patch
new file mode 100644
index 0000000000..80dbc78530
--- /dev/null
+++ b/var/spack/repos/builtin/packages/vtk/python3.7-const-char.patch
@@ -0,0 +1,27 @@
+diff --git a/Wrapping/PythonCore/vtkPythonArgs.cxx b/Wrapping/PythonCore/vtkPythonArgs.cxx
+index 1a82af0802..b733458975 100644
+--- a/Wrapping/PythonCore/vtkPythonArgs.cxx
++++ b/Wrapping/PythonCore/vtkPythonArgs.cxx
+@@ -95,13 +95,21 @@ bool vtkPythonGetStringValue(PyObject *o, T *&a, const char *exctext)
+ {
+ if (PyBytes_Check(o))
+ {
++#if PY_VERSION_HEX >= 0x03070000
++ a = const_cast<char *>(PyBytes_AS_STRING(o));
++ return true;
++#else
+ a = PyBytes_AS_STRING(o);
+ return true;
++#endif
+ }
+ #ifdef Py_USING_UNICODE
+ else if (PyUnicode_Check(o))
+ {
+-#if PY_VERSION_HEX >= 0x03030000
++#if PY_VERSION_HEX >= 0x03070000
++ a = const_cast<char *>(PyUnicode_AsUTF8(o));
++ return true;
++#elif PY_VERSION_HEX >= 0x03030000
+ a = PyUnicode_AsUTF8(o);
+ return true;
+ #else