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