from buildutils import *

Import('env', 'build', 'install')

localenv = env.Clone()
localenv.Prepend(CPPPATH=['#include', '#src'])

f90_src = mglob(localenv, '.', 'f90', 'cpp')

artifacts = localenv.Object(f90_src,
                            F90PATH=['#build/src/fortran'])
mods = [o for o in artifacts if o.path.endswith('.mod')]
objects = [o for o in artifacts if not o.path.endswith('.mod')]

lib = build(localenv.Library(target=pjoin('..','..','lib','cantera_fortran'),
                             source=objects))

install('$inst_libdir', lib)
install('$inst_incdir', mods)
#
#  We are only building the static fortran library here. This is probably ok
#
