• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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")
16import("//foundation/arkui/ace_engine/ace_config.gni")
17import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni")
18
19ohos_shared_library("worker") {
20  include_dirs = [
21    "include",
22    js_concurrent_module_common,
23  ]
24
25  sources = [
26    "../common/helper/napi_helper.cpp",
27    "message_queue.cpp",
28    "native_module_worker.cpp",
29    "thread.cpp",
30    "worker.cpp",
31    "worker_new.cpp",
32    "worker_runner.cpp",
33  ]
34
35  deps = [ "${ets_util_path}/js_sys_module/timer:timer" ]
36
37  defines = []
38
39  if (is_ohos) {
40    defines += [ "OHOS_PLATFORM" ]
41  } else if (is_mingw) {
42    defines += [ "WINDOWS_PLATFORM" ]
43  } else if (target_os == "android") {
44    defines += [ "ANDROID_PLATFORM" ]
45  } else if (target_os == "ios") {
46    defines += [ "IOS_PLATFORM" ]
47  } else if (is_mac && target_os != "android") {
48    defines += [ "MAC_PLATFORM" ]
49  }
50
51  external_deps = [ "napi:ace_napi" ]
52
53  if (is_linux && current_toolchain == host_toolchain) {
54    external_deps += [ "innerkits:libhilog_linux" ]
55    defines = [
56      "LINUX_PLATFORM",
57      "PREVIEW",
58    ]
59  } else {
60    if (is_standard_system) {
61      external_deps += [
62        "hilog:libhilog",
63        "init:libbegetutil",
64      ]
65    } else {
66      external_deps += [ "hilog:libhilog" ]
67    }
68  }
69
70  external_deps += [ "hitrace:hitrace_meter" ]
71
72  subsystem_name = "commonlibrary"
73  part_name = "ets_utils"
74
75  relative_install_dir = "module"
76}
77
78ohos_source_set("worker_static") {
79  include_dirs = [
80    js_concurrent_module_common,
81    "$concurrent_module/worker",
82    "$sys_module/timer",
83  ]
84
85  sources = [
86    "$js_concurrent_module_common/helper/napi_helper.cpp",
87    "$sys_module/timer/timer.cpp",
88    "message_queue.cpp",
89    "native_module_worker.cpp",
90    "thread.cpp",
91    "worker.cpp",
92    "worker_new.cpp",
93    "worker_runner.cpp",
94  ]
95  deps = []
96
97  defines = []
98
99  external_deps = []
100  if (is_standard_system) {
101    external_deps += [
102      "hilog:libhilog",
103      "init:libbegetutil",
104    ]
105  } else {
106    external_deps += [
107      "c_utils:utils",
108      "hilog:libhilog",
109    ]
110  }
111
112  if (is_cross_platform_build) {
113    include_dirs += [
114      "$plugins_root/hilog/include",
115      "$plugins_root/interfaces",
116    ]
117    sources -= [
118      "$js_concurrent_module_common/helper/napi_helper.cpp",
119      "$sys_module/timer/timer.cpp",
120    ]
121    defines += [ "__ARKUI_CROSS__" ]
122    deps += [
123      "$plugins_root/libs/napi:napi_${target_os}",
124      "$plugins_root/libs/uv:uv_${target_os}",
125      "$sys_module/timer:timer_static",
126    ]
127    if (target_os == "android") {
128      defines += [ "ANDROID_PLATFORM" ]
129    }
130    if (target_os == "ios") {
131      defines += [ "IOS_PLATFORM" ]
132    }
133  } else {
134    deps += [ "$napi_root:ace_napi" ]
135    external_deps += [ "hitrace:hitrace_meter" ]
136  }
137
138  subsystem_name = "commonlibrary"
139  part_name = "ets_utils"
140}
141
142group("worker_packages") {
143  deps = [ ":worker" ]
144}
145