#! /usr/bin/env python

from distutils.core import setup, Extension

longdesc = """This is a simple SWIG wrapper on C++ fastNLO Reader interface."""

## Extension definition
import os
wrapsrc = '@srcdir@/fastnlo_wrap.cc'
incdir_src = os.path.abspath('@top_srcdir@/include')
incdir_build = os.path.abspath('@top_builddir@/fastnlotoolkit/include')
libdir = os.path.abspath('@top_builddir@/fastnlotoolkit')

incdir_lhapdf = '@LHAPDFINCLUDEPATH@'
libdir_lhapdf = '@LHAPDFLIBPATH@'
libdir_fnlo = '@prefix@/lib'

## Add -std=gnu++11 explicitly to work around issue on Centos7
cxxargs = '@CXXFLAGS@ -std=gnu++11'.split()
ldargs = '@LDFLAGS@'.split()
ext = Extension('_fastnlo',
                [wrapsrc],
                include_dirs=[incdir_src, incdir_build,incdir_lhapdf],
                library_dirs=[libdir,libdir_lhapdf, os.path.join(libdir,'.libs')],
                runtime_library_dirs=[libdir_lhapdf,libdir_fnlo],
                extra_compile_args = cxxargs,
                extra_link_args = ldargs,
                libraries=['fastnlotoolkit','LHAPDF'],
                )

## Setup definition
setup(name = 'fastnlo',
      version = '@PACKAGE_VERSION@',
      #include_package_data = True,
      ext_modules=[ext],
      py_modules = ['fastnlo'],
      author = ['fastNLO'],
      url = 'http://projects.hepforge.org/fastnlo/',
      description = 'A SWIG wrapper on C++ fastNLO interface.',
      long_description = longdesc,
      )
