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