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