• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2023 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("./../../sensor.gni")
17
18idl_gen_interface("sensor_service_interface") {
19  sources = [ "ISensorService.idl" ]
20  log_domainid = "0xD002700"
21  log_tag = "ISensorServiceIdl"
22  part_name = "sensor"
23  subsystem_name = "sensors"
24}
25
26ohos_source_set("sensor_service_stub") {
27  public_configs = [ ":sensor_private_config" ]
28  sanitize = {
29    cfi = true
30    cfi_cross_dso = true
31    debug = false
32  }
33  output_values = get_target_outputs(":sensor_service_interface")
34  sources = filter_include(output_values, [ "*_stub.cpp" ])
35  deps = [ ":sensor_service_interface" ]
36  external_deps = [
37    "c_utils:utils",
38    "hilog:libhilog",
39    "ipc:ipc_single",
40    "samgr:samgr_proxy",
41  ]
42  part_name = "sensor"
43  subsystem_name = "sensors"
44}
45
46ohos_shared_library("libsensor_client") {
47  output_values = get_target_outputs(":sensor_service_interface")
48  sources = [
49    "src/fd_listener.cpp",
50    "src/sensor_agent_proxy.cpp",
51    "src/sensor_client_stub.cpp",
52    "src/sensor_data_channel.cpp",
53    "src/sensor_event_handler.cpp",
54    "src/sensor_file_descriptor_listener.cpp",
55    "src/sensor_service_client.cpp",
56  ]
57  sources += filter_include(output_values, [ "*_proxy.cpp" ])
58
59  include_dirs = [
60    "${target_gen_dir}",
61    "$SUBSYSTEM_DIR/frameworks/native/include",
62    "$SUBSYSTEM_DIR/interfaces/inner_api",
63    "$SUBSYSTEM_DIR/utils/common/include",
64    "$SUBSYSTEM_DIR/utils/ipc/include",
65  ]
66
67  branch_protector_ret = "pac_ret"
68  sanitize = {
69    cfi = true
70    cfi_cross_dso = true
71    debug = false
72  }
73
74  defines = sensor_default_defines
75
76  deps = [
77    ":sensor_service_interface",
78    "$SUBSYSTEM_DIR/utils/common:libsensor_utils",
79    "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc",
80  ]
81
82  if (sensor_rust_socket_ipc) {
83    deps +=
84        [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ]
85  }
86
87  external_deps = [
88    "c_utils:utils",
89    "eventhandler:libeventhandler",
90    "hicollie:libhicollie",
91    "hilog:libhilog",
92    "ipc:ipc_single",
93    "samgr:samgr_proxy",
94  ]
95
96  if (hiviewdfx_hisysevent_enable) {
97    external_deps += [ "hisysevent:libhisysevent" ]
98  }
99
100  if (hiviewdfx_hitrace_enable) {
101    external_deps += [ "hitrace:hitrace_meter" ]
102  }
103
104  innerapi_tags = [ "platformsdk_indirect" ]
105  part_name = "sensor"
106  subsystem_name = "sensors"
107}
108ohos_ndk_library("libsensor_ndk") {
109  output_name = "sensor"
110  ndk_description_file = "./libsensor.json"
111  min_compact_version = "6"
112}
113
114config("sensor_private_config") {
115  include_dirs = [
116    "${target_gen_dir}",
117    "$SUBSYSTEM_DIR/frameworks/native/include",
118    "$SUBSYSTEM_DIR/interfaces/inner_api",
119    "$SUBSYSTEM_DIR/utils/common/include",
120  ]
121}
122config("sensor_public_config") {
123  include_dirs = [ "$SUBSYSTEM_DIR/interfaces/inner_api" ]
124}
125
126ohos_shared_library("sensor_interface_native") {
127  output_name = "sensor_agent"
128  sources = [
129    "src/geomagnetic_field.cpp",
130    "src/sensor_agent.cpp",
131    "src/sensor_algorithm.cpp",
132  ]
133
134  configs = [ ":sensor_private_config" ]
135  public_configs = [ ":sensor_public_config" ]
136
137  branch_protector_ret = "pac_ret"
138  sanitize = {
139    cfi = true
140    cfi_cross_dso = true
141    debug = false
142    boundary_sanitize = true
143    integer_overflow = true
144    ubsan = true
145  }
146
147  deps = [ "$SUBSYSTEM_DIR/frameworks/native:libsensor_client" ]
148
149  external_deps = [
150    "c_utils:utils",
151    "eventhandler:libeventhandler",
152    "hilog:libhilog",
153    "ipc:ipc_single",
154  ]
155
156  part_name = "sensor"
157  innerapi_tags = [ "platformsdk" ]
158  subsystem_name = "sensors"
159}
160
161config("ohsensor_public_config") {
162  include_dirs = [ "$SUBSYSTEM_DIR/interfaces/kits/c" ]
163}
164
165ohos_shared_library("ohsensor") {
166  sources = [ "src/native_sensor.cpp" ]
167  output_extension = "so"
168  defines = [ "API_EXPORT=__attribute__((visibility (\"default\")))" ]
169
170  configs = [ ":sensor_private_config" ]
171  public_configs = [ ":ohsensor_public_config" ]
172
173  branch_protector_ret = "pac_ret"
174  sanitize = {
175    cfi = true
176    cfi_cross_dso = true
177    debug = false
178  }
179
180  deps = [
181    "$SUBSYSTEM_DIR/frameworks/native:libsensor_client",
182    "$SUBSYSTEM_DIR/frameworks/native:sensor_interface_native",
183    "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc",
184  ]
185
186  external_deps = [
187    "c_utils:utils",
188    "eventhandler:libeventhandler",
189    "hilog:libhilog",
190    "ipc:ipc_single",
191  ]
192
193  relative_install_dir = "ndk"
194  part_name = "sensor"
195  subsystem_name = "sensors"
196}
197
198group("sensor_target") {
199  deps = [
200    ":libsensor_client",
201    ":sensor_interface_native",
202  ]
203}
204