easyblock = 'CMakeMake'

name = 'Embree'
version = '3.8.0'
versionsuffix = '-opengl'

homepage = 'http://www.ospray.org/'
description = """
Embree is a collection of high-performance ray tracing kernels, developed at Intel. The target user of Embree are
graphics application engineers that want to improve the performance of their application by leveraging the optimized ray
tracing kernels of Embree. The kernels are optimized for photo-realistic rendering on the latest Intel processors with
support for SSE, AVX, AVX2, and AVX512.
"""

site_contacts = 'sc@fz-juelich.de'

toolchain = {'name': 'GCC', 'version': '8.3.0'}
toolchainopts = {'optarch': True, 'pic': True}

source_urls = ['https://github.com/embree/embree/archive/']
sources = ['v%(version)s.tar.gz']

builddependencies = [
    ('CMake', '3.14.0'),
    ('pkg-config', '0.29.2'),
    ('ispc','1.12.0','',True),
]

dependencies = [
    ('X11','20190311'),
    ('OpenGL','2019a'),
    ('freeglut','3.2.1','-opengl'),
    ('libpng', '1.6.36'),
    ('libjpeg-turbo','2.0.2'),
    ('ImageMagick','7.0.8-37','-opengl'), # 7.x doesn't have MaxRGB, which is needed by Embree 2.17
    ('OpenEXR','2.3.0'),
    ('tbb','2019.4.199','',True),
]

separate_build_dir = True

configopts  = '-DCMAKE_BUILD_TYPE=Release ' # Default
configopts += '-DEMBREE_ISPC_SUPPORT=ON ' # Default
configopts += '-DEMBREE_TASKING_SYSTEM=TBB ' # Default
configopts += '-DEMBREE_TBB_ROOT=$EBROOTTBB/tbb '
configopts += '-DEMBREE_MAX_ISA=AVX2 ' # Select highest supported ISA (SSE2, SSE4.2, AVX, AVX2, AVX512KNL, AVX512SKX, or NONE)
configopts += '-DEMBREE_TUTORIALS=OFF '

sanity_check_paths = {
    'dirs': ['include/embree3'],
    'files': ['lib64/libembree3.so']
}

modextrapaths = {
    'CMAKE_MODULE_PATH': 'lib64/cmake/embree-%(version)s/'
}

moduleclass = 'vis'