1# Copyright (C) 2023-2024 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
14import("//build/ohos.gni")
15import("//foundation/communication/netmanager_ext/netmanager_ext_config.gni")
16
17config("net_mdns_manager_if_config") {
18  # header file path
19  include_dirs = [
20    "$BASE_INNERKITS_ROOT/include",
21    "$EXT_INNERKITS_ROOT/mdnsclient/include",
22    "$EXT_INNERKITS_ROOT/mdnsclient/include/proxy",
23  ]
24
25  cflags = []
26  if (is_double_framework) {
27    cflags = [ "-DCONFIG_DUAL_FRAMEWORK" ]
28  }
29  if (target_cpu == "arm") {
30    cflags += [ "-DBINDER_IPC_32BIT" ]
31  }
32  if (is_standard_system) {
33    cflags += [ "-DCONFIG_STANDARD_SYSTEM" ]
34  }
35  if (defined(build_public_version) && build_public_version) {
36    cflags += [ "-DBUILD_PUBLIC_VERSION" ]
37  }
38
39  cflags += [
40    "-fstack-protector-strong",
41    "-D_FORTIFY_SOURCE=2",
42    "-O2",
43  ]
44
45  cflags_cc = [
46    "-fstack-protector-strong",
47    "-D_FORTIFY_SOURCE=2",
48    "-O2",
49  ]
50}
51
52ohos_source_set("mdns_parcel") {
53  sanitize = {
54    cfi = true
55    cfi_cross_dso = true
56    debug = false
57  }
58
59  branch_protector_ret = "pac_ret"
60
61  sources = [
62    "$NETMANAGER_EXT_ROOT/frameworks/native/mdnsclient/src/mdns_common.cpp",
63    "$NETMANAGER_EXT_ROOT/frameworks/native/mdnsclient/src/mdns_service_info.cpp",
64  ]
65
66  include_dirs = [ "$EXT_INNERKITS_ROOT/mdnsclient/include" ]
67
68  deps = [ "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common" ]
69
70  external_deps = [
71    "c_utils:utils",
72    "netmanager_base:net_manager_common",
73  ]
74
75  external_deps += [ "hilog:libhilog" ]
76
77  part_name = "netmanager_ext"
78  subsystem_name = "communication"
79}
80
81ohos_shared_library("mdns_manager_if") {
82  sanitize = {
83    cfi = true
84    cfi_cross_dso = true
85    debug = false
86  }
87
88  branch_protector_ret = "pac_ret"
89
90  sources = [
91    "$NETMANAGER_EXT_ROOT/frameworks/native/mdnsclient/src/mdns_client.cpp",
92    "$NETMANAGER_EXT_ROOT/frameworks/native/mdnsclient/src/mdns_client_resume.cpp",
93    "$NETMANAGER_EXT_ROOT/frameworks/native/mdnsclient/src/proxy/mdns_event_stub.cpp",
94    "$NETMANAGER_EXT_ROOT/frameworks/native/mdnsclient/src/proxy/mdns_service_proxy.cpp",
95  ]
96
97  version_script = "libmdns_kits.map"
98
99  public_configs = [ ":net_mdns_manager_if_config" ]
100
101  deps = [
102    ":mdns_parcel",
103    "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common",
104  ]
105
106  external_deps = [
107    "bounds_checking_function:libsec_shared",
108    "ipc:ipc_single",
109    "samgr:samgr_proxy",
110  ]
111
112  defines = [
113    "NETMGR_LOG_TAG = \"MDnsManager\"",
114    "LOG_DOMAIN = 0xD0015B0",
115  ]
116
117  if (enable_netmgr_ext_debug) {
118    defines += [ "NETMGR_DEBUG" ]
119  }
120
121  external_deps += [ "hilog:libhilog" ]
122
123  innerapi_tags = [ "platformsdk" ]
124  part_name = "netmanager_ext"
125  subsystem_name = "communication"
126}
127