easyblock = 'CMakeMake'

name = 'VTK'
version = '6.3.0'
versionsuffix = '-Python-%(pyver)s'

homepage = 'http://www.vtk.org'
description = """The Visualization Toolkit (VTK) is an open-source, freely available software system for
 3D computer graphics, image processing and visualization. VTK consists of a C++ class library and several
 interpreted interface layers including Tcl/Tk, Java, and Python. VTK supports a wide variety of visualization
 algorithms including: scalar, vector, tensor, texture, and volumetric methods; and advanced modeling techniques
 such as: implicit modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay triangulation."""

toolchain = {'name': 'intel', 'version': '2017a'}

source_urls = ['http://www.vtk.org/files/release/%(version_major_minor)s']
sources = [
    SOURCE_TAR_GZ,
    '%(name)sData-%(version)s.tar.gz',
]

builddependencies = [('CMake', '3.7.2', '', True)]

dependencies = [
    ('Python', '2.7.13', '', True),
    ('libGLU', '9.0.0', '', True),
    ('Mesa', '12.0.2'),
    ('libXt', '1.1.5', '', True),
]

configopts = "-DOPENGL_glu_LIBRARY=$EBROOTLIBGLU/lib/libGLU.%s " % SHLIB_EXT
configopts += "-DOPENGL_gl_LIBRARY=$EBROOTMESA/lib/libGL.%s " % SHLIB_EXT
configopts += "-DOPENGL_INCLUDE_DIR=$EBROOTMESA/include -DVTK_WRAP_PYTHON=ON "
configopts += "-DPYTHON_LIBRARY=$EBROOTPYTHON/lib/libpython%%(pyshortver)s.%s " % SHLIB_EXT
configopts += " -DPYTHON_INCLUDE_DIR=$EBROOTPYTHON/include/python%(pyshortver)s "
preinstallopts = "mkdir -p %(installdir)s/lib/python%(pyshortver)s/site-packages/ && "
preinstallopts += "export PYTHONPATH=%(installdir)s/lib/python%(pyshortver)s/site-packages:$PYTHONPATH && "

modextrapaths = {'PYTHONPATH': ['lib/python%(pyshortver)s/site-packages']}

sanity_check_paths = {
    'files': [
        'bin/vtk%s-%%(version_major_minor)s' %
        x for x in [
            'EncodeString',
            'HashSource']],
    'dirs': [
        'lib/python%(pyshortver)s/site-packages/',
        'include/vtk-%(version_major_minor)s'],
}

sanity_check_commands = [('python', "-c 'import %(namelower)s'")]

moduleclass = 'vis'
