# IT4Innovations
# LK 2023

easyblock = 'CMakeMake'

name = 'ParaView'
version = '5.11.0'
versionsuffix = '-mpi'

homepage = 'https://www.paraview.org'
description = "ParaView is a scientific parallel visualizer."

toolchain = {'name': 'intel', 'version': '2022b'}
toolchainopts = {'pic': True, 'usempi': True}

local_download_suffix = 'download.php?submit=Download&version=v%(version_major_minor)s&type=source&os=all&downloadFile='
source_urls = ['https://www.paraview.org/paraview-downloads/%s' % local_download_suffix]
sources = ["%(name)s-v%(version)s.tar.gz"]
checksums = ['68b1c6d15dd67ec442f964460c56212417e8af2a96763001f8548eb3cbc5ce87']

builddependencies = [('CMake', '3.24.3')]

dependencies = [
    ('Python', '3.10.8'),
    ('XZ', '5.2.7'),
    ('HDF5', '1.14.0'),
 #   ('netCDF', '4.9.0'),
    ('libGLU', '9.0.2'),
    ('X11', '20221110'),
    ('Mesa', '22.2.4'),
    ('Qt5', '5.15.7'),
    ('zlib', '1.2.12'),
    ('FFmpeg', '5.1.2'),
    ('Szip', '2.1.1'),
]

# Paraview
configopts = '-DPARAVIEW_INSTALL_DEVELOPMENT_FILES=ON -DPARAVIEW_BUILD_SHARED_LIBS=ON '
configopts += '-DPARAVIEW_USE_MPI=ON '
configopts += '-DPARAVIEW_ENABLE_FFMPEG=ON '
configopts += '-DPARAVIEW_USE_PYTHON=ON '
configopts += '-DPython3_ROOT_DIR=$EBROOTPYTHON '

# OpenGL & Mesa
configopts += '-DOPENGL_glu_LIBRARY=$EBROOTLIBGLU/lib/libGLU.%s ' % SHLIB_EXT
configopts += '-DOPENGL_INCLUDE_DIR=$EBROOTMESA/include '

sanity_check_paths = {
    'files': ['bin/paraview', 'bin/pvpython'],
    'dirs': ['include/paraview-%(version_major_minor)s', 'lib/python%(pyshortver)s/site-packages'],
}

sanity_check_commands = ['python -c "import paraview"']

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

moduleclass = 'vis'
