# IT4Innovations
# LK 2022

easyblock = 'CMakeMake'

name = 'hipSYCL'
version = '0.9.2'

homepage = 'https://github.com/illuhad/hipSYCL'
description = """hipSYCL is a modern SYCL implementation targeting CPUs and
GPUs, with a focus on leveraging existing toolchains such as CUDA or HIP"""

toolchain = {'name': 'gcccuda', 'version': '2020b'}

source_urls = ["https://github.com/illuhad/hipSYCL/archive/refs/tags/"]
sources = ["v%(version)s.tar.gz"]
checksums = ['46a01d7f3e3cf7ae1ca0b45d72b61d96']
patches = ["hipSYCL-0.9.2-filter-cuda-stubs-rpath.patch"]

dependencies = [
    ('Boost', '1.74.0'),
    ('Clang', '11.0.1'),
    ('Python', '3.8.6'),
]

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

configopts = '-DCMAKE_C_COMPILER="$EBROOTCLANG/bin/clang" '
configopts += '-DCMAKE_CXX_COMPILER="$EBROOTCLANG/bin/clang++" '
configopts += '-DLLVM_DIR=$EBROOTCLANG '
configopts += '-DCLANG_EXECUTABLE_PATH=$EBROOTCLANG/bin/clang++ '
configopts += '-DWITH_CPU_BACKEND=ON '
configopts += '-DWITH_CUDA_BACKEND=ON '
configopts += '-DWITH_ROCM_BACKEND=OFF '

sanity_check_paths = {
    'files': ['bin/syclcc-clang', 'include/sycl/sycl.hpp',
              'lib/hipSYCL/librt-backend-omp.%s' % SHLIB_EXT,
              'lib/hipSYCL/librt-backend-cuda.%s' % SHLIB_EXT,
              'lib/libhipSYCL_clang.%s' % SHLIB_EXT,
              'lib/libhipSYCL-rt.%s' % SHLIB_EXT],
    'dirs': ['include/CL', 'include/hipSYCL', 'include/SYCL', 'lib'],
}

sanity_check_commands = ['syclcc --help']

moduleclass = 'compiler'
