1# Copyright (c) 2021 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("//foundation/communication/dsoftbus/dsoftbus.gni") 15 16NSTACKX_ROOT = "//foundation/communication/dsoftbus/components/nstackx" 17if (defined(ohos_lite)) { 18 import("//build/lite/config/component/lite_component.gni") 19 config("dfile_lite_config") { 20 cflags = [ 21 "-Wall", 22 "-fno-lto", 23 "-D_GNU_SOURCE", 24 "-DNSTACKX_WITH_LITEOS", 25 "-DLWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS", 26 "-DLWIP_LITEOS_A_COMPAT", 27 "-DMBEDTLS_INCLUDED", 28 "-DDFILE_ENABLE_HIDUMP", 29 ] 30 cflags_cc = cflags 31 } 32 33 config("dfile_linux_config") { 34 cflags = [ 35 "-Wall", 36 "-fno-lto", 37 "-DNSTACKX_WITH_HMOS_LINUX", 38 "-DMBEDTLS_INCLUDED", 39 "-DENABLE_USER_LOG", 40 ] 41 cflags_cc = cflags 42 } 43 shared_library("nstackx_dfile.open") { 44 if (ohos_kernel_type == "liteos_a") { 45 configs += [ ":dfile_lite_config" ] 46 include_dirs = [ 47 "include", 48 "interface", 49 "$NSTACKX_ROOT/nstackx_congestion/interface/", 50 "$NSTACKX_ROOT/nstackx_core", 51 "$NSTACKX_ROOT/nstackx_util/interface", 52 "$NSTACKX_ROOT/nstackx_util/platform/liteos", 53 "//third_party/bounds_checking_function/include/", 54 ] 55 sources = [ 56 "$NSTACKX_ROOT/nstackx_core/platform/liteos/dfile/sys_dfile.c", 57 "$NSTACKX_ROOT/nstackx_core/platform/liteos/dfile/sys_dfile_session.c", 58 "$NSTACKX_ROOT/nstackx_core/platform/liteos/dfile/sys_file_manager.c", 59 "core/nstackx_dfile.c", 60 "core/nstackx_dfile_config.c", 61 "core/nstackx_dfile_control.c", 62 "core/nstackx_dfile_dfx.c", 63 "core/nstackx_dfile_frame.c", 64 "core/nstackx_dfile_log.c", 65 "core/nstackx_dfile_mp.c", 66 "core/nstackx_dfile_retransmission.c", 67 "core/nstackx_dfile_send.c", 68 "core/nstackx_dfile_session.c", 69 "core/nstackx_dfile_transfer.c", 70 "core/nstackx_file_list.c", 71 "core/nstackx_file_manager.c", 72 "core/nstackx_file_manager_client.c", 73 ] 74 deps = [ 75 "$NSTACKX_ROOT/nstackx_congestion:nstackx_congestion.open", 76 "$NSTACKX_ROOT/nstackx_util:nstackx_util.open", 77 "//third_party/mbedtls", 78 ] 79 } else if (ohos_kernel_type == "linux") { 80 configs += [ ":dfile_linux_config" ] 81 include_dirs = [ 82 "include", 83 "interface", 84 "$NSTACKX_ROOT/nstackx_congestion/interface/", 85 "$NSTACKX_ROOT/nstackx_core", 86 "$NSTACKX_ROOT/nstackx_util/interface", 87 "$NSTACKX_ROOT/nstackx_util/platform/unix", 88 "//third_party/bounds_checking_function/include/", 89 ] 90 sources = [ 91 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile.c", 92 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile_session.c", 93 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_file_manager.c", 94 "core/nstackx_dfile.c", 95 "core/nstackx_dfile_config.c", 96 "core/nstackx_dfile_control.c", 97 "core/nstackx_dfile_dfx.c", 98 "core/nstackx_dfile_frame.c", 99 "core/nstackx_dfile_log.c", 100 "core/nstackx_dfile_mp.c", 101 "core/nstackx_dfile_retransmission.c", 102 "core/nstackx_dfile_send.c", 103 "core/nstackx_dfile_session.c", 104 "core/nstackx_dfile_transfer.c", 105 "core/nstackx_file_list.c", 106 "core/nstackx_file_manager.c", 107 "core/nstackx_file_manager_client.c", 108 ] 109 deps = [ 110 "$NSTACKX_ROOT/nstackx_congestion:nstackx_congestion.open", 111 "$NSTACKX_ROOT/nstackx_util:nstackx_util.open", 112 "//third_party/mbedtls", 113 ] 114 } 115 } 116} else { 117 import("//build/ohos.gni") 118 119 ohos_shared_library("nstackx_dfile.open") { 120 cflags = [ 121 "-Wall", 122 "-DMBEDTLS_INCLUDED", 123 "-DNSTACKX_WITH_HMOS_LINUX", 124 "-DDFILE_ENABLE_HIDUMP", 125 "-DENABLE_USER_LOG", 126 ] 127 cflags_cc = cflags 128 include_dirs = [ 129 "include", 130 "interface", 131 "$NSTACKX_ROOT/nstackx_congestion/interface/", 132 "$NSTACKX_ROOT/nstackx_core", 133 "$NSTACKX_ROOT/nstackx_util/interface", 134 "$NSTACKX_ROOT/nstackx_util/platform/unix", 135 "//commonlibrary/c_utils/base/include/", 136 "//third_party/bounds_checking_function/include", 137 ] 138 sources = [ 139 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile.c", 140 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile_session.c", 141 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_file_manager.c", 142 "core/nstackx_dfile.c", 143 "core/nstackx_dfile_config.c", 144 "core/nstackx_dfile_control.c", 145 "core/nstackx_dfile_dfx.c", 146 "core/nstackx_dfile_frame.c", 147 "core/nstackx_dfile_log.c", 148 "core/nstackx_dfile_mp.c", 149 "core/nstackx_dfile_retransmission.c", 150 "core/nstackx_dfile_send.c", 151 "core/nstackx_dfile_session.c", 152 "core/nstackx_dfile_transfer.c", 153 "core/nstackx_file_list.c", 154 "core/nstackx_file_manager.c", 155 "core/nstackx_file_manager_client.c", 156 ] 157 deps = [ 158 "$NSTACKX_ROOT/nstackx_congestion:nstackx_congestion.open", 159 "$NSTACKX_ROOT/nstackx_util:nstackx_util.open", 160 "//third_party/bounds_checking_function:libsec_shared", 161 "//third_party/mbedtls", 162 ] 163 part_name = "dsoftbus" 164 subsystem_name = "communication" 165 } 166} 167