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 = [ "bounds_checking_function:libsec_shared" ]
35  if (is_mingw || is_mac || is_linux) {
36    deps = [ "//foundation/arkui/napi:ace_napi" ]
37  } else {
38    deps = [ "../../../../interfaces/native/innerkits:libhilog" ]
39    external_deps += [ "napi:ace_napi" ]
40  }
41
42  cflags_cc = []
43  if (is_mingw) {
44    deps += [
45      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_windows",
46    ]
47    defines += [ "__WINDOWS__" ]
48    cflags_cc += [ "-std=c++17" ]
49  } else if (is_mac) {
50    deps +=
51        [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_mac" ]
52    defines += [ "__MAC__" ]
53  } else if (is_linux) {
54    deps +=
55        [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_linux" ]
56    defines += [ "__LINUX__" ]
57  }
58  subsystem_name = "hiviewdfx"
59  part_name = "hilog"
60}
61
62config("libhilog_js_cfg") {
63  visibility = [ "*:*" ]
64  include_dirs = [ "include" ]
65}
66
67ohos_shared_library("libhilognapi") {
68  sanitize = {
69    cfi = true
70    cfi_cross_dso = true
71    debug = false
72  }
73  deps = [ ":libhilognapi_src" ]
74
75  public_configs = [ ":libhilog_js_cfg" ]
76  configs = [ ":libhilog_js_cfg" ]
77
78  output_name = "libhilog_napi"
79  relative_install_dir = "module"
80  subsystem_name = "hiviewdfx"
81  part_name = "hilog"
82}
83