1# Copyright (c) 2022 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("./../../../miscdevice.gni") 16 17ohos_ndk_library("liblight_ndk") { 18 output_name = "light_agent" 19 ndk_description_file = "./liblight.json" 20 min_compact_version = "7" 21} 22 23ohos_ndk_headers("light_ndk_header") { 24 dest_dir = "$ndk_headers_out_dir/sensors" 25 sources = [ 26 "$SUBSYSTEM_DIR/interfaces/inner_api/light/light_agent.h", 27 "$SUBSYSTEM_DIR/interfaces/inner_api/light/light_agent_type.h", 28 ] 29} 30 31config("light_config") { 32 include_dirs = [ "$SUBSYSTEM_DIR/interfaces/inner_api/light" ] 33} 34 35ohos_shared_library("light_interface_native") { 36 output_name = "light_agent" 37 sources = [ "light_agent.cpp" ] 38 39 include_dirs = [ 40 "$SUBSYSTEM_DIR/interfaces/inner_api/light", 41 "$SUBSYSTEM_DIR/utils/common/include", 42 "include", 43 ] 44 45 branch_protector_ret = "pac_ret" 46 sanitize = { 47 cfi = true 48 cfi_cross_dso = true 49 debug = false 50 } 51 52 cflags = [ "-Wno-error=inconsistent-missing-override" ] 53 54 deps = [ 55 "$SUBSYSTEM_DIR/frameworks/native/light:liblight_native", 56 "$SUBSYSTEM_DIR/frameworks/native/light:liblight_ndk", 57 "$SUBSYSTEM_DIR/frameworks/native/light:light_ndk_header", 58 "$SUBSYSTEM_DIR/frameworks/native/vibrator:miscdevice_service_file_h", 59 ] 60 61 external_deps = [ 62 "c_utils:utils", 63 "hilog:libhilog", 64 "ipc:ipc_single", 65 ] 66 67 public_configs = [ ":light_config" ] 68 innerapi_tags = [ "platformsdk" ] 69 part_name = "miscdevice" 70 subsystem_name = "sensors" 71} 72 73ohos_shared_library("liblight_native") { 74 sources = [ "src/light_client.cpp" ] 75 76 include_dirs = [ 77 "include", 78 "$SUBSYSTEM_DIR/interfaces/inner_api/light", 79 "$SUBSYSTEM_DIR/utils/common/include", 80 ] 81 82 branch_protector_ret = "pac_ret" 83 sanitize = { 84 cfi = true 85 cfi_cross_dso = true 86 debug = false 87 } 88 89 cflags = [ "-fstack-protector-all" ] 90 91 deps = [ 92 "$SUBSYSTEM_DIR/frameworks/native/light:light_ndk_header", 93 "$SUBSYSTEM_DIR/frameworks/native/vibrator:miscdevice_service_proxy", 94 "$SUBSYSTEM_DIR/utils/common:libmiscdevice_utils", 95 ] 96 97 external_deps = [ 98 "c_utils:utils", 99 "hilog:libhilog", 100 "ipc:ipc_single", 101 "samgr:samgr_proxy", 102 ] 103 104 if (miscdevice_feature_hiviewdfx_hisysevent) { 105 external_deps += [ "hisysevent:libhisysevent" ] 106 } 107 108 defines = miscdevice_default_defines 109 110 innerapi_tags = [ "platformsdk_indirect" ] 111 part_name = "miscdevice" 112 subsystem_name = "sensors" 113} 114 115group("light_target") { 116 deps = [ 117 ":liblight_native", 118 ":light_interface_native", 119 ] 120} 121