1# Copyright (c) 2022-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
14import("//base/hiviewdfx/faultloggerd/faultloggerd.gni")
15
16dfx_log_sources = [ "dfx_log.cpp" ]
17
18if (defined(ohos_lite)) {
19  config("dfx_log_config") {
20    visibility = [ ":*" ]
21    include_dirs = [
22      ".",
23      "$faultloggerd_interfaces_path/common",
24      "$hilog_lite_include_path",
25    ]
26    defines = [
27      "is_ohos=${is_ohos}",
28      "is_ohos_lite",
29    ]
30  }
31
32  static_library("dfx_hilog") {
33    sources = dfx_log_sources
34    public_configs = [ ":dfx_log_config" ]
35    deps = [ "$hilog_lite_deps_path" ]
36  }
37
38  static_library("dfx_hilog_dmesg") {
39    sources = dfx_log_sources
40    public_configs = [ ":dfx_log_config" ]
41    defines = [ "DFX_LOG_DMESG" ]
42    deps = [ "$hilog_lite_deps_path" ]
43  }
44} else {
45  config("dfx_log_config") {
46    visibility = [ ":*" ]
47    include_dirs = [
48      ".",
49      "$faultloggerd_interfaces_path/common",
50    ]
51  }
52
53  ohos_static_library("dfx_hilog") {
54    sources = dfx_log_sources
55    public_configs = [ ":dfx_log_config" ]
56    external_deps = [
57      "c_utils:utils",
58      "hilog:libhilog",
59    ]
60    part_name = "faultloggerd"
61    subsystem_name = "hiviewdfx"
62  }
63
64  ohos_static_library("dfx_hilog_dmesg") {
65    sources = dfx_log_sources
66    public_configs = [ ":dfx_log_config" ]
67    defines = [ "DFX_LOG_DMESG" ]
68    external_deps = [
69      "c_utils:utils",
70      "hilog:libhilog",
71    ]
72    part_name = "faultloggerd"
73    subsystem_name = "hiviewdfx"
74  }
75
76  ohos_static_library("dfx_hilog_base") {
77    sources = dfx_log_sources
78    public_configs = [ ":dfx_log_config" ]
79    defines = [ "DFX_LOG_HILOG_BASE" ]
80    external_deps = [
81      "c_utils:utils",
82      "hilog:libhilog_base",
83    ]
84    part_name = "faultloggerd"
85    subsystem_name = "hiviewdfx"
86  }
87
88  # just for updater subsystem, use dfx_libhilog_base first
89  ohos_static_library("dfx_hilog_base_static") {
90    sources = dfx_log_sources
91    public_configs = [ ":dfx_log_config" ]
92    defines = [ "DFX_LOG_HILOG_BASE" ]
93    external_deps = [
94      "bounds_checking_function:libsec_static",
95      "c_utils:utilsbase",
96      "hilog:libhilog_base",
97    ]
98    part_name = "faultloggerd"
99    subsystem_name = "hiviewdfx"
100  }
101
102  ohos_static_library("dfx_hilog_base_dmesg") {
103    sources = dfx_log_sources
104    public_configs = [ ":dfx_log_config" ]
105    defines = [
106      "DFX_LOG_HILOG_BASE",
107      "DFX_LOG_DMESG",
108    ]
109    external_deps = [
110      "c_utils:utils",
111      "hilog:libhilog_base",
112    ]
113    part_name = "faultloggerd"
114    subsystem_name = "hiviewdfx"
115  }
116}
117