• 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("./../sensor.gni")
16
17ohos_shared_library("libsensor_service") {
18  sources = [
19    "src/client_info.cpp",
20    "src/fifo_cache_data.cpp",
21    "src/flush_info_record.cpp",
22    "src/sensor_dump.cpp",
23    "src/sensor_manager.cpp",
24    "src/sensor_power_policy.cpp",
25    "src/sensor_service.cpp",
26    "src/stream_server.cpp",
27  ]
28
29  include_dirs = [
30    "$SUBSYSTEM_DIR/frameworks/native/include",
31    "$SUBSYSTEM_DIR/interfaces/inner_api",
32    "$SUBSYSTEM_DIR/services/include",
33    "$SUBSYSTEM_DIR/utils/common/include",
34    "$SUBSYSTEM_DIR/utils/ipc/include",
35  ]
36
37  cflags = [
38    "-fvisibility=hidden",
39    "-ffunction-sections",
40    "-fdata-sections",
41    "-Oz",
42  ]
43
44  cflags_cc = [
45    "-fvisibility=hidden",
46    "-ffunction-sections",
47    "-fdata-sections",
48    "-Oz",
49  ]
50
51  branch_protector_ret = "pac_ret"
52  sanitize = {
53    cfi = true
54    cfi_cross_dso = true
55    debug = false
56  }
57
58  defines = sensor_default_defines
59
60  deps = [
61    "$SUBSYSTEM_DIR/frameworks/native:sensor_service_stub",
62    "$SUBSYSTEM_DIR/utils/common:libsensor_utils",
63    "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc",
64  ]
65
66  if (sensor_rust_socket_ipc) {
67    deps +=
68        [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ]
69  }
70
71  external_deps = [
72    "access_token:libaccesstoken_sdk",
73    "access_token:libtokenid_sdk",
74    "c_utils:utils",
75    "hilog:libhilog",
76    "ipc:ipc_single",
77    "safwk:system_ability_fwk",
78    "samgr:samgr_proxy",
79  ]
80
81  if (sensor_memmgr_enable) {
82    defines += [ "MEMMGR_ENABLE" ]
83    external_deps += [ "memmgr:memmgrclient" ]
84  }
85
86  if (sensor_access_token_enable) {
87    defines += [ "ACCESS_TOKEN_ENABLE" ]
88  }
89
90  if (hiviewdfx_hisysevent_enable) {
91    external_deps += [ "hisysevent:libhisysevent" ]
92  }
93
94  if (hiviewdfx_hitrace_enable) {
95    external_deps += [ "hitrace:hitrace_meter" ]
96  }
97
98  if (hdf_drivers_interface_sensor) {
99    sources += [
100      "hdi_connection/adapter/src/hdi_connection.cpp",
101      "hdi_connection/adapter/src/sensor_event_callback.cpp",
102      "hdi_connection/interface/src/sensor_hdi_connection.cpp",
103      "src/sensor_data_processer.cpp",
104    ]
105
106    include_dirs += [
107      "$SUBSYSTEM_DIR/services/hdi_connection/interface/include",
108      "$SUBSYSTEM_DIR/services/hdi_connection/adapter/include",
109    ]
110
111    if (sensor_build_eng) {
112      sources += [
113        "hdi_connection/adapter/src/compatible_connection.cpp",
114        "hdi_connection/hardware/src/hdi_service_impl.cpp",
115      ]
116
117      include_dirs +=
118          [ "$SUBSYSTEM_DIR/services/hdi_connection/hardware/include" ]
119    }
120
121    external_deps += [ "drivers_interface_sensor:libsensor_proxy_2.1" ]
122  }
123
124  shlib_type = "sa"
125  part_name = "sensor"
126  subsystem_name = "sensors"
127}
128
129##########################################################################
130ohos_static_library("libsensor_service_static") {
131  sources = [
132    "src/client_info.cpp",
133    "src/fifo_cache_data.cpp",
134    "src/flush_info_record.cpp",
135    "src/sensor_dump.cpp",
136    "src/sensor_manager.cpp",
137    "src/sensor_power_policy.cpp",
138    "src/sensor_service.cpp",
139    "src/stream_server.cpp",
140  ]
141
142  include_dirs = [
143    "$SUBSYSTEM_DIR/frameworks/native/include",
144    "$SUBSYSTEM_DIR/interfaces/inner_api",
145    "$SUBSYSTEM_DIR/services/include",
146    "$SUBSYSTEM_DIR/utils/common/include",
147    "$SUBSYSTEM_DIR/utils/ipc/include",
148  ]
149
150  cflags = [
151    "-fvisibility=hidden",
152    "-ffunction-sections",
153    "-fdata-sections",
154    "-Oz",
155  ]
156
157  cflags_cc = [
158    "-fvisibility=hidden",
159    "-ffunction-sections",
160    "-fdata-sections",
161    "-Oz",
162  ]
163
164  branch_protector_ret = "pac_ret"
165  sanitize = {
166    cfi = true
167    cfi_cross_dso = true
168    debug = false
169  }
170
171  defines = sensor_default_defines
172
173  deps = [
174    "$SUBSYSTEM_DIR/frameworks/native:sensor_service_stub",
175    "$SUBSYSTEM_DIR/utils/common:libsensor_utils",
176    "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc",
177  ]
178
179  if (sensor_rust_socket_ipc) {
180    deps +=
181        [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ]
182  }
183
184  external_deps = [
185    "access_token:libaccesstoken_sdk",
186    "access_token:libtokenid_sdk",
187    "c_utils:utils",
188    "hilog:libhilog",
189    "ipc:ipc_single",
190    "safwk:system_ability_fwk",
191    "samgr:samgr_proxy",
192  ]
193
194  if (sensor_memmgr_enable) {
195    defines += [ "MEMMGR_ENABLE" ]
196    external_deps += [ "memmgr:memmgrclient" ]
197  }
198
199  if (sensor_access_token_enable) {
200    defines += [ "ACCESS_TOKEN_ENABLE" ]
201  }
202
203  if (hiviewdfx_hisysevent_enable) {
204    external_deps += [ "hisysevent:libhisysevent" ]
205  }
206
207  if (hiviewdfx_hitrace_enable) {
208    external_deps += [ "hitrace:hitrace_meter" ]
209  }
210
211  if (hdf_drivers_interface_sensor) {
212    sources += [
213      "hdi_connection/adapter/src/hdi_connection.cpp",
214      "hdi_connection/adapter/src/sensor_event_callback.cpp",
215      "hdi_connection/interface/src/sensor_hdi_connection.cpp",
216      "src/sensor_data_processer.cpp",
217    ]
218
219    include_dirs += [
220      "$SUBSYSTEM_DIR/services/hdi_connection/interface/include",
221      "$SUBSYSTEM_DIR/services/hdi_connection/adapter/include",
222    ]
223
224    if (sensor_build_eng) {
225      sources += [
226        "hdi_connection/adapter/src/compatible_connection.cpp",
227        "hdi_connection/hardware/src/hdi_service_impl.cpp",
228      ]
229
230      include_dirs +=
231          [ "$SUBSYSTEM_DIR/services/hdi_connection/hardware/include" ]
232    }
233
234    external_deps += [ "drivers_interface_sensor:libsensor_proxy_2.1" ]
235  }
236
237  part_name = "sensor"
238  subsystem_name = "sensors"
239}
240group("sensor_service_target") {
241  deps = [
242    ":libsensor_service",
243    ":libsensor_service_static",
244  ]
245}
246