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
17NETMANAGER_EXT_NAPI_ROOT = "$NETMANAGER_EXT_ROOT/frameworks/js/napi/"
18
19config("mdns_config") {
20  visibility = [ ":mdns" ]
21
22  cflags = [
23    "-fstack-protector-strong",
24    "-D_FORTIFY_SOURCE=2",
25    "-O2",
26  ]
27
28  cflags_cc = [
29    "-fstack-protector-strong",
30    "-D_FORTIFY_SOURCE=2",
31    "-O2",
32  ]
33}
34
35ohos_shared_library("mdns") {
36  sanitize = {
37    cfi = true
38    cfi_cross_dso = true
39    debug = false
40  }
41
42  branch_protector_ret = "pac_ret"
43
44  include_dirs = [
45    "$NETMANAGER_EXT_NAPI_ROOT/mdns/include",
46    "$NETMANAGER_EXT_NAPI_ROOT/mdns/include/contexts",
47  ]
48
49  sources = [
50    "src/contexts/mdns_addlocalservice_context.cpp",
51    "src/contexts/mdns_base_context.cpp",
52    "src/contexts/mdns_removelocalservice_context.cpp",
53    "src/contexts/mdns_resolvelocalservice_context.cpp",
54    "src/contexts/mdns_startsearching_context.cpp",
55    "src/mdns_async_work.cpp",
56    "src/mdns_callback_observer.cpp",
57    "src/mdns_exec.cpp",
58    "src/mdns_instances.cpp",
59    "src/mdns_module.cpp",
60  ]
61
62  defines = [ "NETMGR_DEBUG" ]
63
64  deps = [
65    "$EXT_INNERKITS_ROOT/mdnsclient:mdns_manager_if",
66    "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common",
67  ]
68
69  external_deps = [
70    "c_utils:utils",
71    "hilog:libhilog",
72    "ipc:ipc_core",
73    "napi:ace_napi",
74    "netmanager_base:napi_utils",
75    "netmanager_base:net_manager_common",
76  ]
77
78  configs = [ ":mdns_config" ]
79
80  relative_install_dir = "module/net"
81  part_name = "netmanager_ext"
82  subsystem_name = "communication"
83}
84