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("timer_public_config") { 18 include_dirs = [ 19 "${sys_module}/timer", 20 js_concurrent_module_common, 21 ] 22} 23 24ohos_shared_library("timer") { 25 branch_protector_ret = "pac_ret" 26 sanitize = { 27 cfi = true 28 cfi_cross_dso = true 29 debug = false 30 } 31 include_dirs = [ 32 "../../js_concurrent_module/common", 33 "../timer", 34 ets_util_path, 35 ] 36 37 sources = [ 38 "../../js_concurrent_module/common/helper/napi_helper.cpp", 39 "sys_timer.cpp", 40 ] 41 42 deps = [] 43 44 public_configs = [ ":timer_public_config" ] 45 46 defines = [] 47 48 external_deps = [ "napi:ace_napi" ] 49 50 if (is_linux && current_toolchain == host_toolchain) { 51 deps += [ "$hilog_linux" ] 52 defines += [ 53 "LINUX_PLATFORM", 54 "PREVIEW", 55 ] 56 } else { 57 if (is_standard_system) { 58 external_deps += [ "hilog:libhilog" ] 59 } else { 60 external_deps += [ "hilog:libhilog" ] 61 } 62 } 63 64 if (!is_mingw && !is_mac && !is_linux && product_name != "ohos-sdk") { 65 external_deps += [ "ace_engine:ace_container_scope" ] 66 defines += [ "ENABLE_CONTAINER_SCOPE" ] 67 if (!is_arkui_x) { 68 external_deps += [ "hitrace:hitrace_meter" ] 69 defines += [ "ENABLE_HITRACE_HELPER_METER" ] 70 } 71 } 72 73 if (is_mingw) { 74 defines += [ 75 "WINDOWS_PLATFORM", 76 "NOGDI", 77 ] 78 } 79 cflags = [ "-std=c++17" ] 80 81 subsystem_name = "commonlibrary" 82 innerapi_tags = [ "platformsdk" ] 83 part_name = "ets_utils" 84} 85 86ohos_source_set("timer_static") { 87 branch_protector_ret = "pac_ret" 88 sanitize = { 89 cfi = true 90 cfi_cross_dso = true 91 debug = false 92 } 93 include_dirs = [ 94 js_concurrent_module_common, 95 "../timer", 96 ets_util_path, 97 ] 98 99 sources = [ 100 "$js_concurrent_module_common/helper/napi_helper.cpp", 101 "sys_timer.cpp", 102 ] 103 104 deps = [] 105 106 defines = [] 107 108 external_deps = [ "napi:ace_napi" ] 109 if (is_arkui_x) { 110 include_dirs += [ 111 "$plugins_root/hilog/include", 112 "$plugins_root/interfaces", 113 "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", 114 ] 115 deps += [ 116 "$plugins_root/libs/napi:napi_${target_os}", 117 "$plugins_root/libs/uv:uv_${target_os}", 118 ] 119 if (target_os == "android") { 120 defines += [ "ANDROID_PLATFORM" ] 121 } 122 if (target_os == "ios") { 123 defines += [ "IOS_PLATFORM" ] 124 } 125 } 126 127 if (!is_mingw && !is_mac && !is_linux && product_name != "ohos-sdk") { 128 if (is_arkui_x) { 129 deps += [ "$ace_root/frameworks/core:ace_container_scope_static" ] 130 } else { 131 external_deps += [ "ace_engine:ace_container_scope" ] 132 external_deps += [ "hitrace:hitrace_meter" ] 133 defines += [ "ENABLE_HITRACE_HELPER_METER" ] 134 } 135 defines += [ "ENABLE_CONTAINER_SCOPE" ] 136 } 137 138 subsystem_name = "commonlibrary" 139 part_name = "ets_utils" 140} 141 142group("timer_packages") { 143 deps = [ ":timer" ] 144} 145