1# Copyright (C) 2024 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")
15
16SUBSYSTEM_DIR = "//foundation/communication"
17BLUETOOTH_FRAMEWORK_DIR = "$SUBSYSTEM_DIR/bluetooth/frameworks"
18
19ohos_ndk_headers("bluetooth_ndk_header") {
20  dest_dir = "$ndk_headers_out_dir/bluetooth"
21  sources =
22      [ "$SUBSYSTEM_DIR/bluetooth/interfaces/c_api/include/oh_bluetooth.h" ]
23}
24
25ohos_ndk_library("libbluetooth_ndk") {
26  ndk_description_file = "$BLUETOOTH_FRAMEWORK_DIR/c_api/libbluetooth.ndk.json"
27  output_name = "bluetooth_ndk"
28  output_extension = "so"
29  min_compact_version = "13"
30}
31
32config("bluetooth_ndk_config") {
33  visibility = [ ":*" ]
34  include_dirs = [
35    "$SUBSYSTEM_DIR/bluetooth/interfaces/c_api/include",
36    "$BLUETOOTH_FRAMEWORK_DIR/inner/include",
37  ]
38}
39
40ohos_shared_library("bluetooth_ndk") {
41  sources = [ "$BLUETOOTH_FRAMEWORK_DIR/c_api/src/oh_bluetooth.cpp" ]
42  output_extension = "so"
43  defines = [ "API_EXPORT=__attribute__((visibility (\"default\")))" ]
44
45  configs = [ ":bluetooth_ndk_config" ]
46
47  branch_protector_ret = "pac_ret"
48  sanitize = {
49    cfi = true
50    cfi_cross_dso = true
51    debug = false
52  }
53
54  deps = [ "$BLUETOOTH_FRAMEWORK_DIR/inner:btframework" ]
55
56  external_deps = [
57    "c_utils:utils",
58    "hilog:libhilog",
59  ]
60
61  relative_install_dir = "ndk"
62  part_name = "bluetooth"
63  subsystem_name = "communication"
64}
65