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      cfi = true
59      cfi_cross_dso = true
60      debug = false
61    }
62    branch_protector_ret = "pac_ret"
63    include_dirs = [
64      "$dsoftbus_dfx_path/interface/include",
65      "$dsoftbus_root_path/interfaces/kits/common",
66    ]
67    sources = softbus_log_src
68    defines += [ "__STDC_FORMAT_MACROS" ]
69    if (is_asan) {
70      defines += [ "ASAN_BUILD" ]
71    }
72
73    public_configs = [ ":dsoftbus_log_interface_std" ]
74    external_deps = [
75      "bounds_checking_function:libsec_shared",
76      "hilog:libhilog",
77    ]
78    innerapi_tags = [ "platformsdk_indirect" ]
79    part_name = "dsoftbus"
80    subsystem_name = "communication"
81  }
82}
83