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/frameworks/native/common/include", 41 "$SUBSYSTEM_DIR/interfaces/inner_api/light", 42 "$SUBSYSTEM_DIR/utils/common/include", 43 "include", 44 ] 45 46 branch_protector_ret = "pac_ret" 47 sanitize = { 48 cfi = true 49 cfi_cross_dso = true 50 debug = false 51 } 52 53 cflags = [ "-Wno-error=inconsistent-missing-override" ] 54 55 deps = [ 56 "$SUBSYSTEM_DIR/frameworks/native/light:liblight_native", 57 "$SUBSYSTEM_DIR/frameworks/native/light:liblight_ndk", 58 "$SUBSYSTEM_DIR/frameworks/native/light:light_ndk_header", 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 = [ 75 "$SUBSYSTEM_DIR/frameworks/native/common/src/miscdevice_service_proxy.cpp", 76 "src/light_client.cpp", 77 ] 78 79 include_dirs = [ 80 "include", 81 "$SUBSYSTEM_DIR/frameworks/native/common/include", 82 "$SUBSYSTEM_DIR/interfaces/inner_api/light", 83 "$SUBSYSTEM_DIR/utils/common/include", 84 ] 85 86 branch_protector_ret = "pac_ret" 87 sanitize = { 88 cfi = true 89 cfi_cross_dso = true 90 debug = false 91 } 92 93 cflags = [ "-fstack-protector-all" ] 94 95 deps = [ 96 "$SUBSYSTEM_DIR/frameworks/native/light:light_ndk_header", 97 "$SUBSYSTEM_DIR/utils/common:libmiscdevice_utils", 98 ] 99 100 external_deps = [ 101 "c_utils:utils", 102 "hilog:libhilog", 103 "hisysevent:libhisysevent", 104 "ipc:ipc_single", 105 "samgr:samgr_proxy", 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