package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_av_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_av_license"],
}

cc_defaults {
    name: "libaudioprocessing_defaults",

    export_include_dirs: ["include"],

    header_libs: ["libaudioclient_headers"],

    shared_libs: [
        "libaudioutils",
        "libcutils",
        "liblog",
        "libutils",
    ],

    cflags: [
        "-Wall",

        // uncomment to disable NEON on architectures that actually do support NEON, for benchmarking

        "-Werror",
        // "-DUSE_NEON=false",
    ],

    arch: {
        x86: {
            avx2: {
                cflags: [
                    "-mavx2",
                    "-mfma",
                ],
            },
        },
        x86_64: {
            avx2: {
                cflags: [
                    "-mavx2",
                    "-mfma",
                ],
            },
        },
    },
}

cc_library_shared {
    name: "libaudioprocessing",
    defaults: ["libaudioprocessing_defaults"],

    srcs: [
        "AudioMixer.cpp",
        "BufferProviders.cpp",
        "RecordBufferConverter.cpp",
    ],

    header_libs: [
        "libaudiohal_headers",
        "libbase_headers",
        "libmedia_headers",
    ],

    shared_libs: [
        "libaudiohal",
        "libsonic",
        "libvibrator",
    ],

    whole_static_libs: ["libaudioprocessing_base"],

    export_shared_lib_headers: [
        "libvibrator",
    ],
}

cc_library_static {
    name: "libaudioprocessing_base",
    defaults: ["libaudioprocessing_defaults"],
    vendor_available: true,

    srcs: [
        "AudioMixerBase.cpp",
        "AudioResampler.cpp",
        "AudioResamplerCubic.cpp",
        "AudioResamplerDyn.cpp",
        "AudioResamplerSinc.cpp",
    ],

    arch: {
        arm: {
            instruction_set: "arm",
        },
    },
}
