1# Copyright (C) 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/wifi/wifi/wifi_lite.gni") 17} else { 18 import("//build/ohos.gni") 19 import("//foundation/communication/wifi/wifi/wifi.gni") 20} 21 22local_base_sources = [ 23 "security_utils/src/wifi_openssl_utils.cpp", 24 "shared_util/wifi_watchdog_utils.cpp", 25 "state_machine/src/handler.cpp", 26 "state_machine/src/internal_message.cpp", 27 "state_machine/src/message_queue.cpp", 28 "state_machine/src/state.cpp", 29 "state_machine/src/state_machine.cpp", 30] 31 32local_base_include_dirs = [ 33 "$WIFI_ROOT_DIR/base/cRPC/include", 34 "$WIFI_ROOT_DIR/base/security_utils/include", 35 "$WIFI_ROOT_DIR/base/state_machine/include", 36 "$WIFI_ROOT_DIR/base/inner_api", 37 "$WIFI_ROOT_DIR/base/shared_util", 38 "$WIFI_ROOT_DIR/interfaces/inner_api", 39 "$WIFI_ROOT_DIR/frameworks/native/interfaces", 40 "$WIFI_ROOT_DIR/frameworks/native/c_adapter/inc", 41 "$WIFI_ROOT_DIR/services/wifi_standard/include", 42 "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/include", 43 "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/log", 44 "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/config", 45 "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper", 46 "$WIFI_ROOT_DIR/utils/inc", 47] 48 49if (defined(ohos_lite)) { 50 shared_library("wifi_base") { 51 sources = local_base_sources 52 53 include_dirs = local_base_include_dirs 54 55 deps = [ "$WIFI_ROOT_DIR/base/cRPC:crpc_client" ] 56 57 external_deps = [ 58 "hilog_lite:hilog_shared", 59 "openssl:libcrypto_shared", 60 "openssl:libssl_shared", 61 ] 62 63 configs -= [ "//build/lite/config:language_cpp" ] 64 65 cflags = memory_optimization_cflags 66 cflags_cc = memory_optimization_cflags_cc 67 ldflags = memory_optimization_ldflags 68 cflags_cc += [ 69 "-std=c++17", 70 "-fno-rtti", 71 ] 72 73 ldflags += [ 74 "-fPIC", 75 "-Wl,-E", 76 ] 77 78 defines = [ "OHOS_ARCH_LITE" ] 79 } 80} else { 81 config("wifi_base_exported_header") { 82 visibility = [ ":*" ] 83 include_dirs = local_base_include_dirs 84 } 85 86 ohos_shared_library("wifi_base") { 87 branch_protector_ret = "pac_ret" 88 89 sanitize = { 90 cfi = true # Enable/disable control flow integrity detection 91 boundary_sanitize = true # Enable boundary san detection 92 cfi_cross_dso = true # Cross-SO CFI Checks 93 integer_overflow = true # Enable integer overflow detection 94 ubsan = true # Enable some Ubsan options 95 debug = false 96 } 97 98 install_enable = true 99 sources = local_base_sources 100 101 sources += [ 102 "utils/wifi_app_parser.cpp", 103 "utils/xml_parser.cpp", 104 ] 105 include_dirs = local_base_include_dirs 106 include_dirs += [ "$WIFI_ROOT_DIR/base/utils" ] 107 108 deps = [ "$WIFI_ROOT_DIR/utils:wifi_utils" ] 109 defines = [] 110 111 external_deps = [ 112 "c_utils:utils", 113 "hicollie:libhicollie", 114 "hilog:libhilog", 115 "jsoncpp:jsoncpp", 116 "libxml2:libxml2", 117 "openssl:libcrypto_shared", 118 "openssl:libssl_shared", 119 ] 120 if (wifi_ffrt_enable) { 121 external_deps += [ "ffrt:libffrt" ] 122 defines += [ "WIFI_FFRT_ENABLE" ] 123 } 124 cflags = memory_optimization_cflags 125 cflags_cc = memory_optimization_cflags_cc 126 ldflags = memory_optimization_ldflags 127 cflags_cc += [ 128 "-std=c++17", 129 "-fno-rtti", 130 ] 131 132 ldflags += [ 133 "-fPIC", 134 "-Wl,-E", 135 ] 136 137 public_configs = [ ":wifi_base_exported_header" ] 138 139 part_name = "wifi" 140 subsystem_name = "communication" 141 innerapi_tags = [ "platformsdk" ] 142 } 143} 144