#!/usr/bin/python3

"""
Setup for SWIG Python bindings for constraint_grammar
"""
from distutils.core import Extension, setup
from sys import platform

compile_args = '${BUILD_DEFS} ${CMAKE_CXX_FLAGS}'.split()
link_args = []
if platform == 'darwin':
    compile_args += ['-stdlib=libc++', '-mmacosx-version-min=10.10']
    link_args.append('-mmacosx-version-min=10.10')

constraint_grammar_module = Extension(
    name='_constraint_grammar',
    sources=['constraint_grammar.i'],
    swig_opts = ['-c++', '-I/usr/include', '-I${CMAKE_SOURCE_DIR}', '-I${CMAKE_SOURCE_DIR}/src', '-I${CMAKE_SOURCE_DIR}/include', '-Wall'],
    include_dirs=['${CMAKE_SOURCE_DIR}', '${CMAKE_SOURCE_DIR}/src', '${CMAKE_SOURCE_DIR}/include', '${CMAKE_SOURCE_DIR}/include/posix'],
    library_dirs=['${CMAKE_BINARY_DIR}/src'],
    libraries=['cg3', 'icuuc', 'icuio', 'icui18n'],
    extra_compile_args=compile_args,
    extra_link_args=link_args,
)

setup(
    name='constraint_grammar',
    version='${VERSION}',
    description='SWIG interface to CG-3',
    long_description='SWIG interface to CG-3 for use in apertium-python',
    # TODO: author, author_email, maintainer, url
    license='GPL-3.0+',
    ext_modules=[constraint_grammar_module],
    py_modules=['constraint_grammar', 'cg3'],
)
