#!/usr/bin/env python

Import('env')
Import('env_modules')

env_speex = env_modules.Clone()

# Thirdparty source files
if (env['builtin_speex'] != 'no'):
    thirdparty_dir = "#thirdparty/speex/"

    thirdparty_sources = [
        "bits.c",
        "buffer.c",
        "cb_search.c",
        "exc_10_16_table.c",
        "exc_10_32_table.c",
        "exc_20_32_table.c",
        "exc_5_256_table.c",
        "exc_5_64_table.c",
        "exc_8_128_table.c",
        "fftwrap.c",
        "filterbank.c",
        "filters.c",
        "gain_table.c",
        "gain_table_lbr.c",
        "hexc_10_32_table.c",
        "hexc_table.c",
        "high_lsp_tables.c",
        "jitter.c",
        "kiss_fft.c",
        "kiss_fftr.c",
        "lpc.c",
        "lsp.c",
        "lsp_tables_nb.c",
        "ltp.c",
        "mdf.c",
        "modes.c",
        "modes_wb.c",
        "nb_celp.c",
        "preprocess.c",
        "quant_lsp.c",
        "resample.c",
        "sb_celp.c",
        "scal.c",
        "smallft.c",
        "speex.c",
        "speex_callbacks.c",
        "speex_header.c",
        "stereo.c",
        "vbr.c",
        "vq.c",
        "window.c",
    ]

    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]

    env_speex.add_source_files(env.modules_sources, thirdparty_sources)
    env_speex.Append(CPPPATH=[thirdparty_dir])

    # also requires libogg
    if (env['builtin_libogg'] != 'no'):
        env_speex.Append(CPPPATH=["#thirdparty/libogg"])

# Module files
env_speex.add_source_files(env.modules_sources, "*.cpp")
