1# Copyright (C) 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
14if (defined(ohos_lite)) {
15  import("//build/lite/config/component/lite_component.gni")
16  import("//foundation/communication/dhcp/dhcp_lite.gni")
17} else {
18  import("//build/ohos.gni")
19  import("//foundation/communication/dhcp/dhcp.gni")
20}
21
22################################################################################
23if (defined(ohos_lite)) {
24  shared_library("dhcp_utils") {
25    sources = [
26      "src/dhcp_arp_checker.cpp",
27      "src/dhcp_common_utils.cpp",
28    ]
29
30    include_dirs = [
31      "$DHCP_ROOT_DIR/services",
32      "$DHCP_ROOT_DIR/services/utils/include",
33    ]
34
35    deps = []
36    external_deps = []
37    defines = [
38      "_GNU_SOURCE",
39      "OHOS_ARCH_LITE",
40    ]
41  }
42} else {
43  config("dhcp_common_config") {
44    visibility = [ ":*" ]
45    include_dirs = [ "$DHCP_ROOT_DIR/services/utils/include" ]
46  }
47  ohos_shared_library("dhcp_utils") {
48    branch_protector_ret = "pac_ret"
49    sanitize = {
50      cfi = true
51      boundary_sanitize = true
52      cfi_cross_dso = true
53      debug = false
54    }
55    install_enable = true
56    sources = [
57      "$DHCP_ROOT_DIR/services/utils/src/dhcp_arp_checker.cpp",
58      "$DHCP_ROOT_DIR/services/utils/src/dhcp_common_utils.cpp",
59      "$DHCP_ROOT_DIR/services/utils/src/dhcp_system_timer.cpp",
60    ]
61
62    include_dirs = [
63      "$DHCP_ROOT_DIR/services",
64      "$DHCP_ROOT_DIR/services/utils/include",
65    ]
66    deps = []
67    external_deps = [
68      "ability_runtime:wantagent_innerkits",
69      "c_utils:utils",
70      "hilog:libhilog",
71      "time_service:time_client",
72    ]
73
74    cflags = [
75      "-std=c++17",
76      "-fno-rtti",
77    ]
78    ldflags = [
79      "-fPIC",
80      "-Wl,-E",
81    ]
82
83    public_configs = [ ":dhcp_common_config" ]
84    part_name = "dhcp"
85    subsystem_name = "communication"
86    innerapi_tags = [ "platformsdk" ]
87  }
88}
89