BUILD.gn 8.0 KB
Newer Older
L
liubb_0516 已提交
1
# Copyright (c) 2021 Huawei Device Co., Ltd.
L
liubb_0516 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build/lite/config/component/lite_component.gni")

SUBSYSTEM_DIR = "//foundation/communication/ipc"
IPC_CORE_ROOT = "$SUBSYSTEM_DIR/ipc/native/c"

config("ipc_rpc_interface") {
Y
yangguangzhao 已提交
20 21 22 23
  include_dirs = [
    "$SUBSYSTEM_DIR/interfaces/innerkits/c/ipc/include",
    "$SUBSYSTEM_DIR/interfaces/innerkits/c/dbinder/include",
  ]
L
liubb_0516 已提交
24 25 26 27 28 29 30 31 32 33
}

if (ohos_kernel_type == "liteos_m") {
  hilog_lite_include_path =
      "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite"
} else {
  hilog_lite_include_path =
      "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits"
}

L
liubb_0516 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
ipc_common_include = [
  "$IPC_CORE_ROOT/ipc/include",
  "$IPC_CORE_ROOT/manager/include",
  "//third_party/bounds_checking_function/include",
  "//utils/native/lite/include",
  "$hilog_lite_include_path",
]

ipc_common_src = [
  "$IPC_CORE_ROOT/manager/src/ipc_process_skeleton.c",
  "$IPC_CORE_ROOT/manager/src/ipc_skeleton.c",
  "$IPC_CORE_ROOT/manager/src/ipc_thread_pool.c",
  "$IPC_CORE_ROOT/manager/src/iremote_invoker.c",
  "$IPC_CORE_ROOT/manager/src/serializer.c",
]

L
liubb_0516 已提交
50
if (ohos_kernel_type == "liteos_m") {
Y
yangguangzhao 已提交
51
  SYSTEM_LEVEL = "mini"
Y
yangguangzhao 已提交
52
  enable_socket_trans = false
Y
yangguangzhao 已提交
53
  static_library("rpc_manager") {
L
liubb_0516 已提交
54 55
    sources = ipc_common_src
    sources += [
L
liubb_0516 已提交
56 57
      "$IPC_CORE_ROOT/ipc/src/liteos_m/ipc_invoker.c",
      "$IPC_CORE_ROOT/ipc/src/liteos_m/serializer_inner.c",
L
liubb_0516 已提交
58
      "$IPC_CORE_ROOT/manager/src/rpc_log.c",
Y
yangguangzhao 已提交
59 60 61 62 63
      "$IPC_CORE_ROOT/rpc/ipc_adapter/${SYSTEM_LEVEL}/ipc_proxy_inner.c",
      "$IPC_CORE_ROOT/rpc/ipc_adapter/${SYSTEM_LEVEL}/ipc_stub_inner.c",
      "$IPC_CORE_ROOT/rpc/src/dbinder_invoker.c",
      "$IPC_CORE_ROOT/rpc/src/rpc_process_skeleton.c",
      "$IPC_CORE_ROOT/rpc/src/rpc_trans_callback.c",
Y
yangguangzhao 已提交
64
      "$IPC_CORE_ROOT/rpc/trans_adapter/src/rpc_softbus_trans.c",
Y
yangguangzhao 已提交
65
      "$IPC_CORE_ROOT/rpc/trans_adapter/src/rpc_trans.c",
Y
yangguangzhao 已提交
66
      "$SUBSYSTEM_DIR/utils/src/rpc_session_handle.c",
L
liubb_0516 已提交
67 68
    ]
    public_configs = [ ":ipc_rpc_interface" ]
Y
yangguangzhao 已提交
69 70 71 72 73 74
    include_dirs = ipc_common_include
    include_dirs += [
      "$IPC_CORE_ROOT/rpc/include",
      "$IPC_CORE_ROOT/rpc/ipc_adapter/include",
      "$IPC_CORE_ROOT/rpc/trans_adapter/include",
      "$SUBSYSTEM_DIR/services/dbinder/c/include",
Y
yangguangzhao 已提交
75
      "$SUBSYSTEM_DIR/utils/include",
Y
yangguangzhao 已提交
76
    ]
S
SimonLi 已提交
77
    deps = [
Y
yangguangzhao 已提交
78
      "//foundation/communication/dsoftbus/sdk:softbus_client",
S
SimonLi 已提交
79 80 81
      "//foundation/communication/ipc/ipc/native/c/adapter:rpc_adapter",
      "//kernel/liteos_m/components/net",
    ]
Y
yangguangzhao 已提交
82 83 84 85 86 87 88 89 90 91
    defines = [ "RPC_SOFTBUS_TRANS" ]
    ldflags = [ "-lpthread" ]

    if (enable_socket_trans) {
      sources -= [ "$IPC_CORE_ROOT/rpc/trans_adapter/src/rpc_softbus_trans.c" ]
      sources += [ "$SUBSYSTEM_DIR/ipc/test/rpc/socket_trans/src/rpc_${SYSTEM_LEVEL}_socket_trans.c" ]
      include_dirs += [ "$SUBSYSTEM_DIR/ipc/test/rpc/socket_trans/include" ]
      defines -= [ "RPC_SOFTBUS_TRANS" ]
      defines += [ "RPC_SOCKET_TRANS" ]
    }
L
liubb_0516 已提交
92 93 94 95
  }
} else if (ohos_kernel_type == "liteos_a") {
  shared_library("rpc_log") {
    sources = [ "$IPC_CORE_ROOT/manager/src/rpc_log.c" ]
L
liubb_0516 已提交
96 97 98 99
    include_dirs = [
      "$IPC_CORE_ROOT/manager/include",
      "$hilog_lite_include_path",
    ]
L
liubb_0516 已提交
100 101 102 103 104 105 106 107
    public_deps = [
      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
      "//third_party/bounds_checking_function/:libsec_shared",
    ]
  }

  shared_library("ipc_single") {
    sources = ipc_common_src
108 109 110 111 112
    sources += [
      "$IPC_CORE_ROOT/ipc/src/liteos_a/ipc_invoker.c",
      "$IPC_CORE_ROOT/ipc/src/liteos_a/serializer_inner.c",
      "$IPC_CORE_ROOT/rpc/src/rpc_process_skeleton_virtual.c",
    ]
L
liubb_0516 已提交
113 114
    public_configs = [ ":ipc_rpc_interface" ]
    include_dirs = ipc_common_include
115 116 117 118 119 120 121
    include_dirs += [
      "$IPC_CORE_ROOT/rpc/include",
      "$IPC_CORE_ROOT/ipc/src/liteos_a/include",
      "$IPC_CORE_ROOT/rpc/trans_adapter/include",
      "$SUBSYSTEM_DIR/services/dbinder/c/include",
      "$SUBSYSTEM_DIR/utils/include",
    ]
L
liubb_0516 已提交
122 123 124 125 126 127 128 129 130 131 132
    ldflags = [
      "-lstdc++",
      "-lpthread",
    ]
    cflags = [ "-fPIC" ]
    cflags_cc = cflags
    public_deps = [
      ":rpc_log",
      "//foundation/communication/ipc/ipc/native/c/adapter:rpc_adapter",
      "//third_party/bounds_checking_function/:libsec_shared",
    ]
L
liubb_0516 已提交
133
  }
Y
yangguangzhao 已提交
134 135 136

  shared_library("rpc_manager") {
  }
L
liubb_0516 已提交
137 138 139 140 141 142 143 144 145 146 147 148 149 150
} else {
  shared_library("rpc_log") {
    sources = [ "$IPC_CORE_ROOT/manager/src/rpc_log.c" ]
    include_dirs = [
      "$IPC_CORE_ROOT/manager/include",
      "$hilog_lite_include_path",
    ]
    public_deps = [
      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
      "//third_party/bounds_checking_function/:libsec_shared",
    ]
  }

  shared_library("ipc_single") {
L
liubb_0516 已提交
151
    sources = ipc_common_src
Y
yangguangzhao 已提交
152
    sources += [
L
liubb_0516 已提交
153 154
      "$IPC_CORE_ROOT/ipc/src/linux/ipc_invoker.c",
      "$IPC_CORE_ROOT/ipc/src/linux/serializer_inner.c",
Y
yangguangzhao 已提交
155 156
      "$IPC_CORE_ROOT/rpc/src/rpc_process_skeleton_virtual.c",
    ]
L
liubb_0516 已提交
157
    public_configs = [ ":ipc_rpc_interface" ]
L
liubb_0516 已提交
158
    include_dirs = ipc_common_include
Y
yangguangzhao 已提交
159 160
    include_dirs += [
      "$IPC_CORE_ROOT/rpc/include",
L
liubb_0516 已提交
161
      "$IPC_CORE_ROOT/ipc/src/linux/include",
Y
yangguangzhao 已提交
162 163
      "$IPC_CORE_ROOT/rpc/trans_adapter/include",
      "$SUBSYSTEM_DIR/services/dbinder/c/include",
Y
yangguangzhao 已提交
164
      "$SUBSYSTEM_DIR/utils/include",
Y
yangguangzhao 已提交
165
    ]
L
liubb_0516 已提交
166 167 168 169
    ldflags = [
      "-lstdc++",
      "-lpthread",
    ]
L
liubb_0516 已提交
170 171
    cflags = [ "-fPIC" ]
    cflags_cc = cflags
L
liubb_0516 已提交
172 173
    public_deps = [
      ":rpc_log",
L
liubb_0516 已提交
174
      "//foundation/communication/ipc/ipc/native/c/adapter:rpc_adapter",
L
liubb_0516 已提交
175 176 177
      "//third_party/bounds_checking_function/:libsec_shared",
    ]
    configs -= [ "//build/lite/config:clang_opt" ]
L
liubb_0516 已提交
178
    defines = [ "IPC_RESET_SKELETON" ]
L
liubb_0516 已提交
179
  }
Y
yangguangzhao 已提交
180 181

  SYSTEM_LEVEL = "small"
182
  enable_socket_trans = true
Y
yangguangzhao 已提交
183 184 185
  shared_library("rpc_manager") {
    sources = ipc_common_src
    sources += [
L
liubb_0516 已提交
186 187
      "$IPC_CORE_ROOT/ipc/src/linux/ipc_invoker.c",
      "$IPC_CORE_ROOT/ipc/src/linux/serializer_inner.c",
Y
yangguangzhao 已提交
188 189 190 191 192
      "$IPC_CORE_ROOT/rpc/ipc_adapter/${SYSTEM_LEVEL}/ipc_proxy_inner.c",
      "$IPC_CORE_ROOT/rpc/ipc_adapter/${SYSTEM_LEVEL}/ipc_stub_inner.c",
      "$IPC_CORE_ROOT/rpc/src/dbinder_invoker.c",
      "$IPC_CORE_ROOT/rpc/src/rpc_process_skeleton.c",
      "$IPC_CORE_ROOT/rpc/src/rpc_trans_callback.c",
Y
yangguangzhao 已提交
193
      "$IPC_CORE_ROOT/rpc/trans_adapter/src/rpc_softbus_trans.c",
Y
yangguangzhao 已提交
194
      "$IPC_CORE_ROOT/rpc/trans_adapter/src/rpc_trans.c",
Y
yangguangzhao 已提交
195
      "$SUBSYSTEM_DIR/utils/src/rpc_session_handle.c",
Y
yangguangzhao 已提交
196 197 198 199 200
    ]
    public_configs = [ ":ipc_rpc_interface" ]
    include_dirs = ipc_common_include
    include_dirs += [
      "$IPC_CORE_ROOT/rpc/include",
L
liubb_0516 已提交
201
      "$IPC_CORE_ROOT/ipc/src/linux/include",
Y
yangguangzhao 已提交
202 203 204
      "$IPC_CORE_ROOT/rpc/ipc_adapter/include",
      "$IPC_CORE_ROOT/rpc/trans_adapter/include",
      "$SUBSYSTEM_DIR/services/dbinder/c/include",
Y
yangguangzhao 已提交
205
      "$SUBSYSTEM_DIR/utils/include",
Y
yangguangzhao 已提交
206 207 208 209 210 211 212 213 214 215 216 217 218
      "//third_party/bounds_checking_function/include",
    ]
    ldflags = [
      "-lstdc++",
      "-lpthread",
    ]
    cflags = [ "-fPIC" ]
    cflags_cc = cflags
    public_deps = [
      ":rpc_log",
      "//foundation/communication/ipc/ipc/native/c/adapter:rpc_adapter",
      "//third_party/bounds_checking_function/:libsec_shared",
    ]
Y
yangguangzhao 已提交
219 220
    deps = [ "//foundation/communication/dsoftbus/sdk:softbus_client" ]
    defines = [ "RPC_SOFTBUS_TRANS" ]
L
liubb_0516 已提交
221
    defines += [ "IPC_RESET_SKELETON" ]
Y
yangguangzhao 已提交
222

Y
yangguangzhao 已提交
223
    if (enable_socket_trans) {
224
      sources -= [ "$IPC_CORE_ROOT/rpc/trans_adapter/src/rpc_softbus_trans.c" ]
Y
yangguangzhao 已提交
225 226 227
      sources +=
          [ "$SUBSYSTEM_DIR/ipc/test/rpc/socket_trans/src/rpc_socket_trans.c" ]
      include_dirs += [ "$SUBSYSTEM_DIR/ipc/test/rpc/socket_trans/include" ]
228 229 230
      deps -= [ "//foundation/communication/dsoftbus/sdk:softbus_client" ]
      defines -= [ "RPC_SOFTBUS_TRANS" ]
      defines += [ "RPC_SOCKET_TRANS" ]
Y
yangguangzhao 已提交
231 232
    }
  }
L
liubb_0516 已提交
233
}