1# Copyright (c) 2021-2024 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("//foundation/arkui/ace_engine/ace_config.gni") 16 17template("ace_base_source_set") { 18 forward_variables_from(invoker, "*") 19 20 ohos_source_set(target_name) { 21 if (current_os == "ohos") { 22 sanitize = { 23 integer_overflow = true 24 boundary_sanitize = true 25 debug = ace_sanitize_debug 26 } 27 } 28 subsystem_name = ace_engine_subsystem 29 part_name = ace_engine_part 30 defines += invoker.defines 31 deps = [ 32 "base64:ace_base_base64_$platform", 33 "i18n:ace_base_i18n_$platform", 34 "resource:ace_resource", 35 ] 36 external_deps = [] 37 include_dirs = [] 38 if (use_hilog) { 39 external_deps += [ "hilog:libhilog" ] 40 } 41 configs = [ "$ace_root:ace_config" ] 42 43 # add base source file here 44 sources = [ 45 "geometry/animatable_dimension.cpp", 46 "geometry/animatable_matrix4.cpp", 47 "geometry/dimension.cpp", 48 "geometry/least_square_impl.cpp", 49 "geometry/matrix3.cpp", 50 "geometry/matrix4.cpp", 51 "geometry/quaternion.cpp", 52 "geometry/transform_util.cpp", 53 "image/pixel_map.cpp", 54 "json/json_util.cpp", 55 "json/node_object.cpp", 56 "json/uobject.cpp", 57 "log/ace_performance_check.cpp", 58 "log/ace_performance_monitor.cpp", 59 "log/ace_scoring_log.cpp", 60 "log/ace_trace.cpp", 61 "log/ace_tracker.cpp", 62 "log/dump_log.cpp", 63 "log/jank_frame_report.cpp", 64 "memory/memory_monitor.cpp", 65 "perfmonitor/perf_monitor.cpp", 66 "ressched/ressched_report.cpp", 67 "subwindow/subwindow_manager.cpp", 68 "thread/background_task_executor.cpp", 69 "utils/base_id.cpp", 70 "utils/date_util.cpp", 71 "utils/measure_util.cpp", 72 "utils/resource_configuration.cpp", 73 "utils/string_expression.cpp", 74 "utils/string_utils.cpp", 75 "utils/time_util.cpp", 76 "utils/utf.cpp", 77 "utils/utils.cpp", 78 ] 79 80 if (platform != "windows") { 81 # add secure c API 82 if (is_arkui_x) { 83 deps += [ "//third_party/bounds_checking_function:libsec_static" ] 84 } 85 } else { 86 defines -= [ "UNICODE" ] 87 libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libshlwapi.a" ] 88 } 89 90 if (is_arkui_x) { 91 deps += [ 92 "${ace_graphic}/rosen/modules/render_service_client:librender_service_client_static", 93 "${ace_root}/interfaces/inner_api/drawable_descriptor:native_drawabledescriptor_static", 94 ] 95 } else { 96 external_deps += [ "graphic_2d:librender_service_client" ] 97 } 98 99 if (is_arkui_x) { 100 deps += [ "//third_party/cJSON:cjson_static" ] 101 } else { 102 external_deps += [ "cJSON:cjson" ] 103 } 104 105 cflags_cc = [] 106 cflags_cc += invoker.cflags_cc 107 } 108} 109 110foreach(item, ace_platforms) { 111 ace_base_source_set("ace_base_" + item.name) { 112 platform = item.name 113 defines = [] 114 cflags_cc = [] 115 config = { 116 } 117 118 if (defined(item.config)) { 119 config = item.config 120 } 121 122 if (defined(config.defines)) { 123 defines = config.defines 124 } 125 126 if (defined(config.cflags_cc)) { 127 cflags_cc = config.cflags_cc 128 } 129 } 130 131 ohos_source_set("ace_memory_monitor_" + item.name) { 132 platform = item.name 133 subsystem_name = ace_engine_subsystem 134 part_name = ace_engine_part 135 defines = [] 136 cflags_cc = [] 137 config = { 138 } 139 140 if (defined(item.config)) { 141 config = item.config 142 } 143 144 if (defined(config.defines)) { 145 defines = config.defines 146 } 147 148 if (defined(config.cflags_cc)) { 149 cflags_cc = config.cflags_cc 150 } 151 152 configs = [ "$ace_root:ace_config" ] 153 154 sources = [ 155 "$ace_root/frameworks/base/log/dump_log.cpp", 156 "$ace_root/frameworks/base/memory/memory_monitor.cpp", 157 ] 158 159 if (platform == "windows" || platform == "mac" || platform == "linux") { 160 sources += [ 161 "$ace_root/adapter/preview/osal/event_report.cpp", 162 "$ace_root/adapter/preview/osal/system_properties.cpp", 163 ] 164 } else { 165 sources += [ "$ace_root/adapter/$platform/osal/system_properties.cpp" ] 166 } 167 168 if (platform == "ohos") { 169 external_deps = [ 170 "ability_runtime:abilitykit_native", 171 "hilog:libhilog", 172 "i18n:intl_util", 173 "init:libbeget_proxy", 174 "init:libbegetutil", 175 "napi:ace_napi", 176 "window_manager:libdm", 177 ] 178 179 if (defined(config.hichecker_exists) && config.hichecker_exists) { 180 external_deps += [ "hichecker:libhichecker" ] 181 } 182 } 183 } 184} 185