• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/config/components/idl_tool/idl.gni")
15import("//build/ohos.gni")
16import("./../../../miscdevice.gni")
17
18idl_gen_interface("miscdevice_service_interface") {
19  if (miscdevice_feature_vibrator_custom) {
20    sources = [ "all/IMiscdeviceService.idl" ]
21  } else {
22    sources = [ "part/IMiscdeviceService.idl" ]
23  }
24  log_domainid = "0xD002701"
25  log_tag = "IMiscdeviceServiceIdl"
26  part_name = "miscdevice"
27  subsystem_name = "sensors"
28}
29
30config("miscdevice_service_idl_config") {
31  include_dirs = [
32    "${target_gen_dir}",
33    "include",
34    "$SUBSYSTEM_DIR/interfaces/inner_api/light",
35    "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator",
36    "$SUBSYSTEM_DIR/utils/common/include",
37  ]
38}
39
40ohos_source_set("miscdevice_service_stub") {
41  public_configs = [ ":miscdevice_service_idl_config" ]
42  branch_protector_ret = "pac_ret"
43  sanitize = {
44    cfi = true
45    cfi_cross_dso = true
46    debug = false
47  }
48  output_values = get_target_outputs(":miscdevice_service_interface")
49  sources = filter_include(output_values, [ "*_stub.cpp" ])
50  deps = [ ":miscdevice_service_interface" ]
51  external_deps = [
52    "c_utils:utils",
53    "hilog:libhilog",
54    "ipc:ipc_single",
55    "samgr:samgr_proxy",
56  ]
57  part_name = "miscdevice"
58  subsystem_name = "sensors"
59}
60
61ohos_source_set("miscdevice_service_proxy") {
62  public_configs = [ ":miscdevice_service_idl_config" ]
63  branch_protector_ret = "pac_ret"
64  sanitize = {
65    cfi = true
66    cfi_cross_dso = true
67    debug = false
68  }
69  output_values = get_target_outputs(":miscdevice_service_interface")
70  sources = filter_include(output_values, [ "*_proxy.cpp" ])
71  deps = [ ":miscdevice_service_interface" ]
72  external_deps = [
73    "c_utils:utils",
74    "hilog:libhilog",
75    "ipc:ipc_single",
76    "samgr:samgr_proxy",
77  ]
78  part_name = "miscdevice"
79  subsystem_name = "sensors"
80}
81
82ohos_source_set("miscdevice_service_file_h") {
83  public_configs = [ ":miscdevice_service_idl_config" ]
84  sanitize = {
85    cfi = true
86    cfi_cross_dso = true
87    debug = false
88  }
89  deps = [ ":miscdevice_service_interface" ]
90  external_deps = [
91    "c_utils:utils",
92    "hilog:libhilog",
93    "ipc:ipc_single",
94    "samgr:samgr_proxy",
95  ]
96  part_name = "miscdevice"
97  subsystem_name = "sensors"
98}
99
100ohos_ndk_library("libvibrator_ndk") {
101  output_name = "vibrator_agent"
102  ndk_description_file = "./libvibrator.json"
103  min_compact_version = "6"
104}
105
106ohos_ndk_headers("vibrator_ndk_header") {
107  dest_dir = "$ndk_headers_out_dir/sensors"
108  sources = [
109    "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator/vibrator_agent.h",
110    "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator/vibrator_agent_type.h",
111  ]
112}
113
114config("vibrator_config") {
115  include_dirs = [ "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator" ]
116}
117
118ohos_shared_library("vibrator_interface_native") {
119  output_name = "vibrator_agent"
120  sources = [ "vibrator_agent.cpp" ]
121
122  include_dirs = [
123    "${target_gen_dir}",
124    "include",
125    "$SUBSYSTEM_DIR/interfaces/inner_api/light",
126    "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator",
127    "$SUBSYSTEM_DIR/utils/common/include",
128    "$SUBSYSTEM_DIR/utils/haptic_decoder/interface",
129  ]
130
131  branch_protector_ret = "pac_ret"
132  sanitize = {
133    cfi = true
134    cfi_cross_dso = true
135    debug = false
136  }
137
138  defines = miscdevice_default_defines
139
140  cflags = [ "-Wno-error=inconsistent-missing-override" ]
141
142  deps = [
143    "$SUBSYSTEM_DIR/frameworks/native/light:light_ndk_header",
144    "$SUBSYSTEM_DIR/frameworks/native/vibrator:libvibrator_native",
145    "$SUBSYSTEM_DIR/frameworks/native/vibrator:libvibrator_ndk",
146    "$SUBSYSTEM_DIR/utils/common:libmiscdevice_utils",
147  ]
148
149  external_deps = [
150    "cJSON:cjson",
151    "c_utils:utils",
152    "hilog:libhilog",
153    "init:libbegetutil",
154    "ipc:ipc_single",
155  ]
156
157  public_configs = [ ":vibrator_config" ]
158  innerapi_tags = [ "platformsdk" ]
159  part_name = "miscdevice"
160  subsystem_name = "sensors"
161}
162
163ohos_shared_library("libvibrator_native") {
164  output_values = get_target_outputs(":miscdevice_service_interface")
165  sources = [
166    "src/vibrator_client_stub.cpp",
167    "src/vibrator_service_client.cpp",
168  ]
169  sources += filter_include(output_values, [ "*_proxy.cpp" ])
170
171  include_dirs = [
172    "${target_gen_dir}",
173    "$SUBSYSTEM_DIR/utils/haptic_decoder/interface",
174    "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator",
175    "include",
176    "$SUBSYSTEM_DIR/interfaces/inner_api/light",
177    "$SUBSYSTEM_DIR/utils/common/include",
178  ]
179
180  deps = [
181    ":miscdevice_service_interface",
182    "$SUBSYSTEM_DIR/utils/common:libmiscdevice_utils",
183  ]
184
185  branch_protector_ret = "pac_ret"
186  sanitize = {
187    cfi = true
188    cfi_cross_dso = true
189    debug = false
190  }
191
192  external_deps = [
193    "cJSON:cjson",
194    "c_utils:utils",
195    "hilog:libhilog",
196    "ipc:ipc_single",
197    "samgr:samgr_proxy",
198  ]
199
200  if (miscdevice_feature_hiviewdfx_hisysevent) {
201    external_deps += [ "hisysevent:libhisysevent" ]
202  }
203
204  if (miscdevice_feature_hiviewdfx_hitrace) {
205    external_deps += [ "hitrace:hitrace_meter" ]
206  }
207
208  defines = miscdevice_default_defines
209
210  innerapi_tags = [ "platformsdk_indirect" ]
211  part_name = "miscdevice"
212  subsystem_name = "sensors"
213}
214
215group("vibrator_target") {
216  deps = [
217    ":libvibrator_native",
218    ":vibrator_interface_native",
219  ]
220}
221