• 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/ohos.gni")
15import("./../../miscdevice.gni")
16
17ohos_shared_library("libmiscdevice_service") {
18  sources = [
19    "haptic_matcher/src/custom_vibration_matcher.cpp",
20    "hdi_connection/adapter/src/compatible_light_connection.cpp",
21    "hdi_connection/interface/src/light_hdi_connection.cpp",
22    "hdi_connection/interface/src/vibrator_hdi_connection.cpp",
23    "hdi_connection/adapter/src/vibrator_plug_callback.cpp",
24    "src/miscdevice_common_event_subscriber.cpp",
25    "src/miscdevice_dump.cpp",
26    "src/miscdevice_observer.cpp",
27    "src/miscdevice_service.cpp",
28    "src/vibration_priority_manager.cpp",
29    "src/vibrator_thread.cpp",
30  ]
31
32  include_dirs = [
33    "haptic_matcher/include",
34    "include",
35    "$SUBSYSTEM_DIR/interfaces/inner_api/light",
36    "$SUBSYSTEM_DIR/services/miscdevice_service/hdi_connection/adapter/include",
37    "$SUBSYSTEM_DIR/services/miscdevice_service/hdi_connection/interface/include",
38    "$SUBSYSTEM_DIR/utils/common/include",
39    "$SUBSYSTEM_DIR/utils/haptic_decoder/interface",
40    "$SUBSYSTEM_DIR/utils/haptic_decoder/oh_json/include",
41  ]
42
43  cflags = [
44    "-Wno-error=inconsistent-missing-override",
45    "-fvisibility=hidden",
46    "-ffunction-sections",
47    "-fdata-sections",
48    "-Oz",
49  ]
50
51  cflags_cc = [
52    "-fvisibility=hidden",
53    "-ffunction-sections",
54    "-fdata-sections",
55    "-Oz",
56  ]
57
58  if (miscdevice_build_eng) {
59    sources += [ "hdi_connection/adapter/src/compatible_connection.cpp" ]
60  }
61
62  branch_protector_ret = "pac_ret"
63  sanitize = {
64    cfi = true
65    cfi_cross_dso = true
66    debug = false
67  }
68
69  deps = [
70    "$SUBSYSTEM_DIR/frameworks/native/vibrator:miscdevice_service_stub",
71    "$SUBSYSTEM_DIR/utils:miscdevice_utils_target",
72  ]
73
74  external_deps = [
75    "ability_runtime:app_manager",
76    "access_token:libaccesstoken_sdk",
77    "access_token:libtokenid_sdk",
78    "cJSON:cjson",
79    "common_event_service:cesfwk_innerkits",
80    "data_share:datashare_consumer",
81    "drivers_interface_vibrator:libvibrator_proxy_2.0",
82    "hilog:libhilog",
83    "safwk:system_ability_fwk",
84    "samgr:samgr_proxy",
85  ]
86
87  if (miscdevice_feature_vibrator_input_method_enable) {
88    external_deps += [
89      "bundle_framework:appexecfwk_base",
90      "bundle_framework:appexecfwk_core",
91      "os_account:os_account_innerkits",
92    ]
93  }
94
95  defines = miscdevice_default_defines
96
97  if (miscdevice_memmgr_enable) {
98    defines += [ "MEMMGR_ENABLE" ]
99    external_deps += [ "memmgr:memmgrclient" ]
100  }
101
102  if (miscdevice_feature_vibrator_custom) {
103    external_deps += [ "init:libbegetutil" ]
104  }
105
106  if (miscdevice_feature_hdf_drivers_interface_vibrator) {
107    sources += [ "hdi_connection/adapter/src/hdi_connection.cpp" ]
108
109    external_deps += [
110      "drivers_interface_vibrator:libvibrator_proxy_2.0",
111    ]
112  }
113
114  if (hdf_drivers_interface_light) {
115    sources += [ "hdi_connection/adapter/src/hdi_light_connection.cpp" ]
116
117    external_deps += [ "drivers_interface_light:liblight_proxy_1.0" ]
118  }
119
120  if (miscdevice_feature_hiviewdfx_hisysevent) {
121    external_deps += [ "hisysevent:libhisysevent" ]
122  }
123
124  if (miscdevice_feature_hiviewdfx_hitrace) {
125    external_deps += [ "hitrace:hitrace_meter" ]
126  }
127
128  shlib_type = "sa"
129  part_name = "miscdevice"
130  subsystem_name = "sensors"
131}
132
133#############################################################################
134ohos_static_library("libmiscdevice_service_static") {
135  sources = [
136    "haptic_matcher/src/custom_vibration_matcher.cpp",
137    "hdi_connection/adapter/src/compatible_light_connection.cpp",
138    "hdi_connection/interface/src/light_hdi_connection.cpp",
139    "hdi_connection/interface/src/vibrator_hdi_connection.cpp",
140    "hdi_connection/adapter/src/vibrator_plug_callback.cpp",
141    "src/miscdevice_common_event_subscriber.cpp",
142    "src/miscdevice_dump.cpp",
143    "src/miscdevice_observer.cpp",
144    "src/miscdevice_service.cpp",
145    "src/vibration_priority_manager.cpp",
146    "src/vibrator_thread.cpp",
147  ]
148
149  include_dirs = [
150    "haptic_matcher/include",
151    "include",
152    "$SUBSYSTEM_DIR/interfaces/inner_api/light",
153    "$SUBSYSTEM_DIR/services/miscdevice_service/hdi_connection/adapter/include",
154    "$SUBSYSTEM_DIR/services/miscdevice_service/hdi_connection/interface/include",
155    "$SUBSYSTEM_DIR/utils/common/include",
156    "$SUBSYSTEM_DIR/utils/haptic_decoder/interface",
157    "$SUBSYSTEM_DIR/utils/haptic_decoder/oh_json/include",
158  ]
159
160  cflags = [
161    "-fvisibility=hidden",
162    "-ffunction-sections",
163    "-fdata-sections",
164    "-Oz",
165  ]
166
167  cflags_cc = [
168    "-Wno-error=inconsistent-missing-override",
169    "-fvisibility=hidden",
170    "-ffunction-sections",
171    "-fdata-sections",
172    "-Oz",
173  ]
174
175  if (miscdevice_build_eng) {
176    sources += [ "hdi_connection/adapter/src/compatible_connection.cpp" ]
177  }
178
179  branch_protector_ret = "pac_ret"
180  sanitize = {
181    cfi = true
182    cfi_cross_dso = true
183    debug = false
184  }
185
186  deps = [
187    "$SUBSYSTEM_DIR/frameworks/native/vibrator:miscdevice_service_stub",
188    "$SUBSYSTEM_DIR/utils:miscdevice_utils_target",
189  ]
190
191  external_deps = [
192    "ability_runtime:app_manager",
193    "access_token:libaccesstoken_sdk",
194    "access_token:libtokenid_sdk",
195    "cJSON:cjson",
196    "common_event_service:cesfwk_innerkits",
197    "data_share:datashare_consumer",
198    "drivers_interface_vibrator:libvibrator_proxy_2.0",
199    "hilog:libhilog",
200    "safwk:system_ability_fwk",
201    "samgr:samgr_proxy",
202  ]
203
204  if (miscdevice_feature_vibrator_input_method_enable) {
205    external_deps += [
206      "bundle_framework:appexecfwk_base",
207      "bundle_framework:appexecfwk_core",
208      "os_account:os_account_innerkits",
209    ]
210  }
211
212  defines = miscdevice_default_defines
213
214  if (miscdevice_memmgr_enable) {
215    defines += [ "MEMMGR_ENABLE" ]
216    external_deps += [ "memmgr:memmgrclient" ]
217  }
218
219  if (miscdevice_feature_vibrator_custom) {
220    external_deps += [ "init:libbegetutil" ]
221  }
222
223  if (miscdevice_feature_hdf_drivers_interface_vibrator) {
224    sources += [ "hdi_connection/adapter/src/hdi_connection.cpp" ]
225
226    external_deps += [
227      "drivers_interface_vibrator:libvibrator_proxy_2.0",
228    ]
229  }
230
231  if (hdf_drivers_interface_light) {
232    sources += [ "hdi_connection/adapter/src/hdi_light_connection.cpp" ]
233
234    external_deps += [ "drivers_interface_light:liblight_proxy_1.0" ]
235  }
236
237  if (miscdevice_feature_hiviewdfx_hisysevent) {
238    external_deps += [ "hisysevent:libhisysevent" ]
239  }
240
241  if (miscdevice_feature_hiviewdfx_hitrace) {
242    external_deps += [ "hitrace:hitrace_meter" ]
243  }
244
245  part_name = "miscdevice"
246  subsystem_name = "sensors"
247}
248
249group("miscdevice_service_target") {
250  deps = [
251    ":libmiscdevice_service",
252    ":libmiscdevice_service_static",
253  ]
254}
255