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/ohos.gni") 15import("./../../sensor.gni") 16 17ohos_shared_library("libsensor_client") { 18 sources = [ 19 "src/fd_listener.cpp", 20 "src/sensor_agent_proxy.cpp", 21 "src/sensor_client_stub.cpp", 22 "src/sensor_data_channel.cpp", 23 "src/sensor_event_handler.cpp", 24 "src/sensor_file_descriptor_listener.cpp", 25 "src/sensor_service_client.cpp", 26 "src/sensor_service_proxy.cpp", 27 ] 28 29 include_dirs = [ 30 "$SUBSYSTEM_DIR/frameworks/native/include", 31 "$SUBSYSTEM_DIR/interfaces/inner_api", 32 "$SUBSYSTEM_DIR/utils/common/include", 33 "$SUBSYSTEM_DIR/utils/ipc/include", 34 ] 35 36 branch_protector_ret = "pac_ret" 37 sanitize = { 38 cfi = true 39 cfi_cross_dso = true 40 debug = false 41 } 42 43 defines = sensor_default_defines 44 45 deps = [ 46 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 47 "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc", 48 ] 49 50 if (sensor_rust_socket_ipc) { 51 deps += 52 [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ] 53 } 54 55 external_deps = [ 56 "c_utils:utils", 57 "eventhandler:libeventhandler", 58 "hilog:libhilog", 59 "hisysevent:libhisysevent", 60 "hitrace:hitrace_meter", 61 "ipc:ipc_single", 62 "samgr:samgr_proxy", 63 ] 64 65 innerapi_tags = [ "platformsdk_indirect" ] 66 part_name = "sensor" 67 subsystem_name = "sensors" 68} 69ohos_ndk_library("libsensor_ndk") { 70 output_name = "sensor" 71 ndk_description_file = "./libsensor.json" 72 min_compact_version = "6" 73} 74 75config("sensor_private_config") { 76 include_dirs = [ 77 "$SUBSYSTEM_DIR/frameworks/native/include", 78 "$SUBSYSTEM_DIR/interfaces/inner_api", 79 "$SUBSYSTEM_DIR/utils/common/include", 80 ] 81} 82config("sensor_public_config") { 83 include_dirs = [ "$SUBSYSTEM_DIR/interfaces/inner_api" ] 84} 85 86ohos_shared_library("sensor_interface_native") { 87 output_name = "sensor_agent" 88 sources = [ 89 "src/geomagnetic_field.cpp", 90 "src/sensor_agent.cpp", 91 "src/sensor_algorithm.cpp", 92 ] 93 94 branch_protector_ret = "pac_ret" 95 sanitize = { 96 cfi = true 97 cfi_cross_dso = true 98 debug = false 99 boundary_sanitize = true 100 integer_overflow = true 101 ubsan = true 102 } 103 104 configs = [ ":sensor_private_config" ] 105 public_configs = [ ":sensor_public_config" ] 106 107 deps = [ 108 "$SUBSYSTEM_DIR/frameworks/native:libsensor_client", 109 "$SUBSYSTEM_DIR/frameworks/native:libsensor_ndk", 110 ] 111 112 external_deps = [ 113 "c_utils:utils", 114 "eventhandler:libeventhandler", 115 "hilog:libhilog", 116 "ipc:ipc_single", 117 "safwk:system_ability_fwk", 118 ] 119 120 part_name = "sensor" 121 innerapi_tags = [ "platformsdk" ] 122 subsystem_name = "sensors" 123} 124 125config("ohsensor_public_config") { 126 include_dirs = [ "$SUBSYSTEM_DIR/interfaces/kits/c" ] 127} 128 129ohos_shared_library("ohsensor") { 130 sources = [ "src/native_sensor.cpp" ] 131 output_extension = "so" 132 defines = [ "API_EXPORT=__attribute__((visibility (\"default\")))" ] 133 134 configs = [ ":sensor_private_config" ] 135 public_configs = [ ":ohsensor_public_config" ] 136 137 branch_protector_ret = "pac_ret" 138 sanitize = { 139 cfi = true 140 cfi_cross_dso = true 141 debug = false 142 } 143 144 deps = [ 145 "$SUBSYSTEM_DIR/frameworks/native:libsensor_client", 146 "$SUBSYSTEM_DIR/frameworks/native:libsensor_ndk", 147 "$SUBSYSTEM_DIR/frameworks/native:sensor_interface_native", 148 "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc", 149 ] 150 151 external_deps = [ 152 "c_utils:utils", 153 "eventhandler:libeventhandler", 154 "hilog:libhilog", 155 "ipc:ipc_single", 156 "safwk:system_ability_fwk", 157 ] 158 159 relative_install_dir = "ndk" 160 part_name = "sensor" 161 subsystem_name = "sensors" 162} 163 164group("sensor_target") { 165 deps = [ 166 ":libsensor_client", 167 ":sensor_interface_native", 168 ] 169} 170