1# Copyright (C) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("//build/ohos_var.gni") 16 17SUBSYSTEM_DIR = "//foundation/communication" 18PART_DIR = "$SUBSYSTEM_DIR/bluetooth_service/services/bluetooth" 19 20PlatformSrc = [ 21 "platform/src/alarm.c", 22 "platform/src/allocator.c", 23 "platform/src/buffer.c", 24 "platform/src/event.c", 25 "platform/src/list.c", 26 "platform/src/module.c", 27 "platform/src/mutex.c", 28 "platform/src/packet.c", 29 "platform/src/queue.c", 30 "platform/src/random.c", 31 "platform/src/reactor.c", 32 "platform/src/semaphore.c", 33 "platform/src/thread.c", 34] 35 36StackAttSrc = [ 37 "src/att/att_common.c", 38 "src/att/att_connect.c", 39 "src/att/att_init.c", 40 "src/att/att_receive.c", 41 "src/att/att_send_request.c", 42 "src/att/att_send_response.c", 43] 44 45StackAvctpSrc = [ 46 "src/avctp/avctp_api.c", 47 "src/avctp/avctp_br_act.c", 48 "src/avctp/avctp_br_l2cap.c", 49 "src/avctp/avctp_br.c", 50 "src/avctp/avctp_conn.c", 51 "src/avctp/avctp_ctrl_act.c", 52 "src/avctp/avctp_ctrl_l2cap.c", 53 "src/avctp/avctp_ctrl.c", 54 "src/avctp/avctp_dev.c", 55 "src/avctp/avctp_gap.c", 56 "src/avctp/avctp_st.c", 57 "src/avctp/avctp.c", 58] 59 60StackAvdtpSrc = [ 61 "src/avdtp/avdtp_api.c", 62 "src/avdtp/avdtp_ctrl.c", 63 "src/avdtp/avdtp_impl.c", 64 "src/avdtp/avdtp_l2cap.c", 65 "src/avdtp/avdtp_message.c", 66 "src/avdtp/avdtp.c", 67] 68 69StackBtmSrc = [ 70 "src/btm/btm_acl.c", 71 "src/btm/btm_controller.c", 72 "src/btm/btm_inq_db.c", 73 "src/btm/btm_interop.c", 74 "src/btm/btm_le_sec.c", 75 "src/btm/btm_pm.c", 76 "src/btm/btm_sco_def.c", 77 "src/btm/btm_sco.c", 78 "src/btm/btm_snoop_filter_acl.c", 79 "src/btm/btm_snoop_filter_cmd.c", 80 "src/btm/btm_snoop_filter_evt.c", 81 "src/btm/btm_snoop_filter.c", 82 "src/btm/btm_snoop.c", 83 "src/btm/btm_thread.c", 84 "src/btm/btm_wl.c", 85 "src/btm/btm.c", 86] 87 88StackGapSrc = [ 89 "src/gap/gap.c", 90 "src/gap/gap_br_discover.c", 91 "src/gap/gap_br_sec.c", 92 "src/gap/gap_le_adv.c", 93 "src/gap/gap_le_scan.c", 94 "src/gap/gap_le_conn.c", 95 "src/gap/gap_le_sec.c", 96 "src/gap/gap_btm_receive.c", 97 "src/gap/gap_hci_receive.c", 98 "src/gap/gap_if.c", 99 "src/gap/gap_l2cap_receive.c", 100 "src/gap/gap_le_if.c", 101 "src/gap/gap_sm_receive.c", 102 "src/gap/gap_task_common.c", 103] 104 105StackHciSrc = [ 106 "src/hci/hdi_wrapper.c", 107 "src/hci/acl/hci_acl.c", 108 "src/hci/hci.c", 109 "src/hci/cmd/hci_cmd.c", 110 "src/hci/cmd/hci_cmd_controller_baseband.c", 111 "src/hci/cmd/hci_cmd_failure.c", 112 "src/hci/cmd/hci_cmd_failure_controller_baseband.c", 113 "src/hci/cmd/hci_cmd_failure_info_params.c", 114 "src/hci/cmd/hci_cmd_failure_le_controller.c", 115 "src/hci/cmd/hci_cmd_failure_link_ctrl.c", 116 "src/hci/cmd/hci_cmd_failure_link_policy.c", 117 "src/hci/cmd/hci_cmd_failure_status_params.c", 118 "src/hci/cmd/hci_cmd_info_params.c", 119 "src/hci/cmd/hci_cmd_le_controller.c", 120 "src/hci/cmd/hci_cmd_link_ctrl.c", 121 "src/hci/cmd/hci_cmd_link_policy.c", 122 "src/hci/cmd/hci_cmd_status_params.c", 123 "src/hci/evt/hci_evt.c", 124 "src/hci/evt/hci_evt_cmd_complete.c", 125 "src/hci/evt/hci_evt_controller_baseband_cmd_complete.c", 126 "src/hci/evt/hci_evt_info_params_cmd_complete.c", 127 "src/hci/evt/hci_evt_link_ctrl_cmd_complete.c", 128 "src/hci/evt/hci_evt_link_policy_cmd_complete.c", 129 "src/hci/evt/hci_evt_status_params_cmd_complete.c", 130 "src/hci/evt/hci_evt_le.c", 131 "src/hci/evt/hci_evt_le_cmd_complete.c", 132 "src/hci/hci_failure.c", 133 "src/hci/hci_vendor_if.c", 134] 135 136StackL2capSrc = [ 137 "src/l2cap/l2cap_cmn.c", 138 "src/l2cap/l2cap_crc.c", 139 "src/l2cap/l2cap_le.c", 140 "src/l2cap/l2cap_inst.c", 141 "src/l2cap/l2cap_core.c", 142 "src/l2cap/l2cap.c", 143 "src/l2cap/l2cap_if.c", 144 "src/l2cap/l2cap_le_if.c", 145] 146 147StackRfcommSrc = [ 148 "src/rfcomm/rfcomm_api.c", 149 "src/rfcomm/rfcomm_channel_fsm.c", 150 "src/rfcomm/rfcomm_channel.c", 151 "src/rfcomm/rfcomm_frames.c", 152 "src/rfcomm/rfcomm_gap_if.c", 153 "src/rfcomm/rfcomm_gap.c", 154 "src/rfcomm/rfcomm_l2cap_if.c", 155 "src/rfcomm/rfcomm_l2cap.c", 156 "src/rfcomm/rfcomm_server.c", 157 "src/rfcomm/rfcomm_session_fsm.c", 158 "src/rfcomm/rfcomm_session.c", 159 "src/rfcomm/rfcomm.c", 160] 161 162StackSdpSrc = [ 163 "src/sdp/sdp_client_parse.c", 164 "src/sdp/sdp_client.c", 165 "src/sdp/sdp_connect.c", 166 "src/sdp/sdp_server.c", 167 "src/sdp/sdp_util.c", 168 "src/sdp/sdp.c", 169] 170 171StackSmpSrc = [ 172 "src/smp/smp_aes_encryption.c", 173 "src/smp/smp_cmd.c", 174 "src/smp/smp_hci_event.c", 175 "src/smp/smp_legacy.c", 176 "src/smp/smp_oob.c", 177 "src/smp/smp_privacy.c", 178 "src/smp/smp_receive.c", 179 "src/smp/smp_sc_accepter.c", 180 "src/smp/smp_sc_initiator.c", 181 "src/smp/smp_send.c", 182 "src/smp/smp_tool.c", 183 "src/smp/smp.c", 184] 185 186config("btstack_public_config") { 187 include_dirs = [ "include" ] 188} 189 190config("btstack_config") { 191 include_dirs = [ 192 "./", 193 "src", 194 "platform/include", 195 "$PART_DIR/common", 196 "$PART_DIR/hardware/include", 197 ] 198 199 cflags = [ 200 "-fPIC", 201 "-Wno-unused-parameter", 202 "-Wpointer-arith", 203 "-Wmissing-field-initializers", 204 "-Wno-missing-braces", #wait-for-fix 205 "-Wno-pragma-pack", 206 ] 207 208 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 209} 210 211ohos_shared_library("btstack") { 212 # sanitize = { 213 # cfi = true 214 # blocklist = "./btstack_blocklist.txt" 215 # } 216 stack_protector_ret = true 217 configs = [ ":btstack_config" ] 218 public_configs = [ ":btstack_public_config" ] 219 220 sources = PlatformSrc + StackAttSrc + StackAvctpSrc + StackAvdtpSrc + 221 StackBtmSrc + StackGapSrc + StackHciSrc + StackL2capSrc + 222 StackRfcommSrc + StackSdpSrc + StackSmpSrc 223 224 deps = [ 225 "$PART_DIR/external:btdummy", 226 "$PART_DIR/hardware:bluetooth_hdi_adapter", 227 "//third_party/bounds_checking_function:libsec_shared", 228 "//third_party/openssl:libcrypto_shared", 229 ] 230 231 external_deps = [ 232 "bluetooth:btcommon", 233 "hilog:libhilog", 234 ] 235 236 subsystem_name = "communication" 237 part_name = "bluetooth_service" 238} 239