import wx
import sys

import wx.build.config
wx.build.config.USE_SWIG = True
wx.build.config.SWIG = "/usr/local/swig-1.3.29/bin/swig"

from wx.build.config import *
from os.path import join as pj
from os.path import dirname

from distutils.sysconfig import get_python_lib

# wxdir should really be set in the environment...
print 'path to wx (from WXWIN env var):', WXDIR


includes += [
    '%s\\include' % WXPY_SRC,
    '%s\\..\\include' % WXPY_SRC,
    pj(WXPY_SRC, 'lib', 'vc90_dll', 'mswu'),
    pj(get_python_lib(), 'numpy', 'core', 'include')
]

libdirs += [
    pj(WXPY_SRC, 'lib', 'vc90_dll')
]

swig_sources = run_swig(['fastlines.i'], '', '.', '.',
                        USE_SWIG, swig_force, swig_args, swig_deps)

# common args to distuils.Extension
extopts = dict(include_dirs       = includes,
               define_macros      = defines,
               library_dirs       = libdirs,
               libraries          = libs,

               extra_compile_args = cflags,
               extra_link_args    = lflags,

               swig_opts = swig_args,
               language = 'c++',)


def simpleExt(name, path = './'):
    return Extension('_%s' % name, ['%s%s.cpp' % (path, name), '%s%s_wrap.cpp' % (path, name)], **extopts)

setup(ext_modules = [simpleExt('fastlines')])
