179a732c7Sopenharmony_ci# Copyright (c) 2022-2024 Huawei Device Co., Ltd.
279a732c7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
379a732c7Sopenharmony_ci# you may not use this file except in compliance with the License.
479a732c7Sopenharmony_ci# You may obtain a copy of the License at
579a732c7Sopenharmony_ci#
679a732c7Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
779a732c7Sopenharmony_ci#
879a732c7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
979a732c7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1079a732c7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1179a732c7Sopenharmony_ci# See the License for the specific language governing permissions and
1279a732c7Sopenharmony_ci# limitations under the License.
1379a732c7Sopenharmony_ci
1479a732c7Sopenharmony_ciif (defined(ohos_lite)) {
1579a732c7Sopenharmony_ci  import("//build/lite/config/component/lite_component.gni")
1679a732c7Sopenharmony_ci} else {
1779a732c7Sopenharmony_ci  import("//build/ohos.gni")
1879a732c7Sopenharmony_ci}
1979a732c7Sopenharmony_ci
2079a732c7Sopenharmony_ciimport("//foundation/distributedhardware/device_manager/device_manager.gni")
2179a732c7Sopenharmony_ci
2279a732c7Sopenharmony_ciif (defined(ohos_lite)) {
2379a732c7Sopenharmony_ci  if (ohos_kernel_type == "linux") {
2479a732c7Sopenharmony_ci    shared_library("devicemanagerutils") {
2579a732c7Sopenharmony_ci      include_dirs = [
2679a732c7Sopenharmony_ci        "include",
2779a732c7Sopenharmony_ci        "include/crypto",
2879a732c7Sopenharmony_ci        "include/fwkload/lite",
2979a732c7Sopenharmony_ci        "include/appInfo/lite",
3079a732c7Sopenharmony_ci        "include/timer/lite",
3179a732c7Sopenharmony_ci        "${common_path}/include",
3279a732c7Sopenharmony_ci        "${common_path}/include/dfx",
3379a732c7Sopenharmony_ci        "${common_path}/include/dfx/lite",
3479a732c7Sopenharmony_ci        "${common_path}/include/ipc",
3579a732c7Sopenharmony_ci        "${common_path}/include/ipc/lite",
3679a732c7Sopenharmony_ci        "${common_path}/include/ipc/model",
3779a732c7Sopenharmony_ci        "${innerkits_path}/native_cpp/include",
3879a732c7Sopenharmony_ci        "${interfaces_path}/c/ipc/include",
3979a732c7Sopenharmony_ci        "//third_party/json/include",
4079a732c7Sopenharmony_ci        "//third_party/bounds_checking_function/include",
4179a732c7Sopenharmony_ci      ]
4279a732c7Sopenharmony_ci
4379a732c7Sopenharmony_ci      sources = [
4479a732c7Sopenharmony_ci        "${common_path}/src/dfx/lite/dm_hidumper.cpp",
4579a732c7Sopenharmony_ci        "${common_path}/src/dfx/lite/dm_hisysevent.cpp",
4679a732c7Sopenharmony_ci        "${common_path}/src/dfx/lite/dm_hitrace.cpp",
4779a732c7Sopenharmony_ci        "${common_path}/src/dm_anonymous.cpp",
4879a732c7Sopenharmony_ci        "${common_path}/src/dm_error_message.cpp",
4979a732c7Sopenharmony_ci        "${common_path}/src/ipc/lite/ipc_cmd_register.cpp",
5079a732c7Sopenharmony_ci        "src/appInfo/lite/app_manager.cpp",
5179a732c7Sopenharmony_ci        "src/crypto/dm_crypto.cpp",
5279a732c7Sopenharmony_ci        "src/dm_random.cpp",
5379a732c7Sopenharmony_ci        "src/fwkload/lite/dm_distributed_hardware_load.cpp",
5479a732c7Sopenharmony_ci        "src/timer/lite/dm_timer.cpp",
5579a732c7Sopenharmony_ci      ]
5679a732c7Sopenharmony_ci
5779a732c7Sopenharmony_ci      defines = [
5879a732c7Sopenharmony_ci        "LITE_DEVICE",
5979a732c7Sopenharmony_ci        "hI_LOG_ENABLE",
6079a732c7Sopenharmony_ci        "DH_LOG_TAG=\"devicemanagerutils\"",
6179a732c7Sopenharmony_ci        "lOG_DOMAIN=0xD004110",
6279a732c7Sopenharmony_ci      ]
6379a732c7Sopenharmony_ci
6479a732c7Sopenharmony_ci      deps = [
6579a732c7Sopenharmony_ci        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
6679a732c7Sopenharmony_ci        "//third_party/bounds_checking_function:libsec_shared",
6779a732c7Sopenharmony_ci        "//third_party/openssl:libcrypto_shared",
6879a732c7Sopenharmony_ci      ]
6979a732c7Sopenharmony_ci    }
7079a732c7Sopenharmony_ci  }
7179a732c7Sopenharmony_ci} else {
7279a732c7Sopenharmony_ci  config("devicemanagerutils_config") {
7379a732c7Sopenharmony_ci    include_dirs = [
7479a732c7Sopenharmony_ci      "include",
7579a732c7Sopenharmony_ci      "include/crypto",
7679a732c7Sopenharmony_ci      "include/kvadapter",
7779a732c7Sopenharmony_ci      "include/fwkload/standard",
7879a732c7Sopenharmony_ci      "include/appInfo/standard",
7979a732c7Sopenharmony_ci      "include/timer",
8079a732c7Sopenharmony_ci      "${innerkits_path}/native_cpp/include",
8179a732c7Sopenharmony_ci      "${common_path}/include",
8279a732c7Sopenharmony_ci    ]
8379a732c7Sopenharmony_ci  }
8479a732c7Sopenharmony_ci
8579a732c7Sopenharmony_ci  ohos_shared_library("devicemanagerutils") {
8679a732c7Sopenharmony_ci    branch_protector_ret = "pac_ret"
8779a732c7Sopenharmony_ci
8879a732c7Sopenharmony_ci    sanitize = {
8979a732c7Sopenharmony_ci      boundary_sanitize = true
9079a732c7Sopenharmony_ci      cfi = true
9179a732c7Sopenharmony_ci      cfi_cross_dso = true
9279a732c7Sopenharmony_ci      debug = false
9379a732c7Sopenharmony_ci      integer_overflow = true
9479a732c7Sopenharmony_ci      ubsan = true
9579a732c7Sopenharmony_ci    }
9679a732c7Sopenharmony_ci
9779a732c7Sopenharmony_ci    sources = [
9879a732c7Sopenharmony_ci      "${common_path}/src/dm_anonymous.cpp",
9979a732c7Sopenharmony_ci      "src/appInfo/standard/app_manager.cpp",
10079a732c7Sopenharmony_ci      "src/crypto/dm_crypto.cpp",
10179a732c7Sopenharmony_ci      "src/dm_random.cpp",
10279a732c7Sopenharmony_ci      "src/kvadapter/dm_kv_info.cpp",
10379a732c7Sopenharmony_ci      "src/kvadapter/kv_adapter.cpp",
10479a732c7Sopenharmony_ci      "src/kvadapter/kv_adapter_manager.cpp",
10579a732c7Sopenharmony_ci      "src/timer/dm_timer.cpp",
10679a732c7Sopenharmony_ci    ]
10779a732c7Sopenharmony_ci
10879a732c7Sopenharmony_ci    if (support_jsapi) {
10979a732c7Sopenharmony_ci      sources += [ "src/fwkload/standard/dm_distributed_hardware_load.cpp" ]
11079a732c7Sopenharmony_ci    }
11179a732c7Sopenharmony_ci
11279a732c7Sopenharmony_ci    public_configs = [ ":devicemanagerutils_config" ]
11379a732c7Sopenharmony_ci
11479a732c7Sopenharmony_ci    defines = [
11579a732c7Sopenharmony_ci      "HI_LOG_ENABLE",
11679a732c7Sopenharmony_ci      "DH_LOG_TAG=\"devicemanagerutils\"",
11779a732c7Sopenharmony_ci      "LOG_DOMAIN=0xD004110",
11879a732c7Sopenharmony_ci    ]
11979a732c7Sopenharmony_ci
12079a732c7Sopenharmony_ci    external_deps = [
12179a732c7Sopenharmony_ci      "access_token:libaccesstoken_sdk",
12279a732c7Sopenharmony_ci      "bundle_framework:appexecfwk_base",
12379a732c7Sopenharmony_ci      "bundle_framework:appexecfwk_core",
12479a732c7Sopenharmony_ci      "cJSON:cjson",
12579a732c7Sopenharmony_ci      "c_utils:utils",
12679a732c7Sopenharmony_ci      "eventhandler:libeventhandler",
12779a732c7Sopenharmony_ci      "ffrt:libffrt",
12879a732c7Sopenharmony_ci      "hilog:libhilog",
12979a732c7Sopenharmony_ci      "ipc:ipc_core",
13079a732c7Sopenharmony_ci      "ipc:ipc_single",
13179a732c7Sopenharmony_ci      "openssl:libcrypto_shared",
13279a732c7Sopenharmony_ci      "os_account:os_account_innerkits",
13379a732c7Sopenharmony_ci      "samgr:samgr_proxy",
13479a732c7Sopenharmony_ci    ]
13579a732c7Sopenharmony_ci
13679a732c7Sopenharmony_ci    public_external_deps = [
13779a732c7Sopenharmony_ci      "bundle_framework:appexecfwk_core",
13879a732c7Sopenharmony_ci      "json:nlohmann_json_static",
13979a732c7Sopenharmony_ci      "kv_store:distributeddata_inner",
14079a732c7Sopenharmony_ci    ]
14179a732c7Sopenharmony_ci
14279a732c7Sopenharmony_ci    if (support_jsapi) {
14379a732c7Sopenharmony_ci      external_deps += [ "bundle_framework:appexecfwk_core" ]
14479a732c7Sopenharmony_ci    }
14579a732c7Sopenharmony_ci
14679a732c7Sopenharmony_ci    subsystem_name = "distributedhardware"
14779a732c7Sopenharmony_ci
14879a732c7Sopenharmony_ci    part_name = "device_manager"
14979a732c7Sopenharmony_ci  }
15079a732c7Sopenharmony_ci}
151