name = 'ESMF'
version = '7.0.1'
versionsuffix = '-netCDF-4.4.1.1'

homepage = 'http://sourceforge.net/projects/esmf'
description = """The Earth System Modeling Framework (ESMF) is software for building and coupling weather,
 climate, and related models."""

toolchain = {'name': 'intel', 'version': '2018'}
toolchainopts = {'usempi': True}

source_urls = [SOURCEFORGE_SOURCE]
sources = ['%%(namelower)s_%s_src.tar.gz' % '_'.join(version.split('.'))]

patches = [
    'ESMF-6.1.1_libopts.patch',
    'ESMF-6.3.0rp1_fix-file-open-test.patch',
]

dependencies = [
    ('netCDF', '4.4.1.1'),
    ('netCDF-Fortran', '4.4.4', versionsuffix),
    ('netCDF-C++4', '4.3.0'),
]

buildopts = 'ESMF_NETCDF_INCLUDE=$EBROOTNETCDFMINFORTRAN/include '
buildopts += 'ESMF_F90COMPILEOPTS="-O -fPIC -m64 -mcmodel=small -threads -qopenmp" '
buildopts += 'ESMF_F90LINKOPTS="-m64 -mcmodel=small -threads -Wl,--no-as-needed -qopenmp" '
buildopts += 'ESMF_CXXCOMPILEOPTS="-O -DNDEBUG -fPIC -m64 -mcmodel=small -pthread -qopenmp" '
buildopts += 'ESMF_CXXLINKOPTS="-m64 -mcmodel=small -pthread -Wl,--no-as-needed -qopenmp" '
buildopts += 'ESMF_SL_LIBOPTS="-O -DNDEBUG -fPIC -m64 -mcmodel=small -pthread -qopenmp -shared" '
buildopts += 'ESMF_NETCDF_LIBS="`nc-config --libs` `nf-config --flibs` `ncxx4-config --libs`"'

installopts = 'ESMF_F90COMPILEOPTS="-O -fPIC -m64 -mcmodel=small -threads -qopenmp" '
installopts += 'ESMF_F90LINKOPTS="-m64 -mcmodel=small -threads -Wl,--no-as-needed -qopenmp" '
installopts += 'ESMF_CXXCOMPILEOPTS="-O -DNDEBUG -fPIC -m64 -mcmodel=small -pthread -qopenmp" '
installopts += 'ESMF_CXXLINKOPTS="-m64 -mcmodel=small -pthread -Wl,--no-as-needed -qopenmp" '
installopts += 'ESMF_SL_LIBOPTS="-O -DNDEBUG -fPIC -m64 -mcmodel=small -pthread -qopenmp -shared" '

# too parallel causes the build to become really slow
maxparallel = 8

moduleclass = 'geo'
