#This is the configuration file for the BigDFT installer
#This is a python script which is executed by the build suite

#Add the condition testing to run tests and includes PyYaml
conditions.add("bio")
conditions.add("ase")
conditions.add("python")
conditions.add("sirius")
conditions.add("devdoc")
conditions.add("simulation")
conditions.add("dill")
conditions.add("boost")
#List the module the this rcfile will build
modules = ['spred',]
#example of the potentialities of the python syntax in this file
def env_configuration():
    return  """ FCFLAGS="-I${MKLROOT}/include -O2 -fPIC -qopenmp -g" FC="mpif90 -fc=ifort" CC=icc CFLAGS=-fPIC --with-ext-linalg="-L${MKLROOT}/lib/intel64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_lp64 -liomp5 -lpthread -lm -ldl -lstdc++" --with-gobject=yes  --enable-dynamic-libraries CXX=icpc"""
#the following command sets the environment variable to give these settings
#to all the modules
import os
os.environ['BIGDFT_CONFIGURE_FLAGS']=env_configuration()
#here follow the configuration instructions for the modules built
#we specify the configurations for the modules to customize the options if needed
autogenargs = env_configuration()
os.environ['PYGOBJECT_WITHOUT_PYCAIRO']='1'
module_autogenargs.update({
'biopython': "", 'simtk': "", 'pdbfixer': "", 'ase': "", 'dill': "", 'libffi': "CC=gcc",
'gobject-introspection': "PYTHON=python3", 'dnaviewer': "", 'lsim-f2py': "",
'pygobject':""
})

module_cmakeargs.update({
    'ntpoly': "-DFORTRAN_ONLY=Yes -DCMAKE_Fortran_COMPILER='mpiifort' -DCMAKE_Fortran_FLAGS_RELEASE='-O2 -g -qopenmp -fPIC' -DBUILD_SHARED_LIBS=Yes",
    'rdkit': "-DPYTHON_EXECUTABLE=/opt/intel/oneapi/intelpython/latest/bin/python -DPYTHON_LIBRARY=/opt/intel/oneapi/intelpython/latest/lib -DPYTHON_INCLUDE_DIR=/opt/intel/oneapi/intelpython/latest/include/python3.9"
})

module_cmakeargs['spfft'] = "-DCMAKE_CXX_COMPILER=mpiicpc -DCMAKE_BUILD_TYPE=RELEASE -DSPFFT_SINGLE_PRECISION=OFF -DSPFFT_MPI=ON -DSPFFT_OMP=ON " # -DSPFFT_STATIC=ON " # -DSPFFT_GPU_BACKEND=CUDA  -DCMAKE_CUDA_COMPILER=/usr/local/cuda-10.1/bin/nvcc -DCMAKE_CUDA_FLAGS=-ccbin=gcc-8
module_autogenargs['gsl'] = env_configuration()
module_autogenargs['hdf5'] = env_configuration() + " --enable-fortran --disable-deprecated-symbols --disable-filters --disable-parallel --with-zlib=no --with-szlib=no" #--disable-shared --enable-static=yes
module_cmakeargs['sirius'] = "-DUSE_MKL=ON -DMKL_DEF_LIBRARY=${MKLROOT}/lib/intel64"

prefix='/opt/core-upstream'
extra_prefixes=['/opt/client-upstream']
