1# Copyright (C) 2021-2023 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 22local_sdk_include_dirs = [ 23 "$DHCP_ROOT_DIR/services", 24 "$DHCP_ROOT_DIR/interfaces", 25 "$DHCP_ROOT_DIR/interfaces/inner_api", 26 "$DHCP_ROOT_DIR/interfaces/kits/c", 27 "$DHCP_ROOT_DIR/interfaces/inner_api/include", 28 "$DHCP_ROOT_DIR/interfaces/inner_api/interfaces", 29 "$DHCP_ROOT_DIR/frameworks/native/include", 30 "$DHCP_ROOT_DIR/frameworks/native/interfaces", 31 "$DHCP_ROOT_DIR/frameworks/native/c_adapter/inc", 32] 33 34if (defined(ohos_lite)) { 35 shared_library("dhcp_sdk") { 36 sources = [ 37 "c_adapter/src/dhcp_c_service.cpp", 38 "c_adapter/src/dhcp_c_utils.cpp", 39 "src/dhcp_client.cpp", 40 "src/dhcp_client_callback_stub_lite.cpp", 41 "src/dhcp_client_proxy_lite.cpp", 42 "src/dhcp_event.cpp", 43 "src/dhcp_server.cpp", 44 "src/dhcp_server_callback_stub_lite.cpp", 45 "src/dhcp_server_impl.cpp", 46 "src/dhcp_server_proxy_lite.cpp", 47 ] 48 include_dirs = local_sdk_include_dirs 49 include_dirs += [ "//commonlibrary/c_utils/base/include" ] 50 51 deps = [ 52 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 53 "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single", 54 "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", 55 "//third_party/bounds_checking_function:libsec_shared", 56 ] 57 configs -= [ "//build/lite/config:language_cpp" ] 58 cflags_cc = [ 59 "-std=c++17", 60 "-fno-rtti", 61 ] 62 defines = [ "OHOS_ARCH_LITE" ] 63 ldflags = [ 64 "-fPIC", 65 "-Wl,-E", 66 ] 67 } 68} else { 69 local_sdk_sources = [ 70 "c_adapter/src/dhcp_c_service.cpp", 71 "c_adapter/src/dhcp_c_utils.cpp", 72 "src/dhcp_client.cpp", 73 "src/dhcp_client_callback_stub.cpp", 74 "src/dhcp_event.cpp", 75 "src/dhcp_sa_manager.cpp", 76 "src/dhcp_server.cpp", 77 ] 78 config("dhcp_sdk_header") { 79 visibility = [ ":*" ] 80 include_dirs = local_sdk_include_dirs 81 } 82 config("dhcp_sdk_config") { 83 visibility = [ ":*" ] 84 include_dirs = local_sdk_include_dirs 85 cflags = [ 86 "-std=c++17", 87 "-fno-rtti", 88 ] 89 if (target_cpu == "arm") { 90 cflags += [ "-DBINDER_IPC_32BIT" ] 91 } 92 } 93 ohos_source_set("dhcp_client_proxy_impl") { 94 part_name = "dhcp" 95 sources = [ 96 "src/dhcp_client_impl.cpp", 97 "src/dhcp_client_proxy.cpp", 98 ] 99 configs = [ 100 ":dhcp_sdk_config", 101 ":dhcp_sdk_header", 102 ] 103 defines = [] 104 external_deps = [ 105 "hilog:libhilog", 106 "ipc:ipc_single", 107 "samgr:samgr_proxy", 108 ] 109 } 110 111 ohos_source_set("dhcp_server_proxy_impl") { 112 part_name = "dhcp" 113 sources = [ 114 "src/dhcp_server_impl.cpp", 115 "src/dhcp_server_proxy.cpp", 116 ] 117 configs = [ 118 ":dhcp_sdk_config", 119 ":dhcp_sdk_header", 120 ] 121 defines = [] 122 external_deps = [ 123 "hilog:libhilog", 124 "ipc:ipc_single", 125 "samgr:samgr_proxy", 126 ] 127 } 128 129 ohos_shared_library("dhcp_sdk") { 130 sanitize = { 131 cfi = true 132 boundary_sanitize = true 133 cfi_cross_dso = true 134 debug = false 135 } 136 install_enable = true 137 sources = local_sdk_sources 138 sources += [ "src/dhcp_server_callback_stub.cpp" ] 139 deps = [ 140 ":dhcp_client_proxy_impl", 141 ":dhcp_server_proxy_impl", 142 ] 143 external_deps = [ 144 "c_utils:utils", 145 "hilog:libhilog", 146 "ipc:ipc_single", 147 "safwk:system_ability_fwk", 148 "samgr:samgr_proxy", 149 ] 150 defines = [] 151 cflags_cc = [ 152 "-std=c++17", 153 "-fno-rtti", 154 ] 155 ldflags = [ 156 "-fPIC", 157 "-Wl,-E", 158 ] 159 configs = [ 160 ":dhcp_sdk_config", 161 ":dhcp_sdk_header", 162 ] 163 public_configs = [ ":dhcp_sdk_header" ] 164 part_name = "dhcp" 165 subsystem_name = "communication" 166 innerapi_tags = [ "platformsdk" ] 167 } 168} 169