easyblock = 'CMakeMake'

name = 'Yade'
version = '1.20.0'
versionsuffix = '-Python-%(local_pyver)s'

homepage = 'https://yade-dem.org/doc/'
description = """ Yade is an extensible open-source framework for discrete numerical models,
 focused on Discrete Element Method. The local_computation parts are written in c++ using flexible object model,
 allowing independent implementation of new alogrithms and interfaces.
 Python is used for rapid and concise scene construction, simulation control, postprocessing and debugging. """

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

source_urls = ['https://launchpad.net/yade/trunk/yade-1.00.0/+download/']
sources = [SOURCELOWER_TAR_GZ]

local_mesaver = '11.2.1'
dependencies = [
    ('Boost', '1.60.0', versionsuffix),
    ('CGAL', '4.8', versionsuffix),
    ('Eigen', '3.2.7'),
    ('GDB', '7.10.1', versionsuffix),
    ('GL2PS', '1.3.9', '-Mesa-%s' % local_mesaver),
    ('GTS', '0.7.6'),
    ('IPython', '3.2.3', versionsuffix),
    ('libQGLViewer', '2.6.3', '-Mesa-%s' % local_mesaver),
    ('Loki', '0.1.7'),
    ('matplotlib', '1.5.1', versionsuffix + '-freetype-2.6.3'),
    ('minieigen', '0.5.3', versionsuffix),
    ('PyGTS', '0.3.1', versionsuffix),
    ('Python', '2.7.11'),
    ('Qt', '4.8.7', '-GLib-2.48.0'),
    ('SQLite', '3.9.2'),
    ('VTK', '6.3.0', versionsuffix),
    ('zlib', '1.2.8'),
]

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

separate_build_dir = True

configopts = '-DENABLE_GUI=OFF -DENABLE_LINSOLV=OFF -DENABLE_PFVFLOW=OFF '
configopts += '-DCGAL_INCLUDE_DIR=$EBROOTCGAL/include '
configopts += '-DGMP_INCLUDE_DIR=$EBROOTGMP/include -DGMP_LIBRARIES=$EBROOTGMP/lib -DGMPXX_LIBRARIES=$EBROOTGMP/lib '

modextrapaths = {
    'LD_LIBRARY_PATH': [
        'lib64/lib64/yade-%(version)s',
        'lib/x86_64-linux-gnu/yade-%(version)s'],
    'LIBRARY_PATH': [
        'lib64/lib64/yade-%(version)s',
        'lib/x86_64-linux-gnu/yade-%(version)s'],
    'PYTHONPATH': [
        'lib/x86_64-linux-gnu/yade-%(version)s/py',
        'lib64/yade-%(version)s/py'],
}

sanity_check_paths = {
    'files': [
        'bin/yade-%(version)s',
        'bin/yade-%(version)s-batch',
        ('lib/x86_64-linux-gnu/yade-%%(version)s/libyade.%s' %
         SHLIB_EXT,
         'lib64/yade-%%(version)s/libyade.%s' %
         SHLIB_EXT)],
    'dirs': [
        ('lib/x86_64-linux-gnu/yade-%(version)s/py/yade',
         'lib64/yade-%(version)s/py/yade')],
}

moduleclass = 'devel'
