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    executable("devicemanagerservice") {
2579a732c7Sopenharmony_ci      include_dirs = [
2679a732c7Sopenharmony_ci        "include",
2779a732c7Sopenharmony_ci        "include/advertise",
2879a732c7Sopenharmony_ci        "include/discovery",
2979a732c7Sopenharmony_ci        "include/softbus",
3079a732c7Sopenharmony_ci        "include/ipc/lite",
3179a732c7Sopenharmony_ci        "include/permission/lite",
3279a732c7Sopenharmony_ci        "include/pinholder",
3379a732c7Sopenharmony_ci        "include/relationshipsyncmgr",
3479a732c7Sopenharmony_ci        "${common_path}/include",
3579a732c7Sopenharmony_ci        "${common_path}/include/ipc",
3679a732c7Sopenharmony_ci        "${common_path}/include/ipc/lite",
3779a732c7Sopenharmony_ci        "${common_path}/include/ipc/model",
3879a732c7Sopenharmony_ci        "${common_path}/include/dfx",
3979a732c7Sopenharmony_ci        "${common_path}/include/dfx/lite",
4079a732c7Sopenharmony_ci        "${utils_path}/include",
4179a732c7Sopenharmony_ci        "${utils_path}/include/appInfo/lite",
4279a732c7Sopenharmony_ci        "${utils_path}/include/crypto",
4379a732c7Sopenharmony_ci        "${utils_path}/include/fwkload/lite",
4479a732c7Sopenharmony_ci        "${utils_path}/include/kvadapter",
4579a732c7Sopenharmony_ci        "${utils_path}/include/timer/lite",
4679a732c7Sopenharmony_ci        "${innerkits_path}/native_cpp/include",
4779a732c7Sopenharmony_ci        "${innerkits_path}/native_cpp/include/ipc",
4879a732c7Sopenharmony_ci        "${innerkits_path}/native_cpp/include/ipc/lite",
4979a732c7Sopenharmony_ci        "//third_party/json/include",
5079a732c7Sopenharmony_ci        "//third_party/bounds_checking_function/include",
5179a732c7Sopenharmony_ci        "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog",
5279a732c7Sopenharmony_ci        "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
5379a732c7Sopenharmony_ci        "${interfaces_path}/c/ipc/include",
5479a732c7Sopenharmony_ci        "//foundation/distributedshedule/samgr_lite/interfaces/kits/samgr",
5579a732c7Sopenharmony_ci        "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include",
5679a732c7Sopenharmony_ci        "${devicemanager_path}/radar/include",
5779a732c7Sopenharmony_ci        "${softbuscache_parh}/include",
5879a732c7Sopenharmony_ci      ]
5979a732c7Sopenharmony_ci
6079a732c7Sopenharmony_ci      sources = [
6179a732c7Sopenharmony_ci        "${common_path}/src/dm_anonymous.cpp",
6279a732c7Sopenharmony_ci        "src/advertise/advertise_manager.cpp",
6379a732c7Sopenharmony_ci        "src/device_manager_service.cpp",
6479a732c7Sopenharmony_ci        "src/device_manager_service_listener.cpp",
6579a732c7Sopenharmony_ci        "src/discovery/discovery_filter.cpp",
6679a732c7Sopenharmony_ci        "src/discovery/discovery_manager.cpp",
6779a732c7Sopenharmony_ci        "src/ipc/lite/ipc_cmd_parser.cpp",
6879a732c7Sopenharmony_ci        "src/ipc/lite/ipc_server_listener.cpp",
6979a732c7Sopenharmony_ci        "src/ipc/lite/ipc_server_listenermgr.cpp",
7079a732c7Sopenharmony_ci        "src/ipc/lite/ipc_server_main.cpp",
7179a732c7Sopenharmony_ci        "src/ipc/lite/ipc_server_stub.cpp",
7279a732c7Sopenharmony_ci        "src/permission/lite/permission_manager.cpp",
7379a732c7Sopenharmony_ci        "src/pinholder/pin_holder.cpp",
7479a732c7Sopenharmony_ci        "src/pinholder/pin_holder_session.cpp",
7579a732c7Sopenharmony_ci        "src/relationshipsyncmgr/relationship_sync_mgr.cpp",
7679a732c7Sopenharmony_ci        "src/softbus/mine_softbus_listener.cpp",
7779a732c7Sopenharmony_ci        "src/softbus/softbus_listener.cpp",
7879a732c7Sopenharmony_ci      ]
7979a732c7Sopenharmony_ci
8079a732c7Sopenharmony_ci      defines = [
8179a732c7Sopenharmony_ci        "LITE_DEVICE",
8279a732c7Sopenharmony_ci        "HI_LOG_ENABLE",
8379a732c7Sopenharmony_ci        "DH_LOG_TAG=\"devicemanagerservice\"",
8479a732c7Sopenharmony_ci        "LOG_DOMAIN=0xD004110",
8579a732c7Sopenharmony_ci      ]
8679a732c7Sopenharmony_ci
8779a732c7Sopenharmony_ci      deps = [
8879a732c7Sopenharmony_ci        "${devicemanager_path}/radar:devicemanagerradar",
8979a732c7Sopenharmony_ci        "${softbuscache_parh}:dmdevicecache",
9079a732c7Sopenharmony_ci        "${utils_path}:devicemanagerutils",
9179a732c7Sopenharmony_ci        "//base/security/device_auth/services:deviceauth_sdk",
9279a732c7Sopenharmony_ci        "//base/startup/init/interfaces/innerkits:libbegetutil",
9379a732c7Sopenharmony_ci        "//commonlibrary/utils_lite:utils",
9479a732c7Sopenharmony_ci        "//foundation/communication/dsoftbus:dsoftbus",
9579a732c7Sopenharmony_ci        "//foundation/systemabilitymgr/safwk_lite:safwk_lite",
9679a732c7Sopenharmony_ci        "//foundation/systemabilitymgr/samgr_lite/samgr:samgr",
9779a732c7Sopenharmony_ci        "//third_party/bounds_checking_function:libsec_shared",
9879a732c7Sopenharmony_ci        "//third_party/openssl:libcrypto_shared",
9979a732c7Sopenharmony_ci      ]
10079a732c7Sopenharmony_ci
10179a732c7Sopenharmony_ci      cflags = [
10279a732c7Sopenharmony_ci        "-Wall",
10379a732c7Sopenharmony_ci        "-O2",
10479a732c7Sopenharmony_ci        "-Wdate-time",
10579a732c7Sopenharmony_ci        "-Wextra",
10679a732c7Sopenharmony_ci        "-Wfloat-equal",
10779a732c7Sopenharmony_ci        "-Wshadow",
10879a732c7Sopenharmony_ci      ]
10979a732c7Sopenharmony_ci
11079a732c7Sopenharmony_ci      cflags_cc = cflags
11179a732c7Sopenharmony_ci    }
11279a732c7Sopenharmony_ci  }
11379a732c7Sopenharmony_ci} else if (!support_jsapi) {
11479a732c7Sopenharmony_ci  group("devicemanagerservice") {
11579a732c7Sopenharmony_ci    deps = []
11679a732c7Sopenharmony_ci  }
11779a732c7Sopenharmony_ci} else {
11879a732c7Sopenharmony_ci  config("devicemanagerservice_config") {
11979a732c7Sopenharmony_ci    include_dirs = [
12079a732c7Sopenharmony_ci      "include",
12179a732c7Sopenharmony_ci      "include/advertise",
12279a732c7Sopenharmony_ci      "include/devicenamemgr",
12379a732c7Sopenharmony_ci      "include/discovery",
12479a732c7Sopenharmony_ci      "include/ipc",
12579a732c7Sopenharmony_ci      "include/ipc/standard",
12679a732c7Sopenharmony_ci      "include/permission/standard",
12779a732c7Sopenharmony_ci      "include/pinholder",
12879a732c7Sopenharmony_ci      "include/publishcommonevent",
12979a732c7Sopenharmony_ci      "include/relationshipsyncmgr",
13079a732c7Sopenharmony_ci      "include/softbus",
13179a732c7Sopenharmony_ci      "${common_path}/include",
13279a732c7Sopenharmony_ci      "${common_path}/include/dfx",
13379a732c7Sopenharmony_ci      "${common_path}/include/dfx/standard",
13479a732c7Sopenharmony_ci      "${common_path}/include/ipc",
13579a732c7Sopenharmony_ci      "${common_path}/include/ipc/model",
13679a732c7Sopenharmony_ci      "${common_path}/include/ipc/standard",
13779a732c7Sopenharmony_ci      "${devicemanager_path}/commondependency/include",
13879a732c7Sopenharmony_ci      "${devicemanager_path}/radar/include",
13979a732c7Sopenharmony_ci      "${innerkits_path}/native_cpp/include",
14079a732c7Sopenharmony_ci      "${softbuscache_parh}/include",
14179a732c7Sopenharmony_ci      "${utils_path}/include/appInfo/standard",
14279a732c7Sopenharmony_ci      "${utils_path}/include/crypto",
14379a732c7Sopenharmony_ci      "${utils_path}/include/kvadapter",
14479a732c7Sopenharmony_ci      "${utils_path}/include/timer",
14579a732c7Sopenharmony_ci    ]
14679a732c7Sopenharmony_ci  }
14779a732c7Sopenharmony_ci
14879a732c7Sopenharmony_ci  ohos_shared_library("devicemanagerservice") {
14979a732c7Sopenharmony_ci    branch_protector_ret = "pac_ret"
15079a732c7Sopenharmony_ci
15179a732c7Sopenharmony_ci    sanitize = {
15279a732c7Sopenharmony_ci      boundary_sanitize = true
15379a732c7Sopenharmony_ci      cfi = true
15479a732c7Sopenharmony_ci      cfi_cross_dso = true
15579a732c7Sopenharmony_ci      debug = false
15679a732c7Sopenharmony_ci      integer_overflow = true
15779a732c7Sopenharmony_ci      ubsan = true
15879a732c7Sopenharmony_ci    }
15979a732c7Sopenharmony_ci
16079a732c7Sopenharmony_ci    sources = [
16179a732c7Sopenharmony_ci      "${common_path}/src/dfx/standard/dm_hidumper.cpp",
16279a732c7Sopenharmony_ci      "${common_path}/src/dm_anonymous.cpp",
16379a732c7Sopenharmony_ci      "${common_path}/src/ipc/standard/ipc_cmd_register.cpp",
16479a732c7Sopenharmony_ci      "src/advertise/advertise_manager.cpp",
16579a732c7Sopenharmony_ci      "src/device_manager_service.cpp",
16679a732c7Sopenharmony_ci      "src/device_manager_service_listener.cpp",
16779a732c7Sopenharmony_ci      "src/devicenamemgr/account_boot_listener.cpp",
16879a732c7Sopenharmony_ci      "src/devicenamemgr/local_device_name_mgr.cpp",
16979a732c7Sopenharmony_ci      "src/devicenamemgr/settings_data_event_monitor.cpp",
17079a732c7Sopenharmony_ci      "src/discovery/discovery_filter.cpp",
17179a732c7Sopenharmony_ci      "src/discovery/discovery_manager.cpp",
17279a732c7Sopenharmony_ci      "src/ipc/standard/ipc_cmd_parser.cpp",
17379a732c7Sopenharmony_ci      "src/ipc/standard/ipc_server_client_proxy.cpp",
17479a732c7Sopenharmony_ci      "src/ipc/standard/ipc_server_listener.cpp",
17579a732c7Sopenharmony_ci      "src/ipc/standard/ipc_server_stub.cpp",
17679a732c7Sopenharmony_ci      "src/permission/standard/permission_manager.cpp",
17779a732c7Sopenharmony_ci      "src/pinholder/pin_holder.cpp",
17879a732c7Sopenharmony_ci      "src/pinholder/pin_holder_session.cpp",
17979a732c7Sopenharmony_ci      "src/publishcommonevent/dm_account_common_event.cpp",
18079a732c7Sopenharmony_ci      "src/publishcommonevent/dm_data_share_common_event.cpp",
18179a732c7Sopenharmony_ci      "src/publishcommonevent/dm_package_common_event.cpp",
18279a732c7Sopenharmony_ci      "src/publishcommonevent/dm_screen_common_event.cpp",
18379a732c7Sopenharmony_ci      "src/relationshipsyncmgr/relationship_sync_mgr.cpp",
18479a732c7Sopenharmony_ci      "src/softbus/mine_softbus_listener.cpp",
18579a732c7Sopenharmony_ci      "src/softbus/softbus_listener.cpp",
18679a732c7Sopenharmony_ci    ]
18779a732c7Sopenharmony_ci
18879a732c7Sopenharmony_ci    public_configs = [ ":devicemanagerservice_config" ]
18979a732c7Sopenharmony_ci
19079a732c7Sopenharmony_ci    defines = [
19179a732c7Sopenharmony_ci      "HI_LOG_ENABLE",
19279a732c7Sopenharmony_ci      "DH_LOG_TAG=\"devicemanagerservice\"",
19379a732c7Sopenharmony_ci      "LOG_DOMAIN=0xD004110",
19479a732c7Sopenharmony_ci    ]
19579a732c7Sopenharmony_ci
19679a732c7Sopenharmony_ci    deps = [
19779a732c7Sopenharmony_ci      "${devicemanager_path}/commondependency:devicemanagerdependency",
19879a732c7Sopenharmony_ci      "${devicemanager_path}/radar:devicemanagerradar",
19979a732c7Sopenharmony_ci      "${softbuscache_parh}:dmdevicecache",
20079a732c7Sopenharmony_ci      "${utils_path}:devicemanagerutils",
20179a732c7Sopenharmony_ci    ]
20279a732c7Sopenharmony_ci
20379a732c7Sopenharmony_ci    external_deps = [
20479a732c7Sopenharmony_ci      "ability_base:want",
20579a732c7Sopenharmony_ci      "access_token:libaccesstoken_sdk",
20679a732c7Sopenharmony_ci      "access_token:libtokenid_sdk",
20779a732c7Sopenharmony_ci      "bundle_framework:appexecfwk_base",
20879a732c7Sopenharmony_ci      "cJSON:cjson",
20979a732c7Sopenharmony_ci      "c_utils:utils",
21079a732c7Sopenharmony_ci      "common_event_service:cesfwk_core",
21179a732c7Sopenharmony_ci      "common_event_service:cesfwk_innerkits",
21279a732c7Sopenharmony_ci      "data_share:datashare_common",
21379a732c7Sopenharmony_ci      "data_share:datashare_consumer",
21479a732c7Sopenharmony_ci      "device_info_manager:distributed_device_profile_common",
21579a732c7Sopenharmony_ci      "device_info_manager:distributed_device_profile_sdk",
21679a732c7Sopenharmony_ci      "dsoftbus:softbus_client",
21779a732c7Sopenharmony_ci      "eventhandler:libeventhandler",
21879a732c7Sopenharmony_ci      "ffrt:libffrt",
21979a732c7Sopenharmony_ci      "hicollie:libhicollie",
22079a732c7Sopenharmony_ci      "hilog:libhilog",
22179a732c7Sopenharmony_ci      "init:libbeget_proxy",
22279a732c7Sopenharmony_ci      "init:libbegetutil",
22379a732c7Sopenharmony_ci      "ipc:ipc_core",
22479a732c7Sopenharmony_ci      "ipc:ipc_single",
22579a732c7Sopenharmony_ci      "openssl:libcrypto_shared",
22679a732c7Sopenharmony_ci      "os_account:libaccountkits",
22779a732c7Sopenharmony_ci      "os_account:os_account_innerkits",
22879a732c7Sopenharmony_ci      "safwk:system_ability_fwk",
22979a732c7Sopenharmony_ci      "samgr:samgr_proxy",
23079a732c7Sopenharmony_ci    ]
23179a732c7Sopenharmony_ci
23279a732c7Sopenharmony_ci    if (support_bluetooth || support_wifi) {
23379a732c7Sopenharmony_ci      sources += [
23479a732c7Sopenharmony_ci        "src/publishcommonevent/dm_publish_common_event.cpp",
23579a732c7Sopenharmony_ci        "src/softbus/softbus_publish.cpp",
23679a732c7Sopenharmony_ci      ]
23779a732c7Sopenharmony_ci    }
23879a732c7Sopenharmony_ci
23979a732c7Sopenharmony_ci    if (support_bluetooth) {
24079a732c7Sopenharmony_ci      defines += [ "SUPPORT_BLUETOOTH" ]
24179a732c7Sopenharmony_ci      external_deps += [ "bluetooth:btframework" ]
24279a732c7Sopenharmony_ci    }
24379a732c7Sopenharmony_ci
24479a732c7Sopenharmony_ci    if (support_wifi) {
24579a732c7Sopenharmony_ci      defines += [ "SUPPORT_WIFI" ]
24679a732c7Sopenharmony_ci      external_deps += [ "wifi:wifi_sdk" ]
24779a732c7Sopenharmony_ci    }
24879a732c7Sopenharmony_ci
24979a732c7Sopenharmony_ci    if (support_power_manager) {
25079a732c7Sopenharmony_ci      defines += [ "SUPPORT_POWER_MANAGER" ]
25179a732c7Sopenharmony_ci      external_deps += [ "power_manager:powermgr_client" ]
25279a732c7Sopenharmony_ci    }
25379a732c7Sopenharmony_ci
25479a732c7Sopenharmony_ci    if (support_memmgr) {
25579a732c7Sopenharmony_ci      defines += [ "SUPPORT_MEMMGR" ]
25679a732c7Sopenharmony_ci      external_deps += [ "memmgr:memmgrclient" ]
25779a732c7Sopenharmony_ci    }
25879a732c7Sopenharmony_ci
25979a732c7Sopenharmony_ci    public_external_deps = [ "json:nlohmann_json_static" ]
26079a732c7Sopenharmony_ci
26179a732c7Sopenharmony_ci    subsystem_name = "distributedhardware"
26279a732c7Sopenharmony_ci
26379a732c7Sopenharmony_ci    part_name = "device_manager"
26479a732c7Sopenharmony_ci  }
26579a732c7Sopenharmony_ci}
266