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("mdns_manager_config") {
18  include_dirs = [
19    "$BASE_INNERKITS_ROOT/include",
20    "$BASE_INNERKITS_ROOT/netconnclient/include",
21    "$BASE_INNERKITS_ROOT/netconnclient/include/proxy",
22    "$EXT_INNERKITS_ROOT/mdnsclient/include",
23    "$EXT_INNERKITS_ROOT/mdnsclient/include/proxy",
24    "$EXT_INNERKITS_ROOT/include",
25    "$NETMANAGER_BASE_ROOT/utils/errorcode_utils/include",
26    "include",
27    "include/stub",
28  ]
29}
30
31ohos_shared_library("mdns_manager") {
32  sanitize = {
33    cfi = true
34    cfi_cross_dso = true
35    debug = false
36  }
37
38  branch_protector_ret = "pac_ret"
39
40  sources = [
41    "src/mdns_manager.cpp",
42    "src/mdns_packet_parser.cpp",
43    "src/mdns_protocol_impl.cpp",
44    "src/mdns_service.cpp",
45    "src/mdns_socket_listener.cpp",
46    "src/net_interface_callback.cpp",
47    "src/stub/mdns_event_proxy.cpp",
48    "src/stub/mdns_service_stub.cpp",
49  ]
50
51  configs = [ ":mdns_manager_config" ]
52
53  deps = [
54    "$EXT_INNERKITS_ROOT/mdnsclient:mdns_parcel",
55    "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common",
56  ]
57
58  cflags = [
59    "-fvisibility=hidden",
60    "-fdata-sections",
61    "-ffunction-sections",
62    "-Os",
63    "-fstack-protector-strong",
64    "-D_FORTIFY_SOURCE=2",
65    "-O2",
66  ]
67
68  cflags_cc = [
69    "-fvisibility-inlines-hidden",
70    "-Os",
71    "-fstack-protector-strong",
72    "-D_FORTIFY_SOURCE=2",
73    "-O2",
74  ]
75
76  ldflags = [
77    "-Wl,--exclude-libs=ALL",
78    "-Wl,--gc-sections",
79  ]
80
81  external_deps = [
82    "bounds_checking_function:libsec_shared",
83    "hisysevent:libhisysevent",
84    "ipc:ipc_core",
85    "netmanager_base:net_conn_manager_if",
86    "safwk:system_ability_fwk",
87    "samgr:samgr_proxy",
88  ]
89
90  defines = [
91    "NETMGR_LOG_TAG = \"MDnsManager\"",
92    "LOG_DOMAIN = 0xD0015B0",
93  ]
94
95  if (enable_netmgr_ext_debug) {
96    defines += [ "NETMGR_DEBUG" ]
97  }
98
99  external_deps += [ "hilog:libhilog" ]
100
101  part_name = "netmanager_ext"
102  subsystem_name = "communication"
103}
104
105ohos_static_library("mdns_manager_static") {
106  testonly = true
107  sanitize = {
108    cfi = true
109    cfi_cross_dso = true
110    debug = false
111  }
112
113  branch_protector_ret = "pac_ret"
114
115  sources = [
116    "src/mdns_manager.cpp",
117    "src/mdns_packet_parser.cpp",
118    "src/mdns_protocol_impl.cpp",
119    "src/mdns_service.cpp",
120    "src/mdns_socket_listener.cpp",
121    "src/net_interface_callback.cpp",
122    "src/stub/mdns_event_proxy.cpp",
123    "src/stub/mdns_service_stub.cpp",
124  ]
125
126  configs = [ ":mdns_manager_config" ]
127
128  deps = [
129    "$EXT_INNERKITS_ROOT/mdnsclient:mdns_parcel",
130    "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common",
131  ]
132
133  external_deps = [
134    "bounds_checking_function:libsec_shared",
135    "hisysevent:libhisysevent",
136    "ipc:ipc_core",
137    "netmanager_base:net_conn_manager_if",
138    "safwk:system_ability_fwk",
139    "samgr:samgr_proxy",
140  ]
141
142  defines = [
143    "NETMGR_LOG_TAG = \"MDnsManager\"",
144    "LOG_DOMAIN = 0xD0015B0",
145  ]
146
147  if (enable_netmgr_ext_debug) {
148    defines += [ "NETMGR_DEBUG" ]
149  }
150
151  external_deps += [ "hilog:libhilog" ]
152
153  part_name = "netmanager_ext"
154  subsystem_name = "communication"
155}
156