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/sensor_service_stub.cpp", 27 "src/stream_server.cpp", 28 ] 29 30 include_dirs = [ 31 "$SUBSYSTEM_DIR/frameworks/native/include", 32 "$SUBSYSTEM_DIR/interfaces/inner_api", 33 "$SUBSYSTEM_DIR/services/include", 34 "$SUBSYSTEM_DIR/utils/common/include", 35 "$SUBSYSTEM_DIR/utils/ipc/include", 36 ] 37 38 branch_protector_ret = "pac_ret" 39 sanitize = { 40 cfi = true 41 cfi_cross_dso = true 42 debug = false 43 } 44 45 defines = sensor_default_defines 46 47 deps = [ 48 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 49 "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc", 50 ] 51 52 if (sensor_rust_socket_ipc) { 53 deps += 54 [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ] 55 } 56 57 external_deps = [ 58 "access_token:libaccesstoken_sdk", 59 "access_token:libtokenid_sdk", 60 "c_utils:utils", 61 "hilog:libhilog", 62 "hisysevent:libhisysevent", 63 "hitrace:hitrace_meter", 64 "ipc:ipc_single", 65 "safwk:system_ability_fwk", 66 "samgr:samgr_proxy", 67 ] 68 69 if (sensor_memmgr_enable) { 70 defines += [ "MEMMGR_ENABLE" ] 71 external_deps += [ "memmgr:memmgrclient" ] 72 } 73 74 if (hdf_drivers_interface_sensor) { 75 sources += [ 76 "hdi_connection/adapter/src/hdi_connection.cpp", 77 "hdi_connection/adapter/src/sensor_event_callback.cpp", 78 "hdi_connection/interface/src/sensor_hdi_connection.cpp", 79 "src/sensor_data_processer.cpp", 80 ] 81 82 include_dirs += [ 83 "$SUBSYSTEM_DIR/services/hdi_connection/interface/include", 84 "$SUBSYSTEM_DIR/services/hdi_connection/adapter/include", 85 ] 86 87 if (sensor_build_eng) { 88 sources += [ 89 "hdi_connection/adapter/src/compatible_connection.cpp", 90 "hdi_connection/hardware/src/hdi_service_impl.cpp", 91 ] 92 93 include_dirs += 94 [ "$SUBSYSTEM_DIR/services/hdi_connection/hardware/include" ] 95 } 96 97 external_deps += [ "drivers_interface_sensor:libsensor_proxy_2.0" ] 98 } 99 100 shlib_type = "sa" 101 part_name = "sensor" 102 subsystem_name = "sensors" 103} 104 105########################################################################## 106ohos_static_library("libsensor_service_static") { 107 sources = [ 108 "src/client_info.cpp", 109 "src/fifo_cache_data.cpp", 110 "src/flush_info_record.cpp", 111 "src/sensor_dump.cpp", 112 "src/sensor_manager.cpp", 113 "src/sensor_power_policy.cpp", 114 "src/sensor_service.cpp", 115 "src/sensor_service_stub.cpp", 116 "src/stream_server.cpp", 117 ] 118 119 include_dirs = [ 120 "$SUBSYSTEM_DIR/frameworks/native/include", 121 "$SUBSYSTEM_DIR/interfaces/inner_api", 122 "$SUBSYSTEM_DIR/services/include", 123 "$SUBSYSTEM_DIR/utils/common/include", 124 "$SUBSYSTEM_DIR/utils/ipc/include", 125 ] 126 127 branch_protector_ret = "pac_ret" 128 sanitize = { 129 cfi = true 130 cfi_cross_dso = true 131 debug = false 132 } 133 134 defines = sensor_default_defines 135 136 deps = [ 137 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 138 "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc", 139 ] 140 141 if (sensor_rust_socket_ipc) { 142 deps += 143 [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ] 144 } 145 146 external_deps = [ 147 "access_token:libaccesstoken_sdk", 148 "access_token:libtokenid_sdk", 149 "c_utils:utils", 150 "hilog:libhilog", 151 "hisysevent:libhisysevent", 152 "hitrace:hitrace_meter", 153 "ipc:ipc_single", 154 "safwk:system_ability_fwk", 155 "samgr:samgr_proxy", 156 ] 157 158 if (sensor_memmgr_enable) { 159 defines += [ "MEMMGR_ENABLE" ] 160 external_deps += [ "memmgr:memmgrclient" ] 161 } 162 163 if (hdf_drivers_interface_sensor) { 164 sources += [ 165 "hdi_connection/adapter/src/hdi_connection.cpp", 166 "hdi_connection/adapter/src/sensor_event_callback.cpp", 167 "hdi_connection/interface/src/sensor_hdi_connection.cpp", 168 "src/sensor_data_processer.cpp", 169 ] 170 171 include_dirs += [ 172 "$SUBSYSTEM_DIR/services/hdi_connection/interface/include", 173 "$SUBSYSTEM_DIR/services/hdi_connection/adapter/include", 174 ] 175 176 if (sensor_build_eng) { 177 sources += [ 178 "hdi_connection/adapter/src/compatible_connection.cpp", 179 "hdi_connection/hardware/src/hdi_service_impl.cpp", 180 ] 181 182 include_dirs += 183 [ "$SUBSYSTEM_DIR/services/hdi_connection/hardware/include" ] 184 } 185 186 external_deps += [ "drivers_interface_sensor:libsensor_proxy_2.0" ] 187 } 188 189 part_name = "sensor" 190 subsystem_name = "sensors" 191} 192group("sensor_service_target") { 193 deps = [ 194 ":libsensor_service", 195 ":libsensor_service_static", 196 ] 197} 198