1# Copyright (C) 2021-2022 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################################################################################ 23local_base_include_dirs = [ 24 "$DHCP_ROOT_DIR/services", 25 "$DHCP_ROOT_DIR/services/dhcp_server/include", 26 "$DHCP_ROOT_DIR/interfaces", 27 "$DHCP_ROOT_DIR/interfaces/kits/c", 28 "$DHCP_ROOT_DIR/interfaces/inner_api", 29 "$DHCP_ROOT_DIR/interfaces/inner_api/include", 30 "$DHCP_ROOT_DIR/frameworks/native/include", 31 "$DHCP_ROOT_DIR/frameworks/native/interfaces", 32 "$DHCP_ROOT_DIR/frameworks/native/src", 33 "$DHCP_ROOT_DIR/frameworks/native/c_adapter/inc", 34 "$DHCP_ROOT_DIR/services/dhcp_client/include", 35 "$DHCP_ROOT_DIR/services/utils/include", 36] 37 38if (defined(ohos_lite)) { 39 dhcp_hilog_enable = true 40 shared_library("dhcp_server") { 41 sources = [ 42 "src/address_utils.cpp", 43 "src/common_util.cpp", 44 "src/dhcp_address_pool.cpp", 45 "src/dhcp_argument.cpp", 46 "src/dhcp_binding.cpp", 47 "src/dhcp_config.cpp", 48 "src/dhcp_dhcpd.cpp", 49 "src/dhcp_function.cpp", 50 "src/dhcp_option.cpp", 51 "src/dhcp_s_server.cpp", 52 "src/dhcp_server_callback_proxy_lite.cpp", 53 "src/dhcp_server_feature_lite.cpp", 54 "src/dhcp_server_service_impl.cpp", 55 "src/dhcp_server_stub_lite.cpp", 56 ] 57 58 include_dirs = local_base_include_dirs 59 include_dirs += [ 60 "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", 61 "//third_party/bounds_checking_function/include", 62 "//foundation/systemabilitymgr/samgr_lite/interfaces/innerkits/registry", 63 "//foundation/systemabilitymgr/samgr_lite/interfaces/innerkits/samgr", 64 ] 65 66 deps = [ 67 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 68 "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", 69 ] 70 71 external_deps = [ "bounds_checking_function:libsec_shared" ] 72 73 cflags_cc = [ "-fno-rtti" ] 74 75 defines = [ 76 "_GNU_SOURCE", 77 "OHOS_ARCH_LITE", 78 ] 79 if (dhcp_hilog_enable) { 80 deps += [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" ] 81 defines += [ "DHCP_HILOG_ENABLE" ] 82 } 83 } 84} else { 85 local_base_sources = [ 86 "src/address_utils.cpp", 87 "src/common_util.cpp", 88 "src/dhcp_address_pool.cpp", 89 "src/dhcp_argument.cpp", 90 "src/dhcp_binding.cpp", 91 "src/dhcp_config.cpp", 92 "src/dhcp_dhcpd.cpp", 93 "src/dhcp_function.cpp", 94 "src/dhcp_option.cpp", 95 "src/dhcp_s_server.cpp", 96 "src/dhcp_server_death_recipient.cpp", 97 "src/dhcp_server_service_impl.cpp", 98 ] 99 config("dhcp_manager_service_header") { 100 visibility = [ ":*" ] 101 include_dirs = local_base_include_dirs 102 } 103 104 ohos_shared_library("dhcp_server") { 105 branch_protector_ret = "pac_ret" 106 sanitize = { 107 cfi = true 108 boundary_sanitize = true 109 cfi_cross_dso = true 110 debug = false 111 } 112 install_enable = true 113 sources = local_base_sources 114 sources += [ 115 "src/dhcp_server_callback_proxy.cpp", 116 "src/dhcp_server_stub.cpp", 117 ] 118 119 include_dirs = local_base_include_dirs 120 deps = [ "$DHCP_ROOT_DIR/services/utils:dhcp_utils" ] 121 external_deps = [ 122 "access_token:libaccesstoken_sdk", 123 "access_token:libtokenid_sdk", 124 "c_utils:utils", 125 "hilog:libhilog", 126 "ipc:ipc_single", 127 "safwk:system_ability_fwk", 128 "samgr:samgr_proxy", 129 ] 130 131 cflags = [ 132 "-std=c++17", 133 "-fno-rtti", 134 ] 135 ldflags = [ 136 "-fPIC", 137 "-Wl,-E", 138 ] 139 shlib_type = "sa" 140 version_script = "libdhcp_server.map" 141 public_configs = [ ":dhcp_manager_service_header" ] 142 part_name = "dhcp" 143 subsystem_name = "communication" 144 innerapi_tags = [ "platformsdk" ] 145 } 146} 147