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