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