1# Copyright (c) 2022-2023 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("devicemanagersdk") {
24      include_dirs = [
25        "${innerkits_path}/native_cpp/include/mini",
26        "//third_party/cJSON",
27        "//kernel/liteos_m/kal/cmsis",
28        "//utils/native/lite/include",
29        "//kernel/liteos_m/kal/posix/include",
30        "//third_party/musl/porting/liteos_m/kernel/include",
31        "//device/bestechnic/bes2600w/sdk_liteos/bsp/platform/hal",
32        "//foundation/communication/wifi_lite/interfaces/wifiservice",
33        "//foundation/communication/dsoftbus/core/common/include",
34        "//foundation/communication/dsoftbus/interfaces/kits/bus_center",
35        "//foundation/communication/dsoftbus/interfaces/kits/common",
36        "//foundation/communication/dsoftbus/interfaces/kits/discovery",
37        "//foundation/communication/dsoftbus/interfaces/kits/transport",
38        "//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
39        "//base/security/device_auth/interfaces/inner_api",
40        "//base/startup/init/interfaces/innerkits/include/syspara",
41      ]
42
43      sources = [
44        "${innerkits_path}/native_cpp/src/mini/device_manager_impl_lite_m.c",
45        "${innerkits_path}/native_cpp/src/mini/hichain_adapter.c",
46        "${innerkits_path}/native_cpp/src/mini/softbus_adapter.c",
47      ]
48
49      deps = [
50        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static",
51        "//commonlibrary/utils_lite:utils",
52        "//foundation/systemabilitymgr/samgr_lite/samgr",
53        "//third_party/bounds_checking_function:libsec_static",
54      ]
55
56      cflags = [
57        "-Wall",
58        "-O2",
59        "-std=c99",
60        "-Wdate-time",
61        "-Wextra",
62        "-Wfloat-equal",
63      ]
64      cflags_cc = cflags
65    }
66  } else {
67    shared_library("devicemanagersdk") {
68      include_dirs = [
69        "include",
70        "include/ipc",
71        "include/ipc/lite",
72        "include/notify",
73        "${common_path}/include",
74        "${common_path}/include/dfx",
75        "${common_path}/include/dfx/lite",
76        "${common_path}/include/ipc",
77        "${common_path}/include/ipc/lite",
78        "${common_path}/include/ipc/model",
79        "${interfaces_path}/c/ipc/include",
80        "${interfaces_path}/ipc_core/include",
81        "${samgr_lite_path}/kits/samgr",
82        "${samgr_lite_path}/kits/registry",
83        "${utils_lite_path}/include",
84        "//third_party/bounds_checking_function/include",
85        "//third_party/json/include",
86        "${interfaces_path}/c/ipc/include",
87        "//foundation/distributedshedule/samgr_lite/interfaces/kits/samgr",
88        "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include",
89      ]
90
91      sources = [
92        "${common_path}/src/dfx/lite/dm_hidumper.cpp",
93        "${common_path}/src/dfx/lite/dm_hisysevent.cpp",
94        "${common_path}/src/dfx/lite/dm_hitrace.cpp",
95        "${common_path}/src/dm_anonymous.cpp",
96        "src/device_manager.cpp",
97        "src/device_manager_impl.cpp",
98        "src/ipc/ipc_client_proxy.cpp",
99        "src/ipc/lite/ipc_client_manager.cpp",
100        "src/ipc/lite/ipc_client_server_proxy.cpp",
101        "src/ipc/lite/ipc_client_stub.cpp",
102        "src/ipc/lite/ipc_cmd_parser.cpp",
103        "src/notify/device_manager_notify.cpp",
104      ]
105
106      defines = [
107        "LITE_DEVICE",
108        "HI_LOG_ENABLE",
109        "DH_LOG_TAG=\"devicemanagerkit\"",
110        "LOG_DOMAIN=0xD004111",
111      ]
112
113      deps = [
114        "${utils_path}:devicemanagerutils",
115        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
116        "//base/security/device_auth/services:deviceauth_sdk",
117        "//base/startup/init/interfaces/innerkits:libbegetutil",
118        "//commonlibrary/utils_lite:utils",
119        "//foundation/communication/dsoftbus:dsoftbus",
120        "//foundation/systemabilitymgr/safwk_lite:safwk_lite",
121        "//foundation/systemabilitymgr/samgr_lite/samgr:samgr",
122        "//third_party/bounds_checking_function:libsec_shared",
123      ]
124    }
125  }
126} else {
127  config("devicemanagersdk_config") {
128    include_dirs = [
129      "include",
130      "include/ipc",
131      "include/ipc/standard",
132      "include/notify",
133      "${common_path}/include",
134      "${common_path}/include/ipc",
135      "${common_path}/include/ipc/model",
136      "${common_path}/include/ipc/standard",
137      "${common_path}/include/dfx",
138      "${common_path}/include/dfx/standard",
139    ]
140  }
141
142  ohos_shared_library("devicemanagersdk") {
143    branch_protector_ret = "pac_ret"
144
145    sanitize = {
146      boundary_sanitize = true
147      integer_overflow = true
148      ubsan = true
149    }
150
151    sources = [
152      "${common_path}/src/dfx/standard/dm_hisysevent.cpp",
153      "${common_path}/src/dfx/standard/dm_hitrace.cpp",
154      "${common_path}/src/dm_anonymous.cpp",
155      "${common_path}/src/ipc/standard/ipc_cmd_register.cpp",
156      "src/device_manager.cpp",
157      "src/device_manager_impl.cpp",
158      "src/ipc/ipc_client_proxy.cpp",
159      "src/ipc/standard/dm_service_load.cpp",
160      "src/ipc/standard/ipc_client_manager.cpp",
161      "src/ipc/standard/ipc_client_server_proxy.cpp",
162      "src/ipc/standard/ipc_client_stub.cpp",
163      "src/ipc/standard/ipc_cmd_parser.cpp",
164      "src/notify/device_manager_notify.cpp",
165    ]
166
167    public_configs = [ ":devicemanagersdk_config" ]
168
169    innerapi_tags = [ "platformsdk" ]
170
171    defines = [
172      "HI_LOG_ENABLE",
173      "DH_LOG_TAG=\"devicemanagerkit\"",
174      "LOG_DOMAIN=0xD004111",
175    ]
176
177    external_deps = [
178      "access_token:libaccesstoken_sdk",
179      "c_utils:utils",
180      "ffrt:libffrt",
181      "hilog:libhilog",
182      "hisysevent:libhisysevent",
183      "hitrace:hitrace_meter",
184      "ipc:ipc_core",
185      "ipc:ipc_napi",
186      "ipc:ipc_single",
187      "ipc:libdbinder",
188      "samgr:samgr_proxy",
189    ]
190
191    public_external_deps = [ "json:nlohmann_json_static" ]
192
193    subsystem_name = "distributedhardware"
194
195    part_name = "device_manager"
196  }
197}
198