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/graphic/graphic_2d/graphic_config.gni") 16import("render_service_client.gni") 17 18config("render_service_client_config") { 19 include_dirs = [ 20 "$graphic_2d_root/rosen/modules", 21 "$graphic_2d_root/rosen/modules/render_service_client/core", 22 "$graphic_2d_root/rosen/modules/render_service_base/include", 23 "$graphic_2d_root/interfaces/inner_api/common", 24 "$graphic_2d_root/interfaces/inner_api/composer", 25 "$graphic_2d_root/rosen/modules/2d_engine/rosen_text/export/rosen_text/", 26 "$graphic_2d_root/rosen/modules/2d_graphics", 27 ] 28 defines = rs_common_define 29 if (defined(is_arkui_x) && is_arkui_x) { 30 include_dirs += [ 31 "$graphic_2d_root/utils/color_manager/export", 32 "//foundation/multimedia/image_framework/interfaces/innerkits/include", 33 ] 34 } 35} 36 37template("render_service_client_source_set") { 38 ohos_source_set(target_name) { 39 branch_protector_ret = "pac_ret" 40 sanitize = { 41 cfi = false 42 cfi_cross_dso = false 43 debug = false 44 blocklist = "./rs_client_blocklist.txt" 45 if (rosen_is_ohos) { 46 boundary_sanitize = true 47 integer_overflow = true 48 ubsan = true 49 } 50 } 51 defines = [] 52 defines += gpu_defines 53 defines += [ "MODULE_RSC" ] 54 is_static_lib = invoker.is_static_lib 55 include_dirs = [ 56 "$graphic_2d_root/rosen/modules/2d_graphics/src", 57 "$graphic_2d_root/rosen/modules/frame_report/include", 58 "$graphic_2d_root/rosen/modules/render_frame_trace/include", 59 "$graphic_2d_root/rosen/modules/render_service_base/src", 60 "$graphic_2d_root/utils/color_manager/export", 61 "$graphic_2d_root/rosen/modules/2d_engine/rosen_text/symbol/symbol_animation", 62 "$graphic_2d_root/utils/log", 63 "$graphic_2d_root/utils/sandbox", 64 ] 65 66 if (defined(is_arkui_x) && is_arkui_x) { 67 include_dirs += [ 68 "$graphic_2d_root/utils/color_manager/export", 69 "//foundation/multimedia/image_framework/interfaces/innerkits/include", 70 "//foundation/graphic/graphic_surface/interfaces/inner_api/surface", 71 ] 72 } 73 74 sources = [ 75 #animation 76 "core/animation/rs_animation.cpp", 77 "core/animation/rs_animation_callback.cpp", 78 "core/animation/rs_animation_group.cpp", 79 "core/animation/rs_animation_timing_curve.cpp", 80 "core/animation/rs_curve_animation.cpp", 81 "core/animation/rs_implicit_animation_param.cpp", 82 "core/animation/rs_implicit_animator.cpp", 83 "core/animation/rs_implicit_animator_map.cpp", 84 "core/animation/rs_interactive_implict_animator.cpp", 85 "core/animation/rs_interpolating_spring_animation.cpp", 86 "core/animation/rs_keyframe_animation.cpp", 87 "core/animation/rs_path_animation.cpp", 88 "core/animation/rs_property_animation.cpp", 89 "core/animation/rs_spring_animation.cpp", 90 "core/animation/rs_symbol_animation.cpp", 91 "core/animation/rs_transition.cpp", 92 "core/animation/rs_transition_effect.cpp", 93 94 #modifier 95 "core/modifier/rs_extended_modifier.cpp", 96 "core/modifier/rs_modifier.cpp", 97 "core/modifier/rs_modifier_extractor.cpp", 98 "core/modifier/rs_modifier_manager.cpp", 99 "core/modifier/rs_modifier_manager_map.cpp", 100 "core/modifier/rs_property.cpp", 101 "core/modifier/rs_property_modifier.cpp", 102 "core/modifier/rs_showing_properties_freezer.cpp", 103 104 #jank_detector 105 "core/jank_detector/rs_jank_detector.cpp", 106 107 #pipeline 108 "core/pipeline/rs_divided_ui_capture.cpp", 109 "core/pipeline/rs_node_map.cpp", 110 "core/pipeline/rs_render_thread.cpp", 111 "core/pipeline/rs_render_thread_util.cpp", 112 "core/pipeline/rs_render_thread_visitor.cpp", 113 114 #transaction 115 "core/transaction/rs_application_agent_impl.cpp", 116 "core/transaction/rs_interfaces.cpp", 117 "core/transaction/rs_render_thread_client.cpp", 118 "core/transaction/rs_sync_transaction_controller.cpp", 119 "core/transaction/rs_transaction.cpp", 120 121 #ui 122 "core/ui/rs_canvas_drawing_node.cpp", 123 "core/ui/rs_canvas_node.cpp", 124 "core/ui/rs_display_node.cpp", 125 "core/ui/rs_effect_node.cpp", 126 "core/ui/rs_ext_node_operation.cpp", 127 "core/ui/rs_frame_rate_linker.cpp", 128 "core/ui/rs_frame_rate_policy.cpp", 129 "core/ui/rs_node.cpp", 130 "core/ui/rs_proxy_node.cpp", 131 "core/ui/rs_root_node.cpp", 132 "core/ui/rs_surface_extractor.cpp", 133 "core/ui/rs_surface_node.cpp", 134 "core/ui/rs_texture_export.cpp", 135 "core/ui/rs_ui_director.cpp", 136 "core/ui/rs_ui_display_soloist.cpp", 137 "core/ui/rs_ui_share_context.cpp", 138 ] 139 140 if (is_cross_platform) { 141 #ui 142 sources -= [ "core/ui/rs_display_node.cpp" ] 143 defines += [ "CROSS_PLATFORM" ] 144 } 145 146 if (defined(graphic_2d_ext_configs.vendor_root)) { 147 sources += graphic_2d_ext_configs.librender_service_client_ext_sources 148 sources -= graphic_2d_ext_configs.librender_service_client_ext_sources_del 149 } 150 151 if (rosen_is_ohos) { 152 sources += [ "$rosen_root/modules/frame_report/src/rs_frame_report.cpp" ] 153 } else if (!is_arkui_x) { 154 sources += 155 [ "$rosen_root/modules/frame_report/src/mingw/rs_frame_report.cpp" ] 156 } 157 158 cflags = [ 159 "-Wall", 160 "-Wno-pointer-arith", 161 "-Wno-non-virtual-dtor", 162 "-Wno-missing-field-initializers", 163 "-Wno-c++11-narrowing", 164 "-fvisibility=hidden", 165 ] 166 167 if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) { 168 if (!use_libfuzzer) { 169 cflags += [ "-flto=thin" ] 170 } 171 if (enhanced_opt) { 172 if (!use_libfuzzer) { 173 cflags += [ "-fwhole-program-vtables" ] 174 } 175 } 176 } 177 178 cflags_cc = [ 179 "-std=c++17", 180 "-fvisibility-inlines-hidden", 181 ] 182 183 deps = [ 184 "$graphic_2d_root/rosen/modules/platform:ipc_core", 185 "$graphic_2d_root/rosen/modules/render_frame_trace:render_frame_trace", 186 ] 187 public_deps = [] 188 if (enable_export_macro) { 189 defines += [ "ENABLE_EXPORT_MACRO" ] 190 } 191 192 if (defined(use_rosen_drawing) && use_rosen_drawing) { 193 defines += [ "USE_ROSEN_DRAWING" ] 194 deps += [ "$graphic_2d_root/rosen/modules/2d_graphics:2d_graphics" ] 195 if (rs_enable_gpu && !is_arkui_x) { 196 defines += [ "RS_ENABLE_GPU" ] 197 } 198 if (current_os == "mingw") { 199 defines += [ "WINDOWS_PLATFORM" ] 200 } 201 } 202 203 if (is_arkui_x) { 204 defines += [ "ARKUI_X_ENABLE" ] 205 } 206 207 if (rosen_is_ohos) { 208 deps += [ 209 "$graphic_2d_root/rosen/modules/frame_analyzer:libframe_analyzer", 210 "$graphic_2d_root/utils/color_manager:color_manager", 211 ] 212 213 external_deps = [ 214 "bundle_framework:appexecfwk_base", 215 "bundle_framework:appexecfwk_core", 216 "c_utils:utils", 217 "hisysevent:libhisysevent", 218 "hitrace:hitrace_meter", 219 "image_framework:image_native", 220 "qos_manager:qos", 221 "samgr:samgr_proxy", 222 ] 223 224 defines += [ "RES_CLINET_SCHED_ENABLE" ] 225 226 if (accessibility_enable) { 227 external_deps += [ "accessibility:accessibilityconfig" ] 228 external_deps += [ "accessibility:accessibility_common" ] 229 defines += accessibility_defines 230 } 231 } else if (rosen_preview) { 232 deps += [ 233 "$graphic_2d_root/frameworks/opengl_wrapper:EGL", 234 "$graphic_2d_root/frameworks/opengl_wrapper:GLESv3", 235 "$graphic_2d_root/rosen/modules/glfw_render_context:libglfw_render_context", 236 ] 237 238 if (rss_enabled) { 239 external_deps = [] 240 } 241 } 242 if (defined(external_deps)) { 243 external_deps += [ "hilog:libhilog" ] 244 } else { 245 external_deps = [ "hilog:libhilog" ] 246 } 247 248 external_deps += [ "graphic_surface:surface_headers" ] 249 250 if (rosen_cross_platform) { 251 deps += [ "$rosen_root/modules/platform:hilog" ] 252 } 253 254 if (rss_enabled) { 255 defines += [ "OHOS_RSS_CLIENT" ] 256 external_deps += [ "resource_schedule_service:ressched_client" ] 257 } 258 259 if (is_static_lib) { 260 public_deps += [ "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base_static" ] 261 } else { 262 public_deps += [ "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base" ] 263 deps += [ "$rosen_root/modules/platform:eventhandler" ] 264 } 265 266 if (defined(graphic_2d_broker_configs.vendor_root) && !rosen_preview) { 267 sources += 268 graphic_2d_broker_configs.librender_service_client_ext_broker_sources 269 sources -= graphic_2d_broker_configs.librender_service_client_ext_broker_sources_del 270 external_deps += [ "ipc:ipc_core" ] 271 external_deps += [ "samgr:samgr_proxy" ] 272 } 273 274 if (tp_feature_enable) { 275 defines += tp_defines 276 } 277 278 if (defined(use_new_render_context) && use_new_render_context) { 279 public_deps += [ "$graphic_2d_root/rosen/modules/render_service_base/src/render_backend:librender_backend" ] 280 } 281 282 public_configs = [ ":render_service_client_config" ] 283 284 part_name = "graphic_2d" 285 subsystem_name = "graphic" 286 } 287} 288 289render_service_client_source_set("render_service_client_src") { 290 is_static_lib = false 291} 292 293render_service_client_source_set("render_service_client_src_static") { 294 is_static_lib = true 295} 296 297config("render_service_client_link_config") { 298 if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) { 299 ldflags = [ 300 "-Wl,--lto-O2", 301 "-Wl,-mllvm", 302 "-Wl,-wholeprogramdevirt-check=fallback", 303 "-Wl,-Bsymbolic", 304 ] 305 } 306} 307 308ohos_shared_library("librender_service_client") { 309 branch_protector_ret = "pac_ret" 310 sanitize = { 311 cfi = false 312 cfi_cross_dso = false 313 debug = false 314 blocklist = "./rs_client_blocklist.txt" 315 } 316 317 public_configs = [ ":render_service_client_config" ] 318 319 public_deps = [ ":render_service_client_src" ] 320 321 external_deps = [ "hilog:libhilog" ] 322 323 if (enhanced_opt) { 324 configs = [ ":render_service_client_link_config" ] 325 } 326 327 public_external_deps = [] 328 if (rosen_is_ohos) { 329 public_external_deps += [ "graphic_surface:surface" ] 330 } else if (rosen_preview) { 331 public_external_deps += [ "graphic_surface:surface_headers" ] 332 } 333 334 part_name = "graphic_2d" 335 subsystem_name = "graphic" 336} 337 338ohos_source_set("librender_service_client_static") { 339 branch_protector_ret = "pac_ret" 340 sanitize = { 341 cfi = false 342 cfi_cross_dso = false 343 debug = false 344 blocklist = "./rs_client_blocklist.txt" 345 } 346 public_deps = [ ":render_service_client_src_static" ] 347 deps = [ "$rosen_root/modules/platform:eventhandler" ] 348 349 public_external_deps = [] 350 if (rosen_is_ohos) { 351 public_external_deps += [ "graphic_surface:surface" ] 352 } else if (rosen_preview) { 353 public_external_deps += [ "graphic_surface:surface_headers" ] 354 } 355 356 part_name = "graphic_2d" 357 subsystem_name = "graphic" 358} 359 360group("test") { 361 if (rosen_is_ohos) { 362 testonly = true 363 364 deps = [ "test:test" ] 365 } 366} 367