from setuptools import setup, Extension
from Cython.Build import cythonize
import numpy as np

extensions = [
    Extension('constants_inf', ['constants_inf.pyx']),
    Extension('ai_availability_status', ['ai_availability_status.pyx']),
    Extension('annotation', ['annotation.pyx']),
    Extension('ai_config', ['ai_config.pyx']),
    Extension('loader_http_client', ['loader_http_client.pyx']),
    Extension('engines.inference_engine', ['engines/inference_engine.pyx'], include_dirs=[np.get_include()]),
    Extension('engines.onnx_engine', ['engines/onnx_engine.pyx'], include_dirs=[np.get_include()]),
    Extension('engines.coreml_engine', ['engines/coreml_engine.pyx'], include_dirs=[np.get_include()]),
    Extension('inference', ['inference.pyx'], include_dirs=[np.get_include()]),
]

try:
    import tensorrt  # pyright: ignore[reportMissingImports]
    extensions.append(
        Extension('engines.tensorrt_engine', ['engines/tensorrt_engine.pyx'], include_dirs=[np.get_include()])
    )
except ImportError:
    pass

setup(
    name="azaion.detections",
    ext_modules=cythonize(
        extensions,
        compiler_directives={
            "language_level": 3,
            "emit_code_comments": False,
            "binding": True,
            'boundscheck': False,
            'wraparound': False,
        }
    ),
    zip_safe=False
)
