BUILD.gn 3.7 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") {
L
liubb_0516 已提交
20
  include_dirs = [ "$SUBSYSTEM_DIR/interfaces/innerkits/c/ipc/include" ]
L
liubb_0516 已提交
21 22 23 24 25 26 27 28 29 30
}

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 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
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 已提交
47 48
if (ohos_kernel_type == "liteos_m") {
  static_library("ipc_single") {
L
liubb_0516 已提交
49 50
    sources = ipc_common_src
    sources += [
L
liubb_0516 已提交
51 52 53
      "$IPC_CORE_ROOT/ipc/src/binder_invoker_virtual.c",
      "$IPC_CORE_ROOT/manager/src/rpc_log.c",
    ]
L
liubb_0516 已提交
54
    include_dirs = ipc_common_include
L
liubb_0516 已提交
55
    public_configs = [ ":ipc_rpc_interface" ]
L
liubb_0516 已提交
56 57 58 59 60
    deps = [ "//foundation/communication/ipc/ipc/native/c/adapter:rpc_adapter" ]
  }
} else if (ohos_kernel_type == "liteos_a") {
  shared_library("rpc_log") {
    sources = [ "$IPC_CORE_ROOT/manager/src/rpc_log.c" ]
L
liubb_0516 已提交
61 62 63 64
    include_dirs = [
      "$IPC_CORE_ROOT/manager/include",
      "$hilog_lite_include_path",
    ]
L
liubb_0516 已提交
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
    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
    sources += [ "$IPC_CORE_ROOT/ipc/src/binder_invoker_virtual.c" ]
    public_configs = [ ":ipc_rpc_interface" ]
    include_dirs = ipc_common_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",
    ]
L
liubb_0516 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
  }
} 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 已提交
102 103
    sources = ipc_common_src
    sources += [ "$IPC_CORE_ROOT/ipc/src/binder_invoker.c" ]
L
liubb_0516 已提交
104
    public_configs = [ ":ipc_rpc_interface" ]
L
liubb_0516 已提交
105
    include_dirs = ipc_common_include
L
liubb_0516 已提交
106 107 108 109
    ldflags = [
      "-lstdc++",
      "-lpthread",
    ]
L
liubb_0516 已提交
110 111
    cflags = [ "-fPIC" ]
    cflags_cc = cflags
L
liubb_0516 已提交
112 113
    public_deps = [
      ":rpc_log",
L
liubb_0516 已提交
114
      "//foundation/communication/ipc/ipc/native/c/adapter:rpc_adapter",
L
liubb_0516 已提交
115 116 117 118 119
      "//third_party/bounds_checking_function/:libsec_shared",
    ]
    configs -= [ "//build/lite/config:clang_opt" ]
  }
}