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