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_cross_platform_build) { 78 deps += [ "//third_party/bounds_checking_function:libsec_static" ] 79 } else { 80 deps += [ "//third_party/bounds_checking_function:libsec_shared" ] 81 } 82 } else { 83 defines -= [ "UNICODE" ] 84 libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libshlwapi.a" ] 85 } 86 87 if (is_cross_platform_build) { 88 deps += [ "//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client_static" ] 89 } else { 90 external_deps += [ "graphic_2d:librender_service_client" ] 91 } 92 93 # curl download manager 94 if (defined(config.use_curl_download) && config.use_curl_download) { 95 configs += [ "//third_party/curl:curl_config" ] 96 sources += [ "$ace_root/frameworks/base/network/download_manager.cpp" ] 97 deps += [ "$ace_root/frameworks/base/network:cacert.pem" ] 98 if (is_cross_platform_build) { 99 deps += [ "//third_party/curl:curl" ] 100 } else { 101 deps += [ "//third_party/curl:curl_shared" ] 102 } 103 } 104 105 if (is_cross_platform_build || platform != "ohos") { 106 deps += [ "//third_party/cJSON:cjson_static" ] 107 } else { 108 deps += [ "//third_party/cJSON:cjson" ] 109 } 110 111 cflags_cc = [] 112 cflags_cc += invoker.cflags_cc 113 } 114} 115 116foreach(item, ace_platforms) { 117 ace_base_source_set("ace_base_" + item.name) { 118 platform = item.name 119 defines = [] 120 cflags_cc = [] 121 config = { 122 } 123 124 if (defined(item.config)) { 125 config = item.config 126 } 127 128 if (defined(config.defines)) { 129 defines = config.defines 130 } 131 132 if (defined(config.cflags_cc)) { 133 cflags_cc = config.cflags_cc 134 } 135 } 136 137 ohos_source_set("ace_memory_monitor_" + item.name) { 138 platform = item.name 139 subsystem_name = ace_engine_subsystem 140 part_name = ace_engine_part 141 defines = [] 142 cflags_cc = [] 143 config = { 144 } 145 146 if (defined(item.config)) { 147 config = item.config 148 } 149 150 if (defined(config.defines)) { 151 defines = config.defines 152 } 153 154 if (defined(config.cflags_cc)) { 155 cflags_cc = config.cflags_cc 156 } 157 158 configs = [ "$ace_root:ace_config" ] 159 160 sources = [ 161 "$ace_root/frameworks/base/log/dump_log.cpp", 162 "$ace_root/frameworks/base/memory/memory_monitor.cpp", 163 ] 164 165 if (platform == "windows" || platform == "mac" || platform == "linux") { 166 sources += [ "$ace_root/adapter/preview/osal/system_properties.cpp" ] 167 } else { 168 sources += [ "$ace_root/adapter/$platform/osal/system_properties.cpp" ] 169 } 170 171 if (platform == "ohos") { 172 external_deps = [ 173 "hichecker:libhichecker", 174 "init:libbeget_proxy", 175 "init:libbegetutil", 176 ] 177 } 178 } 179} 180