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_dfx.gni")
15
16dsoftbus_root_path = "../../../.."
17
18softbus_log_src = [ "src/softbus_log.c" ]
19
20if (defined(ohos_lite)) {
21  if (ohos_kernel_type == "liteos_m") {
22    build_type = "static_library"
23    libsec_external_deps = [ "bounds_checking_function:libsec_static" ]
24  } else {
25    build_type = "shared_library"
26    libsec_external_deps = [ "bounds_checking_function:libsec_shared" ]
27  }
28  config("dsoftbus_log_interface_lite") {
29    include_dirs = [
30      "$dsoftbus_dfx_path/interface/include",
31      "$dsoftbus_root_path/interfaces/kits/common",
32      "$hilog_lite_include_path",
33      "$utils_lite_include_path",
34    ]
35    cflags = ohos_lite_cflags
36    cflags_cc = ohos_lite_cflags
37  }
38
39  target(build_type, "softbus_dfx_log") {
40    include_dirs = [
41      "$dsoftbus_dfx_path/interface/include",
42      "$dsoftbus_root_path/interfaces/kits/common",
43    ]
44    sources = softbus_log_src
45    deps = [ "$hilog_lite_deps_path" ]
46    external_deps = libsec_external_deps
47    public_configs = [ ":dsoftbus_log_interface_lite" ]
48  }
49} else {
50  config("dsoftbus_log_interface_std") {
51    include_dirs = [
52      "$dsoftbus_dfx_path/interface/include",
53      "$dsoftbus_root_path/interfaces/kits/common",
54    ]
55  }
56  ohos_shared_library("softbus_dfx_log") {
57    sanitize = {
58      ubsan = true
59      integer_overflow = true
60      boundary_sanitize = true
61      cfi = true
62      cfi_cross_dso = true
63      debug = false
64    }
65    branch_protector_ret = "pac_ret"
66    include_dirs = [
67      "$dsoftbus_dfx_path/interface/include",
68      "$dsoftbus_root_path/interfaces/kits/common",
69    ]
70    sources = softbus_log_src
71    defines += [ "__STDC_FORMAT_MACROS" ]
72    if (is_asan) {
73      defines += [ "ASAN_BUILD" ]
74    }
75
76    public_configs = [ ":dsoftbus_log_interface_std" ]
77    external_deps = [
78      "bounds_checking_function:libsec_shared",
79      "hilog:libhilog",
80    ]
81    innerapi_tags = [ "platformsdk_indirect" ]
82    part_name = "dsoftbus"
83    subsystem_name = "communication"
84  }
85}
86