# based on https://github.com/easybuilders/easybuild-easyconfigs/pull/12275/commits/4ee39c881caa7638c4c9ddd08b967608f844e90c
# JK 2022

easyblock = 'CMakeMake'

name = 'Dakota'
version = '6.15.0'

homepage = 'https://dakota.sandia.gov'
description = """The Dakota project delivers both state-of-the-art research and robust, usable software for optimization and UQ. Broadly, the Dakota software's advanced parametric analyses enable design exploration, model calibration, risk analysis, and quantification of margins and uncertainty with computational models."""

toolchain = {'name': 'intel', 'version': '2021b'}
toolchainopts = {'pic': True, 'usempi': True, 'opt': False}

sources = ['%(namelower)s-%(version)s-public-src-cli.tar.gz']
source_urls = ['https://dakota.sandia.gov/sites/default/files/distributions/public/']
checksums = [
   'b6d971b7d6fe913aa64fef29cf8fcf55d0e5339f9f55fb164e3cc38716b48f61',
   '6bc07bddfe1fa058184bab592b5a68db71c43f42662493b22417659cfbf0b701',
]
patches = ['Dakota-6.15.0-fix_lapack_detection.patch']

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

dependencies = [
    ('HDF5', '1.12.1', '-parallel'),
    ('Python', '3.9.6'),
    ('Perl', '5.34.0'),
    ('GSL', '2.7'),
    ('Boost', '1.77.0'),
]

# build shared libraries
configopts = "-DBUILD_SHARED_LIBS=ON "
# set other dependencies
configopts += "-DDAKOTA_HAVE_MPI=ON "
configopts += "-DBoost_NO_SYSTEM_PATHS=ON "
configopts += "-DDAKOTA_HAVE_HDF5=ON "
configopts += "-DDAKOTA_HAVE_GSL=ON "

runtest = ' test ARGS="-L AcceptanceTest -j %(parallel)s"'

# Run install step in parallel
installopts = ' -j %(parallel)s'

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

moduleclass = 'math'
