1# Copyright (c) 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/ohos.gni")
15import("//commonlibrary/ets_utils/ets_utils_config.gni")
16
17config("console_public_config") {
18  visibility = [ ":*" ]
19  include_dirs = [ "${sys_module}/console" ]
20}
21
22ohos_shared_library("console") {
23  branch_protector_ret = "pac_ret"
24  sanitize = {
25    cfi = true
26    cfi_cross_dso = true
27    debug = false
28  }
29
30  include_dirs = [
31    "../../js_concurrent_module/common",
32    "../console",
33  ]
34
35  public_configs = [ ":console_public_config" ]
36
37  sources = [
38    "../../js_concurrent_module/common/helper/napi_helper.cpp",
39    "console.cpp",
40  ]
41
42  deps = []
43
44  external_deps = [ "napi:ace_napi" ]
45
46  if (is_linux && current_toolchain == host_toolchain) {
47    deps += [ "$hilog_linux" ]
48    defines = [
49      "LINUX_PLATFORM",
50      "PREVIEW",
51    ]
52  } else if (is_mingw) {
53    external_deps += [ "hilog:libhilog" ]
54    defines = [
55      "WINDOWS_PLATFORM",
56      "NOGDI",
57    ]
58  } else if (is_mac && !is_arkui_x) {
59    external_deps += [ "hilog:libhilog" ]
60  } else if (is_standard_system) {
61    external_deps += [ "hilog:libhilog" ]
62  } else if (is_arkui_x) {
63    if (target_os == "ios") {
64      deps += [ "$hilog_ios" ]
65    } else if (target_os == "android") {
66      deps += [ "$hilog_android" ]
67    }
68  } else {
69    external_deps += [ "hilog:libhilog" ]
70  }
71  cflags = [ "-std=c++17" ]
72
73  subsystem_name = "commonlibrary"
74  innerapi_tags = [ "platformsdk_indirect" ]
75  part_name = "ets_utils"
76}
77
78ohos_source_set("console_static") {
79  branch_protector_ret = "pac_ret"
80  sanitize = {
81    cfi = true
82    cfi_cross_dso = true
83    debug = false
84  }
85  include_dirs = [
86    js_concurrent_module_common,
87    "../console",
88  ]
89
90  sources = [
91    "$js_concurrent_module_common/helper/napi_helper.cpp",
92    "console.cpp",
93  ]
94
95  deps = []
96
97  defines = []
98
99  if (is_arkui_x) {
100    include_dirs += [
101      "$plugins_root/hilog/include",
102      "$plugins_root/interfaces",
103    ]
104    deps += [ "$plugins_root/libs/napi:napi_${target_os}" ]
105    if (target_os == "android") {
106      defines += [ "ANDROID_PLATFORM" ]
107    }
108    if (target_os == "ios") {
109      defines += [ "IOS_PLATFORM" ]
110    }
111  } else {
112    deps += [ "$napi_root:ace_napi" ]
113  }
114
115  subsystem_name = "commonlibrary"
116  part_name = "ets_utils"
117}
118
119group("console_packages") {
120  deps = [ ":console" ]
121}
122