1# Copyright (C) 2025 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/config/components/ets_frontend/ets2abc_config.gni") 15import("//build/ohos.gni") 16import("//build/ohos/taihe_idl/taihe.gni") 17 18SUBSYSTEM_DIR = "//foundation/communication" 19 20copy_taihe_idl("bluetooth_ble_taihe") { 21 sources = [ 22 "idl/ohos.bluetooth.ble.taihe", 23 ] 24 deps = [ 25 "$SUBSYSTEM_DIR/bluetooth/frameworks/ets/taihe/bluetooth_constant:bluetooth_constant_taihe" 26 ] 27} 28 29subsystem_name = "communication" 30part_name = "bluetooth" 31taihe_generated_file_path_ble = "$taihe_file_path/out/$subsystem_name/$part_name/ble" 32 33ohos_taihe("run_taihe") { 34 taihe_generated_file_path = "${taihe_generated_file_path_ble}" 35 deps = [ ":bluetooth_ble_taihe" ] 36 outputs = [ 37 "$taihe_generated_file_path/src/ohos.bluetooth.ble.ani.cpp", 38 "$taihe_generated_file_path/src/ohos.bluetooth.ble.abi.c", 39 ] 40} 41 42taihe_shared_library("bluetoothBle_taihe_native") { 43 taihe_generated_file_path = "${taihe_generated_file_path_ble}" 44 part_name = "$part_name" 45 subsystem_name = "$subsystem_name" 46 sources = get_target_outputs(":run_taihe") 47 include_dirs = [ 48 "include", 49 "src", 50 "$SUBSYSTEM_DIR/bluetooth/frameworks/inner/include", 51 "$SUBSYSTEM_DIR/bluetooth/interfaces/inner_api/include", 52 ] 53 sources += [ 54 "src/ani_constructor.cpp", 55 "src/ohos.bluetooth.ble.impl.cpp", 56 "src/taihe_bluetooth_ble_advertise_callback.cpp", 57 "src/taihe_bluetooth_ble_central_manager_callback.cpp", 58 "src/taihe_bluetooth_ble_utils.cpp", 59 "src/taihe_bluetooth_gatt_client_callback.cpp", 60 "src/taihe_bluetooth_gatt_server_callback.cpp", 61 "src/taihe_bluetooth_utils.cpp", 62 ] 63 deps = [ 64 ":run_taihe", 65 "$SUBSYSTEM_DIR/bluetooth/frameworks/inner:btframework", 66 ] 67 external_deps = [ 68 "c_utils:utils", 69 "hilog:libhilog", 70 ] 71 sanitize = { 72 cfi = true # Enable/disable control flow integrity detection 73 boundary_sanitize = true # Enable boundary san detection 74 cfi_cross_dso = true # Cross-SO CFI Checks 75 integer_overflow = true # Enable integer overflow detection 76 ubsan = true # Enable some Ubsan options 77 debug = false 78 } 79} 80 81generate_static_abc("bluetoothBle_abc") { 82 base_url = "${taihe_generated_file_path_ble}" 83 files = [ "${taihe_generated_file_path_ble}/@ohos.bluetooth.ble.ets" ] 84 is_boot_abc = "True" 85 device_dst_file = "/system/framework/bluetoothBle_abc.abc" 86 dependencies = [ ":run_taihe" ] 87} 88 89ohos_prebuilt_etc("bluetoothBle_etc") { 90 source = "$target_out_dir/bluetoothBle_abc.abc" 91 module_install_dir = "framework" 92 part_name = "$part_name" 93 subsystem_name = "$subsystem_name" 94 deps = [ ":bluetoothBle_abc" ] 95} 96 97group("bluetoothBle_taihe") { 98 deps = [ 99 ":bluetoothBle_etc", 100 ":bluetoothBle_taihe_native" 101 ] 102 # deps = [":run_taihe"] 103}