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