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/stack", 44 "//bt/system/stack/include", 45 ] 46 pkg_deps = [ 47 "libchrome", 48 ] 49 if (use.fuzzer) { 50 pkg_deps += [ "protobuf" ] 51 } else { 52 pkg_deps += [ "protobuf-lite" ] 53 } 54 if (!(defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs)) { 55 defines = [ "EXCLUDE_NONSTANDARD_CODECS" ] 56 } 57} 58 59install_config("install_dbus_config") { 60 sources = [ "dbus_permissions/org.chromium.mmc.CodecManager.conf" ] 61 install_path = "/etc/dbus-1/system.d" 62} 63 64install_config("install_system_service") { 65 sources = [ "dbus_service/org.chromium.mmc.CodecManager.service" ] 66 install_path = "/usr/share/dbus-1/system-services" 67} 68 69install_config("install_init") { 70 sources = [ "init/mmc_service.conf" ] 71 install_path = "/etc/init" 72} 73 74install_config("install_tmpfiles_config") { 75 sources = [ "tmpfiles.d/mmc.conf" ] 76 install_path = "/usr/lib/tmpfiles.d" 77} 78 79install_config("install_minijail_config") { 80 sources = [ "minijail/mmc.conf" ] 81 install_path = "/usr/share/minijail" 82} 83 84source_set("libmmc") { 85 configs += [ 86 ":target_defaults", 87 "//bt/system/log:log_defaults", 88 ] 89 sources = [ 90 "daemon/service.cc", 91 ] 92 deps = [ 93 "//bt/system/common", 94 "//bt/system/stack/mmc/proto:mmc_service_proto", 95 "//bt/system/stack/mmc/codec_server:libcodec_server_hfp_lc3", 96 ] 97 if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) { 98 deps += [ "//bt/system/stack/mmc/codec_server:libcodec_server_a2dp_aac" ] 99 } 100} 101 102executable("mmc_service") { 103 configs += [ 104 ":target_defaults", 105 "//bt/system/log:log_defaults", 106 ] 107 deps = [ 108 ":libmmc", 109 "//bt/system/log:libbluetooth_log", 110 ] 111 libs = [ 112 "fmt", 113 ] 114 sources = [ "main.cc" ] 115} 116 117if (use.test) { 118 executable("hfp_lc3_mmc_encoder_test") { 119 sources = [ 120 "codec_server/hfp_lc3_mmc_encoder.cc", 121 "test/hfp_lc3_mmc_encoder_test.cc", 122 "test/mock/mock_embdrv_lc3.cc", 123 "//bt/system/test/mock/mock_common_address_obfuscator.cc", 124 "//bt/system/test/mock/mock_osi_allocator.cc", 125 "//bt/system/test/common/mock_functions.cc", 126 ] 127 include_dirs = [ 128 "//bt/system/types", 129 ] 130 configs += [ 131 ":target_defaults", 132 "//bt/system/log:log_defaults", 133 "//bt/system:external_gtest_main", 134 ] 135 libs = [ 136 "fmt", 137 ] 138 deps = [ 139 "//bt/system/stack/mmc/proto:mmc_config_proto", 140 "//bt/system/log:libbluetooth_log", 141 "//bt/system/common", 142 "//bt/system/osi", 143 "//bt/system/types", 144 ] 145 } 146 147 executable("hfp_lc3_mmc_decoder_test") { 148 sources = [ 149 "codec_server/hfp_lc3_mmc_decoder.cc", 150 "test/hfp_lc3_mmc_decoder_test.cc", 151 "test/mock/mock_embdrv_lc3.cc", 152 "//bt/system/test/mock/mock_common_address_obfuscator.cc", 153 "//bt/system/test/mock/mock_osi_allocator.cc", 154 "//bt/system/test/common/mock_functions.cc", 155 ] 156 include_dirs = [ 157 "//bt/system/types", 158 ] 159 configs += [ 160 ":target_defaults", 161 "//bt/system/log:log_defaults", 162 "//bt/system:external_gtest_main", 163 ] 164 libs = [ 165 "fmt", 166 ] 167 deps = [ 168 "//bt/system/stack/mmc/proto:mmc_config_proto", 169 "//bt/system/log:libbluetooth_log", 170 "//bt/system/common", 171 "//bt/system/osi", 172 "//bt/system/types", 173 ] 174 } 175} 176