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")
15import("//build/lite/ndk/ndk.gni")
16declare_args() {
17  ohos_hiviewdfx_disable_privacy_feature = false
18}
19
20hilog_sources = [
21  "hilog.cpp",
22  "hiview_log.c",
23]
24
25config("hilog_config") {
26  include_dirs = [
27    "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
28    "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
29    "//third_party/bounds_checking_function/include",
30  ]
31  if (ohos_hiviewdfx_disable_privacy_feature) {
32    defines = [ "DISABLE_HILOG_PRIVACY" ]
33  }
34  if (ohos_kernel_type != "liteos_m") {
35    cflags = [
36      "-Wall",
37      "-fno-common",
38      "-fno-strict-aliasing",
39      "-O2",
40    ]
41  }
42}
43
44lite_library("hilog_static") {
45  target_type = "static_library"
46  sources = hilog_sources
47  public_configs = [ ":hilog_config" ]
48  public_deps = [ "//third_party/bounds_checking_function:libsec_static" ]
49}
50
51if (ohos_kernel_type != "liteos_m") {
52  lite_library("hilog_shared") {
53    target_type = "shared_library"
54    sources = hilog_sources
55    public_configs = [ ":hilog_config" ]
56    public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
57  }
58} else {
59  group("hilog_shared") {
60  }
61}
62
63ndk_lib("hilog_ndk") {
64  lib_extension = ".so"
65  deps = [ ":hilog_shared" ]
66  head_files = [
67    "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog",
68    "//third_party/bounds_checking_function/include",
69  ]
70}
71