• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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("//foundation/communication/dsoftbus/dsoftbus.gni")
15
16import("//foundation/communication/dsoftbus/sdk/bus_center/bus_center_sdk.gni")
17import("//foundation/communication/dsoftbus/sdk/discovery/disc_sdk.gni")
18import("//foundation/communication/dsoftbus/sdk/frame/frame_sdk.gni")
19import("//foundation/communication/dsoftbus/sdk/transmission/trans_sdk.gni")
20
21common_client_src = bus_center_sdk_src + disc_sdk_src +
22                    softbus_client_frame_src + trans_session_manager_sdk_src
23common_client_inc = bus_center_sdk_inc + disc_sdk_inc +
24                    softbus_client_frame_inc + trans_session_manager_sdk_inc
25common_client_deps = bus_center_sdk_deps + trans_session_manager_sdk_deps
26
27common_client_deps += [
28  "$dsoftbus_root_path/adapter:softbus_adapter",
29  "$dsoftbus_root_path/core/common:softbus_utils",
30]
31
32if (defined(ohos_lite)) {
33  if (dsoftbus_feature_build_shared_sdk == true) {
34    build_type = "shared_library"
35  } else {
36    build_type = "static_library"
37  }
38  if (ohos_kernel_type != "liteos_m") {
39    common_client_deps += [
40      "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single",
41      "//foundation/systemabilitymgr/samgr_lite/samgr:samgr",
42      "//third_party/bounds_checking_function:libsec_shared",
43    ]
44  }
45} else {
46  if (dsoftbus_feature_build_shared_sdk == true) {
47    build_type = "ohos_shared_library"
48  } else {
49    build_type = "ohos_static_library"
50  }
51  common_client_deps +=
52      [ "//third_party/bounds_checking_function:libsec_shared" ]
53}
54
55config("dsoftbus_sdk_interface") {
56  include_dirs = [
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_root_path/sdk/transmission/session/cpp/include",
63    "$dsoftbus_root_path/interfaces/inner_kits/transport",
64    "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include",
65  ]
66}
67
68target(build_type, "softbus_client") {
69  sources = common_client_src
70  include_dirs = common_client_inc
71  deps = common_client_deps
72  all_dependent_configs = [ ":dsoftbus_sdk_interface" ]
73  defines = TRANS_SDK_DEFINES
74
75  if (defined(ohos_lite)) {
76    cflags_cc = [ "-stdc=c++14" ]
77    if (board_toolchain_type != "iccarm") {
78      configs -= [ "//build/lite/config:language_cpp" ]
79      cflags = [ "-fPIC" ]
80      cflags_cc += [ "-fPIC" ]
81    } else {
82      cflags = [
83        "--diag_suppress",
84        "Pa153",
85      ]
86    }
87    ldflags = [ "-lstdc++" ]
88  } else {
89    cflags = [ "-fPIC" ]
90    cflags_cc = [ "-std=c++14" ]
91    if (is_standard_system) {
92      external_deps = [
93        "c_utils:utils",
94        "hiviewdfx_hilog_native:libhilog",
95        "ipc:ipc_single",
96      ]
97    }
98    part_name = "dsoftbus"
99    subsystem_name = "communication"
100  }
101}
102