# IT4Innovations 2019

easyblock = 'CMakeMake'

name = 'Blender'
version = '2.81'
versionsuffix = '-Py-3.7'

homepage = 'https://www.blender.org/'
description = """Blender is the free and open source 3D creation suite. It supports
 the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering,
 compositing and motion tracking, even video editing and game creation."""

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

source_urls = ['https://download.blender.org/source/']
sources = [SOURCELOWER_TAR_XZ]
checksums = ['ca429da7bf0f1e9ce39c915288cfa2b76ed7ec36885139c4d7c18912840337df']

# disable SSE detection to give EasyBuild full control over optimization compiler flags being used
configopts = '-DWITH_CPU_SSE=OFF -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" '

# these are needed until extra dependencies are added for them to work
configopts += '-DWITH_INSTALL_PORTABLE=OFF '
configopts += '-DWITH_BUILDINFO=OFF '
configopts += '-DWITH_GAMEENGINE=OFF '
configopts += '-DWITH_SYSTEM_GLEW=OFF '

# Python paths
configopts += '-DPYTHON_VERSION=3.7 PYTHON_LIBRARY=${EBROOTPYTHON}/lib/libpython3.7m.so '
configopts += '-DPYTHON_INCLUDE_DIR=${EBROOTPYTHON}/include/python3.7m '
configopts += '-DOPENEXR_INCLUDE_DIR=$EBROOTOPENEXR/include '

dependencies = [
    ('Py', '3.7', '', True),
#    ('SciPy-bundle', '2019.10', versionsuffix),
    ('Boost', '1.68.0'),
    ('libjpeg-turbo', '2.0.2', '', True),
    ('zlib', '1.2.11', '', True),
    ('X11', '20190311', '', True),
    ('Mesa', '18.3.1', '', True),
    ('libGLU', '9.0.0', '', True),
    ('OpenImageIO', '2.0.12'),  # required for cycles render engine
]

builddependencies = [('CMake', '3.16.0', '-rc3', True)]

separate_build_dir = 'True'

# use Intel software rasterizer by default (no GPU hardware acceleration)
modextravars = {'GALLIUM_DRIVER': 'swr'}

sanity_check_paths = {
    'files': ['bin/blender'],
    'dirs': []
}

moduleclass = 'vis'
