• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("../dsoftbus.gni")
15
16if (defined(ohos_lite)) {
17  import("//build/lite/config/component/lite_component.gni")
18  config("dsoftbus_adapter_common_interface") {
19    include_dirs = [
20      "$softbus_adapter_common/include",
21      "$softbus_adapter_common/include/OS_adapter_define/linux",
22      "$softbus_adapter_config/spec_config",
23      "$dsoftbus_root_path/core/common/include",
24      "$hilog_lite_include_path",
25    ]
26    if (board_name == "v200zr") {
27      defines = [ "DSOFTBUS_V200ZR" ]
28    }
29  }
30
31  common_include = [
32    "$dsoftbus_root_path/interfaces/kits",
33    "$dsoftbus_root_path/interfaces/kits/common",
34    "//base/startup/init/interfaces/innerkits/include/syspara",
35    "//third_party/bounds_checking_function/include",
36  ]
37
38  if (ohos_kernel_type == "liteos_m") {
39    static_library("softbus_adapter") {
40      include_dirs = common_include
41      include_dirs += [ "//kernel/liteos_m/kal/cmsis" ]
42      if (board_name == "hispark_pegasus") {
43        include_dirs +=
44            [ "$hispark_pegasus_sdk_path/third_party/lwip_sack/include" ]
45        defines = [ "HISPARK_PEGASUS_USE_NETIF_GET_ADDR" ]
46      }
47      if (board_toolchain_type == "iccarm") {
48        include_dirs += [
49          "//kernel/liteos_m/components/net/lwip-2.1/porting/include",
50          "//third_party/lwip/src/include",
51        ]
52        cflags = [
53          "--diag_suppress",
54          "Pe226,Pe513",
55        ]
56        ldflags = [ "-lpthread" ]
57      } else {
58        cflags = [ "-Wall" ]
59      }
60      sources = [
61        "$softbus_adapter_common/dfx/softbus_adapter_hisysevent_mini.c",
62        "$softbus_adapter_common/dfx/softbus_adapter_hitrace_virtual.c",
63        "$softbus_adapter_common/kernel/liteos_m/lnn_ip_utils_adapter.c",
64        "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_file.c",
65        "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_mem.c",
66        "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_timer.c",
67        "$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c",
68        "$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c",
69        "$softbus_adapter_common/log/softbus_adapter_log.c",
70        "$softbus_adapter_common/range/softbus_adapter_range.c",
71        "$softbus_adapter_config/spec_config/softbus_config_adapter.c",
72      ]
73      if (board_name == "v200zr") {
74        sources = []
75        sources = [
76          "$softbus_adapter_common/dfx/softbus_adapter_hisysevent_mini.c",
77          "$softbus_adapter_common/dfx/softbus_adapter_hitrace_virtual.c",
78          "$softbus_adapter_common/kernel/liteos_m/lnn_ip_utils_adapter.c",
79          "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_mem.c",
80          "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_timer.c",
81          "$softbus_adapter_common/kernel/posix/softbus_adapter_file.c",
82          "$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c",
83          "$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c",
84          "$softbus_adapter_common/log/softbus_adapter_log.c",
85          "$softbus_adapter_common/range/softbus_adapter_range.c",
86          "$softbus_adapter_config/spec_config/softbus_config_adapter.c",
87        ]
88      }
89
90      deps = [ "$hilog_lite_deps_path" ]
91
92      if (dsoftbus_feature_encrypt == 0) {
93        sources +=
94            [ "$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c" ]
95        deps += [ "//third_party/mbedtls" ]
96      } else if (dsoftbus_feature_encrypt == 1) {
97        sources +=
98            [ "$softbus_adapter_common/openssl/softbus_adapter_crypto.c" ]
99        deps += [ "//third_party/openssl/ohos_lite:openssl_shared" ]
100      }
101      public_configs = [ ":dsoftbus_adapter_common_interface" ]
102    }
103  } else {
104    shared_library("softbus_adapter") {
105      include_dirs = common_include
106      cflags = [
107        "-Wall",
108        "-Werror",
109        "-fPIC",
110        "-fno-builtin",
111        "-std=c99",
112      ]
113      cflags_cc = [ "-fPIC" ]
114      sources = [
115        "$softbus_adapter_common/dfx/softbus_adapter_hisysevent_mini.c",
116        "$softbus_adapter_common/dfx/softbus_adapter_hitrace_virtual.c",
117        "$softbus_adapter_common/kernel/posix/lnn_ip_utils_adapter.c",
118        "$softbus_adapter_common/kernel/posix/softbus_adapter_file.c",
119        "$softbus_adapter_common/kernel/posix/softbus_adapter_mem.c",
120        "$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c",
121        "$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c",
122        "$softbus_adapter_common/kernel/posix/softbus_adapter_timer.c",
123        "$softbus_adapter_common/log/softbus_adapter_log.c",
124        "$softbus_adapter_common/range/softbus_adapter_range.c",
125        "$softbus_adapter_config/spec_config/softbus_config_adapter.c",
126      ]
127      deps = [
128        "$hilog_lite_deps_path",
129        "//base/startup/init/interfaces/innerkits:libbegetutil",
130        "//third_party/bounds_checking_function:libsec_shared",
131      ]
132
133      if (dsoftbus_feature_encrypt == 0) {
134        sources +=
135            [ "$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c" ]
136        deps += [ "//third_party/mbedtls" ]
137      } else if (dsoftbus_feature_encrypt == 1) {
138        sources +=
139            [ "$softbus_adapter_common/openssl/softbus_adapter_crypto.c" ]
140        deps += [ "//third_party/openssl/ohos_lite:openssl_shared" ]
141      }
142      public_configs = [ ":dsoftbus_adapter_common_interface" ]
143    }
144  }
145} else {
146  config("config_adapter_common") {
147    include_dirs = [
148      "$softbus_adapter_common/include",
149      "$softbus_adapter_common/include/OS_adapter_define/linux",
150      "$dsoftbus_feature_product_config_path/spec_config",
151      "$dsoftbus_root_path/core/common/include",
152      "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include",
153    ]
154  }
155
156  ohos_shared_library("softbus_adapter") {
157    include_dirs = [
158      "$dsoftbus_root_path/interfaces/kits",
159      "$dsoftbus_root_path/interfaces/kits/common",
160      "//commonlibrary/c_utils/base/include",
161      "//third_party/bounds_checking_function/include",
162      "//third_party/json/include",
163    ]
164    sources = [
165      "$dsoftbus_feature_product_config_path/spec_config/softbus_config_adapter.c",
166      "$softbus_adapter_common/dfx/softbus_adapter_hisysevent.cpp",
167      "$softbus_adapter_common/dfx/softbus_adapter_hitrace.c",
168      "$softbus_adapter_common/json/nlohmann/softbus_adapter_json.cpp",
169      "$softbus_adapter_common/kernel/posix/lnn_ip_utils_adapter.c",
170      "$softbus_adapter_common/kernel/posix/softbus_adapter_file.c",
171      "$softbus_adapter_common/kernel/posix/softbus_adapter_mem.c",
172      "$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c",
173      "$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c",
174      "$softbus_adapter_common/kernel/posix/softbus_adapter_timer.c",
175      "$softbus_adapter_common/log/softbus_adapter_log.c",
176      "$softbus_adapter_common/perf/softbus_adapter_perf.c",
177    ]
178    public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
179    native_source_path = rebase_path("$dsoftbus_root_path")
180
181    ble_enhanced_impl =
182        "dsoftbus_enhance/adapter/common/range/softbus_adapter_range.c"
183    enhanced_range = exec_script("$dsoftbus_root_path/check_sub_module.py",
184                                 [
185                                   "$native_source_path",
186                                   "$ble_enhanced_impl",
187                                 ],
188                                 "value")
189    if (enhanced_range) {
190      include_dirs += [
191        "$dsoftbus_root_path/dsoftbus_enhance/adapter/common/mlps/include",
192        "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/lane_hub/mlps/include",
193        "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/lane_hub/mlps/interface",
194      ]
195      sources += [
196        "$dsoftbus_root_path/dsoftbus_enhance/adapter/common/mlps/src/softbus_adapter_mlps.cpp",
197        "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/lane_hub/mlps/src/mlps.cpp",
198      ]
199    }
200
201    external_deps = []
202    if (enhanced_range && defined(global_parts_info.msdp_algorithm)) {
203      include_dirs += [ "//base/msdp/algorithm/ble_range/include" ]
204      sources += [ "$dsoftbus_root_path/dsoftbus_enhance/adapter/common/range/softbus_adapter_range.c" ]
205      external_deps += [ "algorithm:msdp_ble_range" ]
206    } else {
207      sources += [ "$softbus_adapter_common/range/softbus_adapter_range.c" ]
208    }
209
210    if (dsoftbus_feature_encrypt == 0) {
211      sources += [ "$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c" ]
212      public_deps += [ "//third_party/mbedtls" ]
213    } else if (dsoftbus_feature_encrypt == 1) {
214      sources += [ "$softbus_adapter_common/openssl/softbus_adapter_crypto.c" ]
215      public_deps += [ "//third_party/openssl:libcrypto_shared" ]
216    }
217    public_configs = [ ":config_adapter_common" ]
218    if (is_standard_system) {
219      external_deps += [
220        "hilog:libhilog",
221        "hisysevent:libhisysevent",
222        "hitrace:libhitracechain",
223        "init:libbegetutil",
224      ]
225    }
226    innerapi_tags = [ "platformsdk_indirect" ]
227    part_name = "dsoftbus"
228    subsystem_name = "communication"
229  }
230}
231