1# Copyright (c) 2025 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 14if (defined(ohos_lite)) { 15 import("//build/lite/config/component/lite_component.gni") 16} else { 17 import("//build/ohos.gni") 18} 19import("//foundation/distributedhardware/device_manager/device_manager.gni") 20 21if (defined(ohos_lite)) { 22 if (ohos_kernel_type == "liteos_m") { 23 static_library("devicemanager_ndk") { 24 include_dirs = [] 25 26 sources = [] 27 28 deps = [] 29 30 cflags = [ 31 "-Wall", 32 "-O2", 33 "-std=c99", 34 "-Wdate-time", 35 "-Wextra", 36 "-Wfloat-equal", 37 ] 38 cflags_cc = cflags 39 } 40 } else { 41 shared_library("devicemanager_ndk") { 42 include_dirs = [] 43 44 sources = [] 45 46 defines = [ 47 "LITE_DEVICE", 48 "HI_LOG_ENABLE", 49 "DH_LOG_TAG=\"devicemanager_ndk\"", 50 "LOG_DOMAIN=0xD004110", 51 ] 52 53 deps = [] 54 } 55 } 56} else { 57 ohos_shared_library("devicemanager_ndk") { 58 branch_protector_ret = "pac_ret" 59 sanitize = { 60 integer_overflow = true 61 ubsan = true 62 boundary_sanitize = true 63 cfi = true 64 cfi_cross_dso = true 65 debug = false 66 } 67 68 include_dirs = [ 69 "include", 70 "${common_path}/include", 71 "${common_path}/include/ipc", 72 "${innerkits_path}/native_cpp/include", 73 ] 74 sources = [ 75 "src/dm_client.cpp", 76 "src/oh_device_manager.cpp", 77 ] 78 79 defines = [ 80 "HI_LOG_ENABLE", 81 "DH_LOG_TAG=\"devicemanager_ndk\"", 82 "LOG_DOMAIN=0xD004110", 83 ] 84 85 deps = [ 86 "${innerkits_path}/native_cpp:devicemanagersdk", 87 "${utils_path}:devicemanagerutils", 88 ] 89 90 external_deps = [ 91 "c_utils:utils", 92 "eventhandler:libeventhandler", 93 "hilog:libhilog", 94 "ipc:ipc_core", 95 ] 96 97 relative_install_dir = "ndk" 98 subsystem_name = "distributedhardware" 99 part_name = "device_manager" 100 output_extension = "so" 101 } 102} 103