• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/ndk/ndk.gni")
15
16declare_args() {
17  hilog_lite_file_size = 8192
18  hilog_lite_disable_cache = false
19  hilog_lite_limit_level_default = 30
20  hilog_lite_disable_print_limit = false
21  hilog_lite_log_static_cache_size = 1024
22  hilog_lite_hiview_hilog_file_buf_size = 512
23  hilog_lite_disable_core_init = false
24  hilog_lite_customize_implementation = false
25}
26
27config("hilog_lite_config") {
28  include_dirs = [
29    "//base/hiviewdfx/hiview_lite",
30    "//commonlibrary/utils_lite/include",
31    "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
32    "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr",
33  ]
34}
35
36static_library("hilog_lite_static") {
37  sources = [
38    "hiview_log.c",
39    "hiview_log_limit.c",
40    "hiview_output_log.c",
41  ]
42  defines = [
43    "HIVIEW_LOG_FILE_SIZE=$hilog_lite_file_size",
44    "LOG_LIMIT_DEFAULT=$hilog_lite_limit_level_default",
45    "LOG_STATIC_CACHE_SIZE=$hilog_lite_log_static_cache_size",
46    "HIVIEW_HILOG_FILE_BUF_SIZE=$hilog_lite_hiview_hilog_file_buf_size",
47  ]
48  if (hilog_lite_disable_cache) {
49    defines += [ "DISABLE_HILOG_CACHE" ]
50  }
51  if (hilog_lite_disable_print_limit) {
52    defines += [ "DISABLE_HILOG_LITE_PRINT_LIMIT" ]
53  }
54  if (hilog_lite_disable_core_init) {
55    defines += [ "DISABLE_HILOG_LITE_CORE_INIT" ]
56  }
57  public_configs = [
58    "//base/hiviewdfx/hiview_lite:hiview_lite_config",
59    ":hilog_lite_config",
60  ]
61  if (board_toolchain_type == "iccarm") {
62    cflags = [
63      "--diag_suppress",
64      "Pa039",
65    ]
66  }
67  deps = [ "//base/hiviewdfx/hiview_lite" ]
68}
69
70group("hilog_lite") {
71  if (ohos_kernel_type == "liteos_m") {
72    if (hilog_lite_customize_implementation) {
73      public_configs = [
74        "//base/hiviewdfx/hiview_lite:hiview_lite_config",
75        ":hilog_lite_config",
76      ]
77    } else {
78      public_deps = [ ":hilog_lite_static" ]
79    }
80  }
81}
82
83ndk_lib("hilog_lite_ndk") {
84  deps = [ ":hilog_lite" ]
85  head_files =
86      [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ]
87}
88