• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17ohos_shared_library("timer") {
18  include_dirs = [
19    "../../js_concurrent_module/common",
20    "../timer",
21  ]
22
23  sources = [
24    "../../js_concurrent_module/common/helper/napi_helper.cpp",
25    "timer.cpp",
26  ]
27
28  deps = []
29
30  defines = []
31
32  external_deps = [ "napi:ace_napi" ]
33
34  if (is_linux && current_toolchain == host_toolchain) {
35    deps += [ "$hilog_linux" ]
36    defines += [
37      "LINUX_PLATFORM",
38      "PREVIEW",
39    ]
40  } else {
41    if (is_standard_system) {
42      external_deps += [ "hilog:libhilog" ]
43    } else {
44      external_deps += [ "hilog:libhilog" ]
45    }
46  }
47
48  if (!is_mingw && !is_mac && !is_linux && product_name != "ohos-sdk") {
49    external_deps += [ "napi:ace_container_scope" ]
50    defines += [ "ENABLE_CONTAINER_SCOPE" ]
51  }
52
53  if (is_mingw) {
54    defines += [
55      "WINDOWS_PLATFORM",
56      "NOGDI",
57    ]
58  }
59  cflags = [ "-std=c++17" ]
60
61  subsystem_name = "commonlibrary"
62  innerapi_tags = [ "platformsdk" ]
63  part_name = "ets_utils"
64}
65
66ohos_source_set("timer_static") {
67  include_dirs = [
68    js_concurrent_module_common,
69    "../timer",
70  ]
71
72  sources = [
73    "$js_concurrent_module_common/helper/napi_helper.cpp",
74    "timer.cpp",
75  ]
76
77  deps = []
78
79  defines = []
80
81  configs = [ "$napi_root:ace_napi_config" ]
82
83  if (is_arkui_x) {
84    include_dirs += [
85      "$plugins_root/hilog/include",
86      "$plugins_root/interfaces",
87    ]
88    deps += [
89      "$plugins_root/libs/napi:napi_${target_os}",
90      "$plugins_root/libs/uv:uv_${target_os}",
91    ]
92    if (target_os == "android") {
93      defines += [ "ANDROID_PLATFORM" ]
94    }
95    if (target_os == "ios") {
96      defines += [ "IOS_PLATFORM" ]
97    }
98  } else {
99    deps += [ "$napi_root:ace_napi" ]
100  }
101
102  if (!is_mingw && !is_mac && !is_linux && product_name != "ohos-sdk") {
103    deps += [ "$napi_root:ace_container_scope_static" ]
104    defines += [ "ENABLE_CONTAINER_SCOPE" ]
105  }
106
107  subsystem_name = "commonlibrary"
108  part_name = "ets_utils"
109}
110
111group("timer_packages") {
112  deps = [ ":timer" ]
113}
114