#
#  Copyright 2023 The Android Open Source Project
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at:
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#

import("//common-mk/install_config.gni")

group("mmc") {
  deps = [
    ":install_dbus_config",
    ":install_init",
    ":install_minijail_config",
    ":install_system_service",
    ":install_tmpfiles_config",
    ":mmc_service",
    "//bt/system/stack/mmc/codec_client:libcodec_client",
    "//bt/system/stack/mmc/proto:mmc_config_proto",
  ]
  if (use.test) {
    deps += [
      ":hfp_lc3_mmc_encoder_test",
      ":hfp_lc3_mmc_decoder_test",
    ]
  }
}

pkg_config("target_defaults") {
  include_dirs = [
    "//bt/system",
    "//bt/system/gd",
    "//bt/system/include",
    "//bt/system/stack",
    "//bt/system/stack/include",
  ]
  pkg_deps = [
    "libchrome",
  ]
  if (use.fuzzer) {
    pkg_deps += [ "protobuf" ]
  } else {
    pkg_deps += [ "protobuf-lite" ]
  }
  if (!(defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs)) {
    defines = [ "EXCLUDE_NONSTANDARD_CODECS" ]
  }
}

install_config("install_dbus_config") {
  sources = [ "dbus_permissions/org.chromium.mmc.CodecManager.conf" ]
  install_path = "/etc/dbus-1/system.d"
}

install_config("install_system_service") {
  sources = [ "dbus_service/org.chromium.mmc.CodecManager.service" ]
  install_path = "/usr/share/dbus-1/system-services"
}

install_config("install_init") {
  sources = [ "init/mmc_service.conf" ]
  install_path = "/etc/init"
}

install_config("install_tmpfiles_config") {
  sources = [ "tmpfiles.d/mmc.conf" ]
  install_path = "/usr/lib/tmpfiles.d"
}

install_config("install_minijail_config") {
  sources = [ "minijail/mmc.conf" ]
  install_path = "/usr/share/minijail"
}

source_set("libmmc") {
  configs += [ ":target_defaults" ]
  sources = [
    "daemon/service.cc",
  ]
  deps = [
    "//bt/system/common",
    "//bt/system/stack/mmc/proto:mmc_service_proto",
    "//bt/system/stack/mmc/codec_server:libcodec_server_hfp_lc3",
  ]
  if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) {
    deps += [ "//bt/system/stack/mmc/codec_server:libcodec_server_a2dp_aac" ]
  }
}

executable("mmc_service") {
  configs += [ ":target_defaults" ]
  deps = [ ":libmmc" ]
  sources = [ "main.cc" ]
}

if (use.test) {
  executable("hfp_lc3_mmc_encoder_test") {
    sources = [
      "codec_server/hfp_lc3_mmc_encoder.cc",
      "test/hfp_lc3_mmc_encoder_test.cc",
      "test/mock/mock_embdrv_lc3.cc",
      "//bt/system/test/mock/mock_common_address_obfuscator.cc",
      "//bt/system/test/mock/mock_osi_allocator.cc",
      "//bt/system/test/common/mock_functions.cc",
    ]
    include_dirs = [
      "//bt/system/types",
    ]
    configs += [
      ":target_defaults",
      "//bt/system:external_gtest_main",
    ]
    deps = [
      "//bt/system/stack/mmc/proto:mmc_config_proto",
      "//bt/system/common",
      "//bt/system/osi",
      "//bt/system/types",
    ]
  }

  executable("hfp_lc3_mmc_decoder_test") {
    sources = [
      "codec_server/hfp_lc3_mmc_decoder.cc",
      "test/hfp_lc3_mmc_decoder_test.cc",
      "test/mock/mock_embdrv_lc3.cc",
      "//bt/system/test/mock/mock_common_address_obfuscator.cc",
      "//bt/system/test/mock/mock_osi_allocator.cc",
      "//bt/system/test/common/mock_functions.cc",
    ]
    include_dirs = [
      "//bt/system/types",
    ]
    configs += [
      ":target_defaults",
      "//bt/system:external_gtest_main",
    ]
    deps = [
      "//bt/system/stack/mmc/proto:mmc_config_proto",
      "//bt/system/common",
      "//bt/system/osi",
      "//bt/system/types",
    ]
  }
}
