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