1# Copyright (c) 2020-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("//build/lite/config/component/lite_component.gni")
15declare_args() {
16  ohos_hiviewdfx_hilog_file_size = 1024000
17  enable_ohos_hiviewdfx_apphilogcat_init_release = false
18  enable_ohos_hiviewdfx_apphilogcat_init_debug = true
19  ohos_hiviewdfx_apphilogcat_log_level_release = 5
20  ohos_hiviewdfx_apphilogcat_log_level_debug = 3
21  apphilogcat_on = 1
22  apphilogcat_off = 0
23  enable_ohos_hiviewdfx_hilogcat_build = true
24  ohos_hiviewdfx_apphilogcat_log_dir = "/storage/data/log"
25}
26if (ohos_kernel_type != "liteos_m") {
27  config("apphilogcat_config") {
28    defines = [ "HILOG_MAX_FILELEN = $ohos_hiviewdfx_hilog_file_size" ]
29
30    if (enable_ohos_hiviewdfx_apphilogcat_init_release) {
31      defines += [ "APPHILOGCAT_STATUS_RELEASE = $apphilogcat_on" ]
32    } else {
33      defines += [ "APPHILOGCAT_STATUS_RELEASE = $apphilogcat_off" ]
34    }
35
36    if (enable_ohos_hiviewdfx_apphilogcat_init_debug) {
37      defines += [ "APPHILOGCAT_STATUS_DEBUG = $apphilogcat_on" ]
38    } else {
39      defines += [ "APPHILOGCAT_STATUS_DEBUG = $apphilogcat_off" ]
40    }
41
42    defines += [ "CONFIG_LOG_LEVEL_RELEASE = $ohos_hiviewdfx_apphilogcat_log_level_release" ]
43
44    defines += [
45      "CONFIG_LOG_LEVEL_DEBUG = $ohos_hiviewdfx_apphilogcat_log_level_debug",
46    ]
47
48    defines += [ "HILOG_DIR = \"$ohos_hiviewdfx_apphilogcat_log_dir\"" ]
49  }
50
51  static_library("apphilogcat_static") {
52    sources = [ "hiview_applogcat.c" ]
53    include_dirs = [ "//third_party/bounds_checking_function/include" ]
54    deps = [
55      "//base/hiviewdfx/hilog_lite/command:hilog_command_static",
56      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
57      "//third_party/bounds_checking_function:libsec_shared",
58    ]
59    public_configs = [ ":apphilogcat_config" ]
60
61    if (enable_ohos_hiviewdfx_hilogcat_build) {
62      deps += [ "//base/hiviewdfx/hilog_lite/services/hilogcat:hilogcat" ]
63    }
64  }
65
66  lite_component("apphilogcat") {
67    target_type = "executable"
68
69    features = [ ":apphilogcat_static" ]
70  }
71} else {
72  group("apphilogcat") {
73  }
74}
75