# Copyright (c) 2025-2026 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if (defined(ohos_lite)) {
import("//build/lite/config/component/lite_component.gni")
} else {
import("//build/ohos.gni")
}
import("//foundation/distributedhardware/device_manager/device_manager.gni")
if (defined(ohos_lite) || !support_jsapi) {
if (defined(ohos_kernel_type) && ohos_kernel_type == "liteos_m") {
static_library("devicemanager_ndk") {
include_dirs = []
sources = []
deps = []
cflags = [
"-Wall",
"-O2",
"-std=c99",
"-Wdate-time",
"-Wextra",
"-Wfloat-equal",
]
cflags_cc = cflags
}
} else {
shared_library("devicemanager_ndk") {
include_dirs = []
sources = []
defines = [
"LITE_DEVICE",
"HI_LOG_ENABLE",
"DH_LOG_TAG=\"dm_ndk\"",
"LOG_DOMAIN=0xD004110",
]
deps = []
}
}
} else {
ohos_shared_library("devicemanager_ndk") {
branch_protector_ret = "pac_ret"
sanitize = {
integer_overflow = true
ubsan = true
boundary_sanitize = true
cfi = true
cfi_cross_dso = true
debug = false
}
include_dirs = [
"include",
"${common_path}/include",
"${common_path}/include/ipc",
"${innerkits_path}/native_cpp/include",
]
if (!device_manager_capability) {
sources = [
"src/dm_client_fail_to_support.cpp",
]
} else {
sources = [
"src/dm_client.cpp",
"src/oh_device_manager.cpp",
]
}
defines = [
"HI_LOG_ENABLE",
"DH_LOG_TAG=\"dm_ndk\"",
"LOG_DOMAIN=0xD004110",
]
deps = [
"${innerkits_path}/native_cpp:devicemanagersdk",
"${utils_path}:devicemanagerutils",
]
external_deps = [
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"eventhandler:libeventhandler",
"hilog:libhilog",
"ipc:ipc_core",
]
relative_install_dir = "ndk"
subsystem_name = "distributedhardware"
part_name = "device_manager"
output_extension = "so"
}
}