1# 2# Copyright 2023 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at: 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17import("//common-mk/install_config.gni") 18 19group("mmc") { 20 deps = [ 21 ":install_dbus_config", 22 ":install_init", 23 ":install_minijail_config", 24 ":install_system_service", 25 ":install_tmpfiles_config", 26 ":mmc_service", 27 "//bt/system/stack/mmc/codec_client:libcodec_client", 28 "//bt/system/stack/mmc/proto:mmc_config_proto", 29 ] 30 if (use.test) { 31 deps += [ 32 ":hfp_lc3_mmc_encoder_test", 33 ":hfp_lc3_mmc_decoder_test", 34 ] 35 } 36} 37 38pkg_config("target_defaults") { 39 include_dirs = [ 40 "//bt/system", 41 "//bt/system/gd", 42 "//bt/system/include", 43 "//bt/system/pdl/hci/include", 44 "//bt/system/stack", 45 "//bt/system/stack/include", 46 ] 47 pkg_deps = [ 48 "libchrome", 49 ] 50 if (use.fuzzer) { 51 pkg_deps += [ "protobuf" ] 52 } else { 53 pkg_deps += [ "protobuf-lite" ] 54 } 55 if (!(defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs)) { 56 defines = [ "EXCLUDE_NONSTANDARD_CODECS" ] 57 } 58} 59 60install_config("install_dbus_config") { 61 sources = [ "dbus_permissions/org.chromium.mmc.CodecManager.conf" ] 62 install_path = "/etc/dbus-1/system.d" 63} 64 65install_config("install_system_service") { 66 sources = [ "dbus_service/org.chromium.mmc.CodecManager.service" ] 67 install_path = "/usr/share/dbus-1/system-services" 68} 69 70install_config("install_init") { 71 sources = [ "init/mmc_service.conf" ] 72 install_path = "/etc/init" 73} 74 75install_config("install_tmpfiles_config") { 76 sources = [ "tmpfiles.d/mmc.conf" ] 77 install_path = "/usr/lib/tmpfiles.d" 78} 79 80install_config("install_minijail_config") { 81 sources = [ "minijail/mmc.conf" ] 82 install_path = "/usr/share/minijail" 83} 84 85source_set("libmmc") { 86 configs += [ 87 ":target_defaults", 88 "//bt/system/log:log_defaults", 89 ] 90 sources = [ 91 "daemon/service.cc", 92 ] 93 deps = [ 94 "//bt/system/common", 95 "//bt/system/stack/mmc/proto:mmc_service_proto", 96 "//bt/system/stack/mmc/codec_server:libcodec_server_hfp_lc3", 97 ] 98 if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) { 99 deps += [ "//bt/system/stack/mmc/codec_server:libcodec_server_a2dp_aac" ] 100 } 101} 102 103executable("mmc_service") { 104 configs += [ 105 ":target_defaults", 106 "//bt/system/log:log_defaults", 107 ] 108 deps = [ 109 ":libmmc", 110 "//bt/system/log:libbluetooth_log", 111 ] 112 libs = [ 113 "fmt", 114 ] 115 sources = [ "main.cc" ] 116} 117 118if (use.test) { 119 executable("hfp_lc3_mmc_encoder_test") { 120 sources = [ 121 "codec_server/hfp_lc3_mmc_encoder.cc", 122 "test/hfp_lc3_mmc_encoder_test.cc", 123 "test/mock/mock_embdrv_lc3.cc", 124 "//bt/system/test/mock/mock_common_address_obfuscator.cc", 125 "//bt/system/test/mock/mock_osi_allocator.cc", 126 "//bt/system/test/common/mock_functions.cc", 127 ] 128 include_dirs = [ 129 "//bt/system", 130 ] 131 configs += [ 132 ":target_defaults", 133 "//bt/system/log:log_defaults", 134 "//bt/system:external_gtest_main", 135 ] 136 libs = [ 137 "fmt", 138 ] 139 deps = [ 140 "//bt/system/stack/mmc/proto:mmc_config_proto", 141 "//bt/system/log:libbluetooth_log", 142 "//bt/system/common", 143 "//bt/system/osi", 144 "//bt/system/types", 145 ] 146 } 147 148 executable("hfp_lc3_mmc_decoder_test") { 149 sources = [ 150 "codec_server/hfp_lc3_mmc_decoder.cc", 151 "test/hfp_lc3_mmc_decoder_test.cc", 152 "test/mock/mock_embdrv_lc3.cc", 153 "//bt/system/test/mock/mock_common_address_obfuscator.cc", 154 "//bt/system/test/mock/mock_osi_allocator.cc", 155 "//bt/system/test/common/mock_functions.cc", 156 ] 157 include_dirs = [ 158 "//bt/system", 159 ] 160 configs += [ 161 ":target_defaults", 162 "//bt/system/log:log_defaults", 163 "//bt/system:external_gtest_main", 164 ] 165 libs = [ 166 "fmt", 167 ] 168 deps = [ 169 "//bt/system/stack/mmc/proto:mmc_config_proto", 170 "//bt/system/log:libbluetooth_log", 171 "//bt/system/common", 172 "//bt/system/osi", 173 "//bt/system/types", 174 ] 175 } 176} 177