1# Copyright (c) 2020 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("//base/hiviewdfx/hilog/hilog.gni")
15import("//build/ohos.gni")
16
17ohos_source_set("libhilognapi_src") {
18  defines = []
19  include_dirs = [
20    "//base/hiviewdfx/hilog/frameworks/libhilog/param/include",
21    "//base/hiviewdfx/hilog/frameworks/libhilog/include",
22    "//base/hiviewdfx/hilog/interfaces/js/kits/napi/src/common/napi",
23    "//base/hiviewdfx/hilog/interfaces/js/kits/napi/src/hilog/include/context",
24  ]
25  sources = [
26    "src/common/napi/n_class.cpp",
27    "src/common/napi/n_func_arg.cpp",
28    "src/common/napi/n_val.cpp",
29    "src/hilog/module.cpp",
30    "src/hilog/src/hilog_napi.cpp",
31    "src/hilog/src/hilog_napi_base.cpp",
32  ]
33
34  external_deps = [
35    "bounds_checking_function:libsec_shared",
36    "node:node_header_notice",
37  ]
38  if (is_mingw || is_mac || is_linux) {
39    deps = [ "//foundation/arkui/napi:ace_napi" ]
40  } else {
41    deps = [ "../../../../interfaces/native/innerkits:libhilog" ]
42    external_deps += [ "napi:ace_napi" ]
43  }
44
45  cflags_cc = []
46  if (is_mingw) {
47    deps += [
48      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_windows",
49    ]
50    defines += [ "__WINDOWS__" ]
51    cflags_cc += [ "-std=c++17" ]
52  } else if (is_mac) {
53    deps +=
54        [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_mac" ]
55    defines += [ "__MAC__" ]
56  } else if (is_linux) {
57    deps +=
58        [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_linux" ]
59    defines += [ "__LINUX__" ]
60  }
61  subsystem_name = "hiviewdfx"
62  part_name = "hilog"
63}
64
65config("libhilog_js_cfg") {
66  visibility = [ "*:*" ]
67  include_dirs = [ "include" ]
68}
69
70ohos_shared_library("libhilognapi") {
71  sanitize = {
72    cfi = true
73    cfi_cross_dso = true
74    debug = false
75  }
76  deps = [ ":libhilognapi_src" ]
77
78  public_configs = [ ":libhilog_js_cfg" ]
79  configs = [ ":libhilog_js_cfg" ]
80
81  output_name = "libhilog_napi"
82  relative_install_dir = "module"
83  subsystem_name = "hiviewdfx"
84  part_name = "hilog"
85}
86