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 (is_arkui_x) { 39 deps += [ "//third_party/cJSON:cjson_static" ] 40 } else { 41 external_deps += [ "cJSON:cjson" ] 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/dimension.cpp", 53 "geometry/least_square_impl.cpp", 54 "geometry/matrix3.cpp", 55 "geometry/matrix4.cpp", 56 "geometry/quaternion.cpp", 57 "geometry/transform_util.cpp", 58 "image/pixel_map.cpp", 59 "json/json_util.cpp", 60 "json/node_object.cpp", 61 "json/uobject.cpp", 62 "log/ace_performance_check.cpp", 63 "log/ace_performance_monitor.cpp", 64 "log/ace_scoring_log.cpp", 65 "log/ace_trace.cpp", 66 "log/ace_tracker.cpp", 67 "log/dump_log.cpp", 68 "log/jank_frame_report.cpp", 69 "memory/memory_monitor.cpp", 70 "perfmonitor/perf_monitor.cpp", 71 "ressched/ressched_report.cpp", 72 "subwindow/subwindow_manager.cpp", 73 "thread/background_task_executor.cpp", 74 "utils/base_id.cpp", 75 "utils/date_util.cpp", 76 "utils/measure_util.cpp", 77 "utils/resource_configuration.cpp", 78 "utils/string_expression.cpp", 79 "utils/string_utils.cpp", 80 "utils/time_util.cpp", 81 "utils/utf.cpp", 82 "utils/utils.cpp", 83 ] 84 85 if (platform != "windows") { 86 # add secure c API 87 if (is_arkui_x) { 88 deps += [ "//third_party/bounds_checking_function:libsec_static" ] 89 } 90 } else { 91 defines -= [ "UNICODE" ] 92 libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libshlwapi.a" ] 93 } 94 95 if (is_arkui_x) { 96 deps += [ 97 "${ace_graphic}/rosen/modules/render_service_client:librender_service_client_static", 98 "${ace_root}/interfaces/inner_api/drawable_descriptor:native_drawabledescriptor_static", 99 ] 100 include_dirs += [ 101 "//foundation/graphic/graphic_surface/interfaces/inner_api/surface", 102 ] 103 } else { 104 external_deps += [ "graphic_2d:librender_service_client" ] 105 } 106 107 cflags_cc = [] 108 cflags_cc += invoker.cflags_cc 109 } 110} 111 112foreach(item, ace_platforms) { 113 ace_base_source_set("ace_base_" + item.name) { 114 platform = item.name 115 defines = [] 116 cflags_cc = [] 117 config = { 118 } 119 120 if (defined(item.config)) { 121 config = item.config 122 } 123 124 if (defined(config.defines)) { 125 defines = config.defines 126 } 127 128 if (defined(config.cflags_cc)) { 129 cflags_cc = config.cflags_cc 130 } 131 } 132 133 ohos_source_set("ace_memory_monitor_" + item.name) { 134 platform = item.name 135 subsystem_name = ace_engine_subsystem 136 part_name = ace_engine_part 137 defines = [] 138 cflags_cc = [] 139 config = { 140 } 141 142 if (defined(item.config)) { 143 config = item.config 144 } 145 146 if (defined(config.defines)) { 147 defines = config.defines 148 } 149 150 if (defined(config.cflags_cc)) { 151 cflags_cc = config.cflags_cc 152 } 153 154 configs = [ "$ace_root:ace_config" ] 155 156 sources = [ 157 "$ace_root/frameworks/base/log/dump_log.cpp", 158 "$ace_root/frameworks/base/memory/memory_monitor.cpp", 159 ] 160 161 if (platform == "windows" || platform == "mac" || platform == "linux") { 162 sources += [ 163 "$ace_root/adapter/preview/osal/event_report.cpp", 164 "$ace_root/adapter/preview/osal/system_properties.cpp", 165 ] 166 } else { 167 sources += [ "$ace_root/adapter/$platform/osal/system_properties.cpp" ] 168 } 169 170 if (platform == "ohos") { 171 external_deps = [ 172 "hilog:libhilog", 173 "i18n:intl_util", 174 "init:libbeget_proxy", 175 "init:libbegetutil", 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