from setuptools import setup, find_packages

# Available at setup time due to pyproject.toml
from pybind11.setup_helpers import Pybind11Extension, build_ext

__version__ = "1.1.1"

# The main interface is through Pybind11Extension.
# * You can add cxx_std=11/14/17, and then build_ext can be removed.
# * You can set include_pybind11=false to add the include directory yourself,
#   say from a submodule.
#
# Note:
#   Sort input source files if you glob sources to ensure bit-for-bit
#   reproducible builds (https://github.com/pybind/python_example/pull/53)

ext_modules = [
    Pybind11Extension("_pysilk",
                      ["src/_pysilk.cpp", "src/codec.cpp",
                       "src/silk/src/SKP_Silk_A2NLSF.c",
                       "src/silk/src/SKP_Silk_ana_filt_bank_1.c",
                       "src/silk/src/SKP_Silk_apply_sine_window.c",
                       "src/silk/src/SKP_Silk_array_maxabs.c",
                       "src/silk/src/SKP_Silk_autocorr.c",
                       "src/silk/src/SKP_Silk_biquad.c",
                       "src/silk/src/SKP_Silk_biquad_alt.c",
                       "src/silk/src/SKP_Silk_burg_modified.c",
                       "src/silk/src/SKP_Silk_bwexpander.c",
                       "src/silk/src/SKP_Silk_bwexpander_32.c",
                       "src/silk/src/SKP_Silk_CNG.c",
                       "src/silk/src/SKP_Silk_code_signs.c",
                       "src/silk/src/SKP_Silk_control_audio_bandwidth.c",
                       "src/silk/src/SKP_Silk_control_codec_FIX.c",
                       "src/silk/src/SKP_Silk_corrMatrix_FIX.c",
                       "src/silk/src/SKP_Silk_create_init_destroy.c",
                       "src/silk/src/SKP_Silk_dec_API.c",
                       "src/silk/src/SKP_Silk_decode_core.c",
                       "src/silk/src/SKP_Silk_decode_frame.c",
                       "src/silk/src/SKP_Silk_decode_parameters.c",
                       "src/silk/src/SKP_Silk_decode_pitch.c",
                       "src/silk/src/SKP_Silk_decode_pulses.c",
                       "src/silk/src/SKP_Silk_decoder_set_fs.c",
                       "src/silk/src/SKP_Silk_detect_SWB_input.c",
                       "src/silk/src/SKP_Silk_div_oabi.c",
                       "src/silk/src/SKP_Silk_enc_API.c",
                       "src/silk/src/SKP_Silk_encode_frame_FIX.c",
                       "src/silk/src/SKP_Silk_encode_parameters.c",
                       "src/silk/src/SKP_Silk_encode_pulses.c",
                       "src/silk/src/SKP_Silk_find_LPC_FIX.c",
                       "src/silk/src/SKP_Silk_find_LTP_FIX.c",
                       "src/silk/src/SKP_Silk_find_pitch_lags_FIX.c",
                       "src/silk/src/SKP_Silk_find_pred_coefs_FIX.c",
                       "src/silk/src/SKP_Silk_gain_quant.c",
                       "src/silk/src/SKP_Silk_HP_variable_cutoff_FIX.c",
                       "src/silk/src/SKP_Silk_init_encoder_FIX.c",
                       "src/silk/src/SKP_Silk_inner_prod_aligned.c",
                       "src/silk/src/SKP_Silk_interpolate.c",
                       "src/silk/src/SKP_Silk_k2a.c",
                       "src/silk/src/SKP_Silk_k2a_Q16.c",
                       "src/silk/src/SKP_Silk_LBRR_reset.c",
                       "src/silk/src/SKP_Silk_lin2log.c",
                       "src/silk/src/SKP_Silk_log2lin.c",
                       "src/silk/src/SKP_Silk_LP_variable_cutoff.c",
                       "src/silk/src/SKP_Silk_LPC_inv_pred_gain.c",
                       "src/silk/src/SKP_Silk_LPC_synthesis_filter.c",
                       "src/silk/src/SKP_Silk_LPC_synthesis_order16.c",
                       "src/silk/src/SKP_Silk_LSF_cos_table.c",
                       "src/silk/src/SKP_Silk_LTP_analysis_filter_FIX.c",
                       "src/silk/src/SKP_Silk_LTP_scale_ctrl_FIX.c",
                       "src/silk/src/SKP_Silk_MA.c",
                       "src/silk/src/SKP_Silk_NLSF2A.c",
                       "src/silk/src/SKP_Silk_NLSF2A_stable.c",
                       "src/silk/src/SKP_Silk_NLSF_MSVQ_decode.c",
                       "src/silk/src/SKP_Silk_NLSF_MSVQ_encode_FIX.c",
                       "src/silk/src/SKP_Silk_NLSF_stabilize.c",
                       "src/silk/src/SKP_Silk_NLSF_VQ_rate_distortion_FIX.c",
                       "src/silk/src/SKP_Silk_NLSF_VQ_sum_error_FIX.c",
                       "src/silk/src/SKP_Silk_NLSF_VQ_weights_laroia.c",
                       "src/silk/src/SKP_Silk_noise_shape_analysis_FIX.c",
                       "src/silk/src/SKP_Silk_NSQ.c",
                       "src/silk/src/SKP_Silk_NSQ_del_dec.c",
                       "src/silk/src/SKP_Silk_pitch_analysis_core.c",
                       "src/silk/src/SKP_Silk_pitch_est_tables.c",
                       "src/silk/src/SKP_Silk_PLC.c",
                       "src/silk/src/SKP_Silk_prefilter_FIX.c",
                       "src/silk/src/SKP_Silk_process_gains_FIX.c",
                       "src/silk/src/SKP_Silk_process_NLSFs_FIX.c",
                       "src/silk/src/SKP_Silk_quant_LTP_gains_FIX.c",
                       "src/silk/src/SKP_Silk_range_coder.c",
                       "src/silk/src/SKP_Silk_regularize_correlations_FIX.c",
                       "src/silk/src/SKP_Silk_resampler.c",
                       "src/silk/src/SKP_Silk_resampler_down2.c",
                       "src/silk/src/SKP_Silk_resampler_down2_3.c",
                       "src/silk/src/SKP_Silk_resampler_down3.c",
                       "src/silk/src/SKP_Silk_resampler_private_AR2.c",
                       "src/silk/src/SKP_Silk_resampler_private_ARMA4.c",
                       "src/silk/src/SKP_Silk_resampler_private_copy.c",
                       "src/silk/src/SKP_Silk_resampler_private_down4.c",
                       "src/silk/src/SKP_Silk_resampler_private_down_FIR.c",
                       "src/silk/src/SKP_Silk_resampler_private_IIR_FIR.c",
                       "src/silk/src/SKP_Silk_resampler_private_up2_HQ.c",
                       "src/silk/src/SKP_Silk_resampler_private_up4.c",
                       "src/silk/src/SKP_Silk_resampler_rom.c",
                       "src/silk/src/SKP_Silk_resampler_up2.c",
                       "src/silk/src/SKP_Silk_residual_energy16_FIX.c",
                       "src/silk/src/SKP_Silk_residual_energy_FIX.c",
                       "src/silk/src/SKP_Silk_scale_copy_vector16.c",
                       "src/silk/src/SKP_Silk_scale_vector.c",
                       "src/silk/src/SKP_Silk_schur.c",
                       "src/silk/src/SKP_Silk_schur64.c",
                       "src/silk/src/SKP_Silk_shell_coder.c",
                       "src/silk/src/SKP_Silk_sigm_Q15.c",
                       "src/silk/src/SKP_Silk_solve_LS_FIX.c",
                       "src/silk/src/SKP_Silk_sort.c",
                       "src/silk/src/SKP_Silk_sum_sqr_shift.c",
                       "src/silk/src/SKP_Silk_tables_gain.c",
                       "src/silk/src/SKP_Silk_tables_LTP.c",
                       "src/silk/src/SKP_Silk_tables_NLSF_CB0_10.c",
                       "src/silk/src/SKP_Silk_tables_NLSF_CB0_16.c",
                       "src/silk/src/SKP_Silk_tables_NLSF_CB1_10.c",
                       "src/silk/src/SKP_Silk_tables_NLSF_CB1_16.c",
                       "src/silk/src/SKP_Silk_tables_other.c",
                       "src/silk/src/SKP_Silk_tables_pitch_lag.c",
                       "src/silk/src/SKP_Silk_tables_pulses_per_block.c",
                       "src/silk/src/SKP_Silk_tables_sign.c",
                       "src/silk/src/SKP_Silk_tables_type_offset.c",
                       "src/silk/src/SKP_Silk_VAD.c",
                       "src/silk/src/SKP_Silk_VQ_nearest_neighbor_FIX.c",
                       "src/silk/src/SKP_Silk_warped_autocorrelation_FIX.c"
                       ],

                      include_dirs=[
                          "src/silk/interface",
                          "src/silk/src"
                      ],
                      # Example: passing in the version to the compiled code
                      define_macros=[('VERSION_INFO', __version__)],
                      )
]

setup(
    name="pysilk-mod",
    version=__version__,
    author="DCZYewen",
    author_email="contact@basicws.net",
    url="https://github.com/DCZYewen/Python-Silk-Module",
    description="Python silk decode/encoder bindings using pybind11",
    long_description="",
    packages=find_packages(),
    ext_modules=ext_modules,
    extras_require={"test": "pytest"},
    # Currently, build_ext only provides an optional "highest supported C++
    # level" feature, but in the future it may provide more features.
    cmdclass={"build_ext": build_ext},
    zip_safe=False
)
