1# Copyright (c) 2020 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/lite/config/component/lite_component.gni")
15
16SUBSYSTEM_DIR = "//foundation/communication/ipc"
17DBINDER_ROOT = "$SUBSYSTEM_DIR/services/dbinder/c"
18IPC_CORE_ROOT = "$SUBSYSTEM_DIR/ipc/native"
19
20config("ipc_rpc_interface") {
21  include_dirs = [
22    "$SUBSYSTEM_DIR/interfaces/innerkits/c/ipc/include",
23    "$SUBSYSTEM_DIR/interfaces/innerkits/c/dbinder/include",
24  ]
25}
26if (ohos_kernel_type == "linux") {
27  SYSTEM_LEVEL = "small"
28  shared_library("dbinder") {
29    sources = [
30      "$DBINDER_ROOT/ipc_adapter/${SYSTEM_LEVEL}/dbinder_ipc_adapter.c",
31      "$DBINDER_ROOT/src/dbinder_service.c",
32      "$DBINDER_ROOT/src/dbinder_stub.c",
33      "$DBINDER_ROOT/src/dbinder_trans_callback.c",
34      "$SUBSYSTEM_DIR/utils/src/rpc_session_handle.c",
35    ]
36    public_configs = [ ":ipc_rpc_interface" ]
37    include_dirs = [
38      "$DBINDER_ROOT/include",
39      "$DBINDER_ROOT/ipc_adapter/include",
40      "$SUBSYSTEM_DIR/ipc/native/c/ipc/include",
41      "$SUBSYSTEM_DIR/ipc/native/c/rpc/include",
42      "$SUBSYSTEM_DIR/ipc/native/c/rpc/ipc_adapter/include",
43      "$SUBSYSTEM_DIR/ipc/native/c/rpc/trans_adapter/include",
44      "$SUBSYSTEM_DIR/ipc/native/c/manager/include",
45      "$SUBSYSTEM_DIR/utils/include",
46      "//third_party/bounds_checking_function/include",
47      "//commonlibrary/utils_lite/include",
48    ]
49    ldflags = [
50      "-lstdc++",
51      "-lpthread",
52    ]
53    public_deps = [
54      "$SUBSYSTEM_DIR/interfaces/innerkits/c/ipc:rpc_log",
55      "//third_party/bounds_checking_function/:libsec_shared",
56    ]
57  }
58} else if (ohos_kernel_type == "liteos_m") {
59  SYSTEM_LEVEL = "mini"
60  static_library("dbinder") {
61    sources = [
62      "$DBINDER_ROOT/ipc_adapter/${SYSTEM_LEVEL}/dbinder_ipc_adapter.c",
63      "$DBINDER_ROOT/src/dbinder_service.c",
64      "$DBINDER_ROOT/src/dbinder_stub.c",
65      "$DBINDER_ROOT/src/dbinder_trans_callback.c",
66      "$SUBSYSTEM_DIR/utils/src/rpc_session_handle.c",
67    ]
68    public_configs = [ ":ipc_rpc_interface" ]
69    include_dirs = [
70      "$DBINDER_ROOT/include",
71      "$DBINDER_ROOT/ipc_adapter/include",
72      "$SUBSYSTEM_DIR/ipc/native/c/ipc/include",
73      "$SUBSYSTEM_DIR/ipc/native/c/rpc/include",
74      "$SUBSYSTEM_DIR/ipc/native/c/rpc/ipc_adapter/include",
75      "$SUBSYSTEM_DIR/ipc/native/c/rpc/trans_adapter/include",
76      "$SUBSYSTEM_DIR/ipc/native/c/manager/include",
77      "$SUBSYSTEM_DIR/ipc/test/rpc/include",
78      "$SUBSYSTEM_DIR/utils/include",
79      "//third_party/bounds_checking_function/include",
80      "//commonlibrary/utils_lite/include",
81      "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
82    ]
83    ldflags = [ "-lpthread" ]
84    deps = [ "$IPC_CORE_ROOT/c/adapter:rpc_adapter" ]
85  }
86}
87