1d96309c9Sopenharmony_ci# Copyright (c) 2020-2023 Huawei Device Co., Ltd.
2d96309c9Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3d96309c9Sopenharmony_ci# you may not use this file except in compliance with the License.
4d96309c9Sopenharmony_ci# You may obtain a copy of the License at
5d96309c9Sopenharmony_ci#
6d96309c9Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7d96309c9Sopenharmony_ci#
8d96309c9Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9d96309c9Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10d96309c9Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11d96309c9Sopenharmony_ci# See the License for the specific language governing permissions and
12d96309c9Sopenharmony_ci# limitations under the License.
13d96309c9Sopenharmony_ci
14d96309c9Sopenharmony_ciimport("//build/lite/ndk/ndk.gni")
15d96309c9Sopenharmony_ci
16d96309c9Sopenharmony_cideclare_args() {
17d96309c9Sopenharmony_ci  ohos_hiviewdfx_hilog_lite_file_size = 8192
18d96309c9Sopenharmony_ci  ohos_hiviewdfx_hilog_lite_disable_cache = false
19d96309c9Sopenharmony_ci  ohos_hiviewdfx_hilog_lite_limit_level_default = 30
20d96309c9Sopenharmony_ci  ohos_hiviewdfx_hilog_lite_disable_print_limit = false
21d96309c9Sopenharmony_ci  ohos_hiviewdfx_log_static_cache_size = 1024
22d96309c9Sopenharmony_ci  ohos_hiviewdfx_hiview_hilog_file_buf_size = 512
23d96309c9Sopenharmony_ci  hilog_lite_customize_implementation = false
24d96309c9Sopenharmony_ci}
25d96309c9Sopenharmony_ci
26d96309c9Sopenharmony_ciconfig("hilog_lite_config") {
27d96309c9Sopenharmony_ci  include_dirs = [
28d96309c9Sopenharmony_ci    "//base/hiviewdfx/hiview_lite",
29d96309c9Sopenharmony_ci    "//commonlibrary/utils_lite/include",
30d96309c9Sopenharmony_ci    "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
31d96309c9Sopenharmony_ci    "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr",
32d96309c9Sopenharmony_ci  ]
33d96309c9Sopenharmony_ci}
34d96309c9Sopenharmony_ci
35d96309c9Sopenharmony_cistatic_library("hilog_lite_static") {
36d96309c9Sopenharmony_ci  sources = [
37d96309c9Sopenharmony_ci    "hiview_log.c",
38d96309c9Sopenharmony_ci    "hiview_log_limit.c",
39d96309c9Sopenharmony_ci    "hiview_output_log.c",
40d96309c9Sopenharmony_ci  ]
41d96309c9Sopenharmony_ci  defines = [
42d96309c9Sopenharmony_ci    "HIVIEW_LOG_FILE_SIZE=$ohos_hiviewdfx_hilog_lite_file_size",
43d96309c9Sopenharmony_ci    "LOG_LIMIT_DEFAULT=$ohos_hiviewdfx_hilog_lite_limit_level_default",
44d96309c9Sopenharmony_ci    "LOG_STATIC_CACHE_SIZE=$ohos_hiviewdfx_log_static_cache_size",
45d96309c9Sopenharmony_ci    "HIVIEW_HILOG_FILE_BUF_SIZE=$ohos_hiviewdfx_hiview_hilog_file_buf_size",
46d96309c9Sopenharmony_ci  ]
47d96309c9Sopenharmony_ci  if (ohos_hiviewdfx_hilog_lite_disable_cache) {
48d96309c9Sopenharmony_ci    defines += [ "DISABLE_HILOG_CACHE" ]
49d96309c9Sopenharmony_ci  }
50d96309c9Sopenharmony_ci  if (ohos_hiviewdfx_hilog_lite_disable_print_limit) {
51d96309c9Sopenharmony_ci    defines += [ "DISABLE_HILOG_LITE_PRINT_LIMIT" ]
52d96309c9Sopenharmony_ci  }
53d96309c9Sopenharmony_ci  public_configs = [
54d96309c9Sopenharmony_ci    "//base/hiviewdfx/hiview_lite:hiview_lite_config",
55d96309c9Sopenharmony_ci    ":hilog_lite_config",
56d96309c9Sopenharmony_ci  ]
57d96309c9Sopenharmony_ci  if (board_toolchain_type == "iccarm") {
58d96309c9Sopenharmony_ci    cflags = [
59d96309c9Sopenharmony_ci      "--diag_suppress",
60d96309c9Sopenharmony_ci      "Pa039",
61d96309c9Sopenharmony_ci    ]
62d96309c9Sopenharmony_ci  }
63d96309c9Sopenharmony_ci  deps = [ "//base/hiviewdfx/hiview_lite" ]
64d96309c9Sopenharmony_ci}
65d96309c9Sopenharmony_ci
66d96309c9Sopenharmony_cigroup("hilog_lite") {
67d96309c9Sopenharmony_ci  if (ohos_kernel_type == "liteos_m") {
68d96309c9Sopenharmony_ci    if (hilog_lite_customize_implementation) {
69d96309c9Sopenharmony_ci      public_configs = [
70d96309c9Sopenharmony_ci        "//base/hiviewdfx/hiview_lite:hiview_lite_config",
71d96309c9Sopenharmony_ci        ":hilog_lite_config",
72d96309c9Sopenharmony_ci      ]
73d96309c9Sopenharmony_ci    } else {
74d96309c9Sopenharmony_ci      public_deps = [ ":hilog_lite_static" ]
75d96309c9Sopenharmony_ci    }
76d96309c9Sopenharmony_ci  }
77d96309c9Sopenharmony_ci}
78d96309c9Sopenharmony_ci
79d96309c9Sopenharmony_cindk_lib("hilog_lite_ndk") {
80d96309c9Sopenharmony_ci  deps = [ ":hilog_lite" ]
81d96309c9Sopenharmony_ci  head_files =
82d96309c9Sopenharmony_ci      [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ]
83d96309c9Sopenharmony_ci}
84