• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/config/features.gni")
15import("//build/ohos.gni")
16import("//build/test.gni")
17import("../../dsoftbus.gni")
18import("../../sdk/bus_center/bus_center_sdk.gni")
19import("../../sdk/frame/frame_sdk.gni")
20import("../../sdk/transmission/trans_sdk.gni")
21
22common_client_src = bus_center_sdk_src + softbus_client_frame_src +
23                    trans_session_manager_sdk_src
24common_client_inc = bus_center_sdk_inc + softbus_client_frame_inc +
25                    trans_session_manager_sdk_inc
26common_client_deps = bus_center_sdk_deps + trans_session_manager_sdk_deps
27
28common_client_deps += [
29  "$dsoftbus_core_path/common:softbus_utils",
30  "$dsoftbus_dfx_path:softbus_dfx",
31  "$dsoftbus_root_path/adapter:softbus_adapter",
32]
33
34common_client_ex_deps = []
35
36if (defined(ohos_lite)) {
37  if (dsoftbus_feature_build_shared_sdk == true) {
38    build_type = "shared_library"
39  } else {
40    build_type = "static_library"
41  }
42  if (ohos_kernel_type != "liteos_m") {
43    common_client_ex_deps += [ "bounds_checking_function:libsec_shared" ]
44  }
45} else {
46  common_client_ex_deps += [ "bounds_checking_function:libsec_shared" ]
47}
48
49config("dsoftbus_sdk_interface") {
50  include_dirs = [
51    "$dsoftbus_dfx_path/interface/include",
52    "$dsoftbus_root_path/interfaces/inner_kits/lnn",
53    "$dsoftbus_root_path/interfaces/inner_kits/transport",
54    "$dsoftbus_root_path/interfaces/kits",
55    "$dsoftbus_root_path/interfaces/kits/bus_center",
56    "$dsoftbus_root_path/interfaces/kits/common",
57    "$dsoftbus_root_path/interfaces/kits/discovery",
58    "$dsoftbus_root_path/interfaces/kits/transport",
59    "$dsoftbus_sdk_path/transmission/session/cpp/include",
60  ]
61
62  if (enhanced_kits_broadcast) {
63    include_dirs +=
64        [ "$dsoftbus_root_path/dsoftbus_enhance/interfaces/kits/broadcast" ]
65  }
66
67  if (dsoftbus_feature_ex_kits) {
68    include_dirs +=
69        [ "$dsoftbus_root_path/dsoftbus_enhance/interfaces/kits/bus_center" ]
70  }
71
72  if (schema_enhanced) {
73    include_dirs += [
74      "$dsoftbus_core_path/transmission/common/include",
75      "$dsoftbus_root_path/dsoftbus_enhance/interfaces/kits/transport",
76    ]
77  }
78}
79
80ohos_static_library("softbus_client_static") {
81  sanitize = {
82    cfi = true
83    cfi_cross_dso = true
84    debug = false
85  }
86  branch_protector_ret = "pac_ret"
87
88  sources = common_client_src
89  include_dirs = common_client_inc
90  deps = common_client_deps
91  external_deps = common_client_ex_deps
92  public_configs = [ ":dsoftbus_sdk_interface" ]
93  defines += TRANS_SDK_DEFINES
94
95  if (defined(ohos_lite)) {
96    cflags_cc = [ "-stdc=c++14" ]
97    if (board_toolchain_type != "iccarm") {
98      configs -= [ "//build/lite/config:language_cpp" ]
99      cflags = [ "-fPIC" ]
100      cflags_cc += [ "-fPIC" ]
101    } else {
102      cflags = [
103        "--diag_suppress",
104        "Pa153",
105      ]
106    }
107    ldflags = [ "-lstdc++" ]
108  } else {
109    cflags = [ "-fPIC" ]
110    cflags_cc = [ "-std=c++14" ]
111    if (is_standard_system) {
112      external_deps += [
113        "c_utils:utils",
114        "hilog:libhilog",
115        "ipc:ipc_single",
116      ]
117      if (dsoftbus_access_token_feature) {
118        external_deps += [
119          "access_token:libaccesstoken_sdk",
120          "access_token:libprivacy_sdk",
121          "access_token:libtokenid_sdk",
122        ]
123      }
124    }
125    if (defined(global_parts_info) &&
126        defined(global_parts_info.hiviewdfx_hicollie)) {
127      external_deps += [ "hicollie:libhicollie" ]
128    }
129    part_name = "dsoftbus"
130    subsystem_name = "communication"
131  }
132}
133