1060ff233Sopenharmony_ci# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
2060ff233Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3060ff233Sopenharmony_ci# you may not use this file except in compliance with the License.
4060ff233Sopenharmony_ci# You may obtain a copy of the License at
5060ff233Sopenharmony_ci#
6060ff233Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7060ff233Sopenharmony_ci#
8060ff233Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9060ff233Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10060ff233Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11060ff233Sopenharmony_ci# See the License for the specific language governing permissions and
12060ff233Sopenharmony_ci# limitations under the License.
13060ff233Sopenharmony_ci
14060ff233Sopenharmony_ciimport("../core/common/dfx/dsoftbus_dfx.gni")
15060ff233Sopenharmony_ciimport("../dsoftbus.gni")
16060ff233Sopenharmony_ciimport("bus_center/bus_center_sdk.gni")
17060ff233Sopenharmony_ciimport("frame/frame_sdk.gni")
18060ff233Sopenharmony_ciimport("transmission/trans_sdk.gni")
19060ff233Sopenharmony_ci
20060ff233Sopenharmony_cidsoftbus_root_path = ".."
21060ff233Sopenharmony_ci
22060ff233Sopenharmony_cicommon_client_src = bus_center_sdk_src + softbus_client_frame_src +
23060ff233Sopenharmony_ci                    trans_session_manager_sdk_src
24060ff233Sopenharmony_cicommon_client_inc = bus_center_sdk_inc + softbus_client_frame_inc +
25060ff233Sopenharmony_ci                    trans_session_manager_sdk_inc
26060ff233Sopenharmony_cicommon_client_deps = bus_center_sdk_deps + trans_session_manager_sdk_deps
27060ff233Sopenharmony_ci
28060ff233Sopenharmony_cicommon_client_ext_deps = []
29060ff233Sopenharmony_ci
30060ff233Sopenharmony_cicommon_client_deps += [
31060ff233Sopenharmony_ci  "$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer",
32060ff233Sopenharmony_ci  "$dsoftbus_dfx_path/log:softbus_dfx_log",
33060ff233Sopenharmony_ci  "$dsoftbus_root_path/adapter:softbus_adapter",
34060ff233Sopenharmony_ci  "$dsoftbus_root_path/core/common:softbus_utils",
35060ff233Sopenharmony_ci]
36060ff233Sopenharmony_ci
37060ff233Sopenharmony_ciif (defined(ohos_lite)) {
38060ff233Sopenharmony_ci  if (dsoftbus_feature_build_shared_sdk == true) {
39060ff233Sopenharmony_ci    build_type = "shared_library"
40060ff233Sopenharmony_ci  } else {
41060ff233Sopenharmony_ci    build_type = "static_library"
42060ff233Sopenharmony_ci  }
43060ff233Sopenharmony_ci  if (ohos_kernel_type != "liteos_m") {
44060ff233Sopenharmony_ci    common_client_deps += [
45060ff233Sopenharmony_ci      "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single",
46060ff233Sopenharmony_ci      "//foundation/systemabilitymgr/samgr_lite/samgr:samgr",
47060ff233Sopenharmony_ci    ]
48060ff233Sopenharmony_ci    common_client_ext_deps += [ "bounds_checking_function:libsec_shared" ]
49060ff233Sopenharmony_ci  }
50060ff233Sopenharmony_ci} else {
51060ff233Sopenharmony_ci  if (dsoftbus_feature_build_shared_sdk == true) {
52060ff233Sopenharmony_ci    build_type = "ohos_shared_library"
53060ff233Sopenharmony_ci  } else {
54060ff233Sopenharmony_ci    build_type = "ohos_static_library"
55060ff233Sopenharmony_ci  }
56060ff233Sopenharmony_ci  common_client_ext_deps += [
57060ff233Sopenharmony_ci    "access_token:libaccesstoken_sdk",
58060ff233Sopenharmony_ci    "bounds_checking_function:libsec_shared",
59060ff233Sopenharmony_ci  ]
60060ff233Sopenharmony_ci}
61060ff233Sopenharmony_ci
62060ff233Sopenharmony_ciconfig("dsoftbus_sdk_interface") {
63060ff233Sopenharmony_ci  include_dirs = [
64060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/kits",
65060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/inner_kits/lnn",
66060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/kits/bus_center",
67060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/kits/common",
68060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/kits/discovery",
69060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/kits/transport",
70060ff233Sopenharmony_ci    "$dsoftbus_root_path/sdk/transmission/session/cpp/include",
71060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/inner_kits/transport",
72060ff233Sopenharmony_ci    "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include",
73060ff233Sopenharmony_ci    "$dsoftbus_root_path/core/common/dfx/interface/include",
74060ff233Sopenharmony_ci  ]
75060ff233Sopenharmony_ci
76060ff233Sopenharmony_ci  if (enhanced_kits_broadcast) {
77060ff233Sopenharmony_ci    include_dirs +=
78060ff233Sopenharmony_ci        [ "$dsoftbus_root_path/dsoftbus_enhance/interfaces/kits/broadcast" ]
79060ff233Sopenharmony_ci  }
80060ff233Sopenharmony_ci
81060ff233Sopenharmony_ci  if (dsoftbus_feature_ex_kits) {
82060ff233Sopenharmony_ci    include_dirs +=
83060ff233Sopenharmony_ci        [ "$dsoftbus_root_path/dsoftbus_enhance/interfaces/kits/bus_center" ]
84060ff233Sopenharmony_ci  }
85060ff233Sopenharmony_ci
86060ff233Sopenharmony_ci  if (schema_enhanced) {
87060ff233Sopenharmony_ci    include_dirs += [
88060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/interfaces/kits/transport",
89060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/transmission/common/include",
90060ff233Sopenharmony_ci    ]
91060ff233Sopenharmony_ci  }
92060ff233Sopenharmony_ci}
93060ff233Sopenharmony_ci
94060ff233Sopenharmony_citarget(build_type, "softbus_client") {
95060ff233Sopenharmony_ci  sources = common_client_src
96060ff233Sopenharmony_ci  include_dirs = common_client_inc
97060ff233Sopenharmony_ci  deps = common_client_deps
98060ff233Sopenharmony_ci  external_deps = common_client_ext_deps + libsoftbus_stream_ext_deps
99060ff233Sopenharmony_ci  all_dependent_configs = [ ":dsoftbus_sdk_interface" ]
100060ff233Sopenharmony_ci  public_configs = [ ":dsoftbus_sdk_interface" ]
101060ff233Sopenharmony_ci  defines += TRANS_SDK_DEFINES
102060ff233Sopenharmony_ci
103060ff233Sopenharmony_ci  if (defined(ohos_lite)) {
104060ff233Sopenharmony_ci    cflags_cc = [ "-stdc=c++14" ]
105060ff233Sopenharmony_ci    if (board_toolchain_type != "iccarm") {
106060ff233Sopenharmony_ci      configs -= [ "//build/lite/config:language_cpp" ]
107060ff233Sopenharmony_ci      cflags = [ "-fPIC" ]
108060ff233Sopenharmony_ci      cflags_cc += [ "-fPIC" ]
109060ff233Sopenharmony_ci    } else {
110060ff233Sopenharmony_ci      cflags = [
111060ff233Sopenharmony_ci        "--diag_suppress",
112060ff233Sopenharmony_ci        "Pa153",
113060ff233Sopenharmony_ci      ]
114060ff233Sopenharmony_ci    }
115060ff233Sopenharmony_ci    ldflags = [ "-lstdc++" ]
116060ff233Sopenharmony_ci  } else {
117060ff233Sopenharmony_ci    sanitize = {
118060ff233Sopenharmony_ci      ubsan = true
119060ff233Sopenharmony_ci      integer_overflow = true
120060ff233Sopenharmony_ci      boundary_sanitize = true
121060ff233Sopenharmony_ci      cfi = true
122060ff233Sopenharmony_ci      cfi_cross_dso = true
123060ff233Sopenharmony_ci      debug = false
124060ff233Sopenharmony_ci    }
125060ff233Sopenharmony_ci    branch_protector_ret = "pac_ret"
126060ff233Sopenharmony_ci
127060ff233Sopenharmony_ci    version_script = "libsoftbus_client_map"
128060ff233Sopenharmony_ci    cflags = [ "-fPIC" ]
129060ff233Sopenharmony_ci    cflags_cc = [ "-std=c++14" ]
130060ff233Sopenharmony_ci    if (is_standard_system) {
131060ff233Sopenharmony_ci      external_deps += [
132060ff233Sopenharmony_ci        "access_token:libtokenid_sdk",
133060ff233Sopenharmony_ci        "c_utils:utils",
134060ff233Sopenharmony_ci        "hicollie:libhicollie",
135060ff233Sopenharmony_ci        "hilog:libhilog",
136060ff233Sopenharmony_ci        "ipc:ipc_single",
137060ff233Sopenharmony_ci      ]
138060ff233Sopenharmony_ci    }
139060ff233Sopenharmony_ci    if (defined(global_parts_info) &&
140060ff233Sopenharmony_ci        defined(global_parts_info.hiviewdfx_hicollie)) {
141060ff233Sopenharmony_ci      external_deps += [ "hicollie:libhicollie" ]
142060ff233Sopenharmony_ci    }
143060ff233Sopenharmony_ci    innerapi_tags = [ "platformsdk_indirect" ]
144060ff233Sopenharmony_ci    part_name = "dsoftbus"
145060ff233Sopenharmony_ci    subsystem_name = "communication"
146060ff233Sopenharmony_ci  }
147060ff233Sopenharmony_ci}
148