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