1060ff233Sopenharmony_ci# Copyright (c) 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("//build/config/features.gni")
15060ff233Sopenharmony_ciimport("//build/ohos.gni")
16060ff233Sopenharmony_ciimport("//build/test.gni")
17060ff233Sopenharmony_ciimport("../../core/common/dfx/dsoftbus_dfx.gni")
18060ff233Sopenharmony_ciimport("../../dsoftbus.gni")
19060ff233Sopenharmony_ciimport("../../sdk/bus_center/bus_center_sdk.gni")
20060ff233Sopenharmony_ciimport("../../sdk/frame/frame_sdk.gni")
21060ff233Sopenharmony_ciimport("../../sdk/transmission/trans_sdk.gni")
22060ff233Sopenharmony_ci
23060ff233Sopenharmony_cicommon_client_src = bus_center_sdk_src + softbus_client_frame_src +
24060ff233Sopenharmony_ci                    trans_session_manager_sdk_src
25060ff233Sopenharmony_cicommon_client_inc = bus_center_sdk_inc + softbus_client_frame_inc +
26060ff233Sopenharmony_ci                    trans_session_manager_sdk_inc
27060ff233Sopenharmony_cicommon_client_deps = bus_center_sdk_deps + trans_session_manager_sdk_deps
28060ff233Sopenharmony_ci
29060ff233Sopenharmony_cicommon_client_deps += [
30060ff233Sopenharmony_ci  "$dsoftbus_core_path/common:softbus_utils",
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]
35060ff233Sopenharmony_ci
36060ff233Sopenharmony_cicommon_client_ex_deps = []
37060ff233Sopenharmony_ci
38060ff233Sopenharmony_ciif (defined(ohos_lite)) {
39060ff233Sopenharmony_ci  if (dsoftbus_feature_build_shared_sdk == true) {
40060ff233Sopenharmony_ci    build_type = "shared_library"
41060ff233Sopenharmony_ci  } else {
42060ff233Sopenharmony_ci    build_type = "static_library"
43060ff233Sopenharmony_ci  }
44060ff233Sopenharmony_ci  if (ohos_kernel_type != "liteos_m") {
45060ff233Sopenharmony_ci    common_client_ex_deps += [ "bounds_checking_function:libsec_shared" ]
46060ff233Sopenharmony_ci  }
47060ff233Sopenharmony_ci} else {
48060ff233Sopenharmony_ci  common_client_ex_deps += [ "bounds_checking_function:libsec_shared" ]
49060ff233Sopenharmony_ci}
50060ff233Sopenharmony_ci
51060ff233Sopenharmony_ciconfig("dsoftbus_sdk_interface") {
52060ff233Sopenharmony_ci  include_dirs = [
53060ff233Sopenharmony_ci    "$dsoftbus_dfx_path/hisysevent_adapter/include",
54060ff233Sopenharmony_ci    "$dsoftbus_dfx_path/interface/include",
55060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/inner_kits/lnn",
56060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/inner_kits/transport",
57060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/kits",
58060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/kits/bus_center",
59060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/kits/common",
60060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/kits/discovery",
61060ff233Sopenharmony_ci    "$dsoftbus_root_path/interfaces/kits/transport",
62060ff233Sopenharmony_ci    "$dsoftbus_sdk_path/transmission/session/cpp/include",
63060ff233Sopenharmony_ci  ]
64060ff233Sopenharmony_ci
65060ff233Sopenharmony_ci  if (enhanced_kits_broadcast) {
66060ff233Sopenharmony_ci    include_dirs +=
67060ff233Sopenharmony_ci        [ "$dsoftbus_root_path/dsoftbus_enhance/interfaces/kits/broadcast" ]
68060ff233Sopenharmony_ci  }
69060ff233Sopenharmony_ci
70060ff233Sopenharmony_ci  if (dsoftbus_feature_ex_kits) {
71060ff233Sopenharmony_ci    include_dirs +=
72060ff233Sopenharmony_ci        [ "$dsoftbus_root_path/dsoftbus_enhance/interfaces/kits/bus_center" ]
73060ff233Sopenharmony_ci  }
74060ff233Sopenharmony_ci
75060ff233Sopenharmony_ci  if (schema_enhanced) {
76060ff233Sopenharmony_ci    include_dirs += [
77060ff233Sopenharmony_ci      "$dsoftbus_core_path/transmission/common/include",
78060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/interfaces/kits/transport",
79060ff233Sopenharmony_ci    ]
80060ff233Sopenharmony_ci  }
81060ff233Sopenharmony_ci}
82060ff233Sopenharmony_ci
83060ff233Sopenharmony_ciohos_static_library("softbus_client_static") {
84060ff233Sopenharmony_ci  sanitize = {
85060ff233Sopenharmony_ci    cfi = true
86060ff233Sopenharmony_ci    cfi_cross_dso = true
87060ff233Sopenharmony_ci    debug = false
88060ff233Sopenharmony_ci  }
89060ff233Sopenharmony_ci  branch_protector_ret = "pac_ret"
90060ff233Sopenharmony_ci
91060ff233Sopenharmony_ci  sources = common_client_src
92060ff233Sopenharmony_ci  include_dirs = common_client_inc
93060ff233Sopenharmony_ci  deps = common_client_deps
94060ff233Sopenharmony_ci  external_deps = common_client_ex_deps
95060ff233Sopenharmony_ci  public_configs = [ ":dsoftbus_sdk_interface" ]
96060ff233Sopenharmony_ci  defines += TRANS_SDK_DEFINES
97060ff233Sopenharmony_ci
98060ff233Sopenharmony_ci  if (defined(ohos_lite)) {
99060ff233Sopenharmony_ci    cflags_cc = [ "-stdc=c++14" ]
100060ff233Sopenharmony_ci    if (board_toolchain_type != "iccarm") {
101060ff233Sopenharmony_ci      configs -= [ "//build/lite/config:language_cpp" ]
102060ff233Sopenharmony_ci      cflags = [ "-fPIC" ]
103060ff233Sopenharmony_ci      cflags_cc += [ "-fPIC" ]
104060ff233Sopenharmony_ci    } else {
105060ff233Sopenharmony_ci      cflags = [
106060ff233Sopenharmony_ci        "--diag_suppress",
107060ff233Sopenharmony_ci        "Pa153",
108060ff233Sopenharmony_ci      ]
109060ff233Sopenharmony_ci    }
110060ff233Sopenharmony_ci    ldflags = [ "-lstdc++" ]
111060ff233Sopenharmony_ci  } else {
112060ff233Sopenharmony_ci    cflags = [ "-fPIC" ]
113060ff233Sopenharmony_ci    cflags_cc = [ "-std=c++14" ]
114060ff233Sopenharmony_ci    if (is_standard_system) {
115060ff233Sopenharmony_ci      external_deps += [
116060ff233Sopenharmony_ci        "access_token:libaccesstoken_sdk",
117060ff233Sopenharmony_ci        "access_token:libprivacy_sdk",
118060ff233Sopenharmony_ci        "access_token:libtokenid_sdk",
119060ff233Sopenharmony_ci        "c_utils:utils",
120060ff233Sopenharmony_ci        "hilog:libhilog",
121060ff233Sopenharmony_ci        "ipc:ipc_single",
122060ff233Sopenharmony_ci      ]
123060ff233Sopenharmony_ci    }
124060ff233Sopenharmony_ci    if (defined(global_parts_info) &&
125060ff233Sopenharmony_ci        defined(global_parts_info.hiviewdfx_hicollie)) {
126060ff233Sopenharmony_ci      external_deps += [ "hicollie:libhicollie" ]
127060ff233Sopenharmony_ci    }
128060ff233Sopenharmony_ci    part_name = "dsoftbus"
129060ff233Sopenharmony_ci    subsystem_name = "communication"
130060ff233Sopenharmony_ci  }
131060ff233Sopenharmony_ci}
132