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