1# Copyright (c) 2021-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/ohos.gni")
15import("./../../../miscdevice.gni")
16
17ohos_ndk_library("libvibrator_ndk") {
18  output_name = "vibrator_agent"
19  ndk_description_file = "./libvibrator.json"
20  min_compact_version = "6"
21}
22
23ohos_ndk_headers("vibrator_ndk_header") {
24  dest_dir = "$ndk_headers_out_dir/sensors"
25  sources = [
26    "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator/vibrator_agent.h",
27    "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator/vibrator_agent_type.h",
28  ]
29}
30
31config("vibrator_config") {
32  include_dirs = [ "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator" ]
33}
34
35ohos_shared_library("vibrator_interface_native") {
36  output_name = "vibrator_agent"
37  sources = [ "vibrator_agent.cpp" ]
38
39  include_dirs = [
40    "include",
41    "$SUBSYSTEM_DIR/frameworks/native/common/include",
42    "$SUBSYSTEM_DIR/interfaces/inner_api/light",
43    "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator",
44    "$SUBSYSTEM_DIR/utils/common/include",
45    "$SUBSYSTEM_DIR/utils/haptic_decoder/interface",
46  ]
47
48  branch_protector_ret = "pac_ret"
49  sanitize = {
50    cfi = true
51    cfi_cross_dso = true
52    debug = false
53  }
54
55  defines = miscdevice_default_defines
56
57  cflags = [ "-Wno-error=inconsistent-missing-override" ]
58
59  deps = [
60    "$SUBSYSTEM_DIR/frameworks/native/light:light_ndk_header",
61    "$SUBSYSTEM_DIR/frameworks/native/vibrator:libvibrator_native",
62    "$SUBSYSTEM_DIR/frameworks/native/vibrator:libvibrator_ndk",
63  ]
64
65  external_deps = [
66    "cJSON:cjson",
67    "c_utils:utils",
68    "hilog:libhilog",
69    "init:libbegetutil",
70    "ipc:ipc_single",
71  ]
72
73  public_configs = [ ":vibrator_config" ]
74  innerapi_tags = [ "platformsdk" ]
75  part_name = "miscdevice"
76  subsystem_name = "sensors"
77}
78
79ohos_shared_library("libvibrator_native") {
80  sources = [
81    "$SUBSYSTEM_DIR/frameworks/native/common/src/miscdevice_service_proxy.cpp",
82    "src/vibrator_client_stub.cpp",
83    "src/vibrator_service_client.cpp",
84  ]
85
86  include_dirs = [
87    "$SUBSYSTEM_DIR/utils/haptic_decoder/interface",
88    "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator",
89    "include",
90    "$SUBSYSTEM_DIR/frameworks/native/common/include",
91    "$SUBSYSTEM_DIR/interfaces/inner_api/light",
92    "$SUBSYSTEM_DIR/utils/common/include",
93  ]
94
95  deps = [ "$SUBSYSTEM_DIR/utils/common:libmiscdevice_utils" ]
96
97  branch_protector_ret = "pac_ret"
98  sanitize = {
99    cfi = true
100    cfi_cross_dso = true
101    debug = false
102  }
103
104  external_deps = [
105    "cJSON:cjson",
106    "c_utils:utils",
107    "hilog:libhilog",
108    "hisysevent:libhisysevent",
109    "hitrace:hitrace_meter",
110    "ipc:ipc_single",
111    "samgr:samgr_proxy",
112  ]
113
114  defines = miscdevice_default_defines
115
116  innerapi_tags = [ "platformsdk_indirect" ]
117  part_name = "miscdevice"
118  subsystem_name = "sensors"
119}
120
121group("vibrator_target") {
122  deps = [
123    ":libvibrator_native",
124    ":vibrator_interface_native",
125  ]
126}
127