1# Copyright (c) 2021-2023 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( 17 "//foundation/graphic/graphic_2d/rosen/modules/render_service_base/config.gni") 18 19config("export_config") { 20 cflags_cc = [ "-std=c++17" ] 21 include_dirs = [ 22 "include", 23 "$graphic_2d_root/rosen/modules/render_service_base/include/render_backend", 24 ] 25 26 defines = rs_common_define 27} 28 29if (!is_mingw && !is_mac && !is_cross_platform) { 30 defines = [ "ENABLE_RUST" ] 31 rust_cxx("particle_cxx_gen") { 32 sources = [ "rust/src/lib.rs" ] 33 } 34 35 ohos_rust_static_ffi("particle_cxx_rust") { 36 sources = [ "rust/src/lib.rs" ] 37 deps = [ "//third_party/rust/crates/cxx:lib" ] 38 part_name = "graphic_2d" 39 subsystem_name = "graphic" 40 } 41 42 ohos_static_library("particle_cxx_cppdeps") { 43 part_name = "graphic_2d" 44 subsystem_name = "graphic" 45 defines += [ "RUST_CXX_NO_EXCEPTIONS" ] 46 sources = [ 47 "//third_party/rust/crates/cxx/include/cxx.h", 48 "//third_party/rust/crates/cxx/src/cxx.cc", 49 ] 50 deps = [ "//third_party/rust/crates/cxx:lib" ] 51 } 52} 53 54ohos_source_set("render_service_base_src") { 55 defines = [] 56 defines += gpu_defines 57 defines += [ "MODULE_RSB" ] 58 59 sources = [ 60 #animation 61 "src/animation/rs_animation_fraction.cpp", 62 "src/animation/rs_animation_manager.cpp", 63 "src/animation/rs_animation_timing_protocol.cpp", 64 "src/animation/rs_interpolator.cpp", 65 "src/animation/rs_render_animation.cpp", 66 "src/animation/rs_render_curve_animation.cpp", 67 "src/animation/rs_render_interpolating_spring_animation.cpp", 68 "src/animation/rs_render_keyframe_animation.cpp", 69 "src/animation/rs_render_particle.cpp", 70 "src/animation/rs_render_particle_animation.cpp", 71 "src/animation/rs_render_particle_effector.cpp", 72 "src/animation/rs_render_particle_emitter.cpp", 73 "src/animation/rs_render_particle_system.cpp", 74 "src/animation/rs_render_path_animation.cpp", 75 "src/animation/rs_render_property_animation.cpp", 76 "src/animation/rs_render_spring_animation.cpp", 77 "src/animation/rs_render_transition.cpp", 78 "src/animation/rs_render_transition_effect.cpp", 79 "src/animation/rs_spring_interpolator.cpp", 80 "src/animation/rs_spring_model.cpp", 81 "src/animation/rs_steps_interpolator.cpp", 82 "src/animation/rs_value_estimator.cpp", 83 84 # message(depracated) 85 "src/command/rs_message_processor.cpp", 86 87 # modifier 88 "src/modifier/rs_render_modifier.cpp", 89 "src/modifier/rs_render_property.cpp", 90 91 #command 92 "src/command/rs_animation_command.cpp", 93 "src/command/rs_base_node_command.cpp", 94 "src/command/rs_canvas_drawing_node_command.cpp", 95 "src/command/rs_canvas_node_command.cpp", 96 "src/command/rs_command_factory.cpp", 97 "src/command/rs_display_node_command.cpp", 98 "src/command/rs_effect_node_command.cpp", 99 "src/command/rs_node_command.cpp", 100 "src/command/rs_node_showing_command.cpp", 101 "src/command/rs_proxy_node_command.cpp", 102 "src/command/rs_root_node_command.cpp", 103 "src/command/rs_surface_node_command.cpp", 104 105 #offscreen_render 106 "src/offscreen_render/rs_offscreen_render_thread.cpp", 107 108 #common 109 "src/common/rs_background_thread.cpp", 110 "src/common/rs_color.cpp", 111 "src/common/rs_common_def.cpp", 112 "src/common/rs_obj_abs_geometry.cpp", 113 "src/common/rs_occlusion_region.cpp", 114 "src/common/rs_occlusion_region_helper.cpp", 115 "src/common/rs_thread_handler_generic.cpp", 116 "src/common/rs_thread_looper_generic.cpp", 117 "src/common/rs_thread_looper_impl.cpp", 118 119 #delegate 120 "src/delegate/rs_functional_delegate.cpp", 121 122 #ipc_callbacks 123 "src/ipc_callbacks/buffer_available_callback_ipc_interface_code_access_verifier.cpp", 124 "src/ipc_callbacks/buffer_available_callback_proxy.cpp", 125 "src/ipc_callbacks/buffer_available_callback_stub.cpp", 126 "src/ipc_callbacks/buffer_clear_callback_ipc_interface_code_access_verifier.cpp", 127 "src/ipc_callbacks/buffer_clear_callback_proxy.cpp", 128 "src/ipc_callbacks/buffer_clear_callback_stub.cpp", 129 "src/ipc_callbacks/iapplication_agent_ipc_interface_code_access_verifier.cpp", 130 "src/ipc_callbacks/rs_application_agent_proxy.cpp", 131 "src/ipc_callbacks/rs_application_agent_stub.cpp", 132 "src/ipc_callbacks/rs_iocclusion_change_callback_ipc_interface_code_access_verifier.cpp", 133 "src/ipc_callbacks/rs_isync_transaction_controller_ipc_interface_code_access_verifier.cpp", 134 "src/ipc_callbacks/rs_occlusion_change_callback_proxy.cpp", 135 "src/ipc_callbacks/rs_occlusion_change_callback_stub.cpp", 136 "src/ipc_callbacks/rs_rt_refresh_callback.cpp", 137 "src/ipc_callbacks/rs_sync_transaction_controller_proxy.cpp", 138 "src/ipc_callbacks/rs_sync_transaction_controller_stub.cpp", 139 "src/ipc_callbacks/screen_change_callback_ipc_interface_code_access_verifier.cpp", 140 "src/ipc_callbacks/screen_change_callback_proxy.cpp", 141 "src/ipc_callbacks/screen_change_callback_stub.cpp", 142 "src/ipc_callbacks/surface_capture_callback_ipc_interface_code_access_verifier.cpp", 143 "src/ipc_callbacks/surface_capture_callback_proxy.cpp", 144 "src/ipc_callbacks/surface_capture_callback_stub.cpp", 145 146 #ipc_security 147 "src/ipc_security/rs_ipc_interface_code_access_verifier_base.cpp", 148 149 #memory 150 "src/memory/rs_memory_graphic.cpp", 151 "src/memory/rs_memory_track.cpp", 152 "src/memory/rs_tag_tracker.cpp", 153 154 #pipeline 155 "src/pipeline/rs_canvas_drawing_render_node.cpp", 156 "src/pipeline/rs_canvas_render_node.cpp", 157 "src/pipeline/rs_context.cpp", 158 "src/pipeline/rs_dirty_region_manager.cpp", 159 "src/pipeline/rs_display_render_node.cpp", 160 "src/pipeline/rs_draw_cmd.cpp", 161 "src/pipeline/rs_draw_cmd_list.cpp", 162 "src/pipeline/rs_effect_render_node.cpp", 163 "src/pipeline/rs_occlusion_config.cpp", 164 "src/pipeline/rs_paint_filter_canvas.cpp", 165 "src/pipeline/rs_proxy_render_node.cpp", 166 "src/pipeline/rs_recording_canvas.cpp", 167 "src/pipeline/rs_render_node.cpp", 168 "src/pipeline/rs_render_node_map.cpp", 169 "src/pipeline/rs_root_render_node.cpp", 170 "src/pipeline/rs_surface_handler.cpp", 171 "src/pipeline/rs_surface_render_node.cpp", 172 "src/pipeline/rs_uni_render_judgement.cpp", 173 174 #property 175 "src/property/rs_filter_cache_manager.cpp", 176 "src/property/rs_properties.cpp", 177 "src/property/rs_properties_painter.cpp", 178 "src/property/rs_property_trace.cpp", 179 180 #render 181 "src/render/rs_blur_filter.cpp", 182 "src/render/rs_border.cpp", 183 "src/render/rs_filter.cpp", 184 "src/render/rs_image.cpp", 185 "src/render/rs_image_base.cpp", 186 "src/render/rs_image_cache.cpp", 187 "src/render/rs_kawase_blur.cpp", 188 "src/render/rs_light_up_effect_filter.cpp", 189 "src/render/rs_mask.cpp", 190 "src/render/rs_material_filter.cpp", 191 "src/render/rs_path.cpp", 192 "src/render/rs_pixel_map_util.cpp", 193 "src/render/rs_shader.cpp", 194 "src/render/rs_shadow.cpp", 195 "src/render/rs_skia_filter.cpp", 196 197 #transaction 198 "src/transaction/rs_occlusion_data.cpp", 199 "src/transaction/rs_transaction_data.cpp", 200 "src/transaction/rs_transaction_proxy.cpp", 201 202 #screen_manager 203 "src/screen_manager/rs_screen_capability.cpp", 204 "src/screen_manager/rs_screen_data.cpp", 205 "src/screen_manager/rs_screen_hdr_capability.cpp", 206 "src/screen_manager/rs_screen_mode_info.cpp", 207 "src/screen_manager/rs_screen_props.cpp", 208 "src/screen_manager/rs_virtual_screen_resolution.cpp", 209 ] 210 211 cflags = [ 212 "-Wall", 213 "-Wno-pointer-arith", 214 "-Wno-non-virtual-dtor", 215 "-Wno-missing-field-initializers", 216 "-Wno-c++11-narrowing", 217 "-fvisibility=hidden", 218 ] 219 220 cflags_cc = [ 221 "-std=c++17", 222 "-fvisibility-inlines-hidden", 223 ] 224 225 public_configs = [ ":export_config" ] 226 public_deps = [ "src/platform:platform" ] 227 228 if (defined(use_new_render_context) && use_new_render_context) { 229 public_deps += [ "src/render_backend:librender_backend" ] 230 } 231 232 if (enable_export_macro) { 233 defines += [ "ENABLE_EXPORT_MACRO" ] 234 } 235 236 if (rs_enable_gpu) { 237 sources += [ "src/common/rs_shared_context.cpp" ] 238 defines += [ 239 "GL_GLEXT_PROTOTYPES", 240 "EGL_EGLEXT_PROTOTYPES", 241 ] 242 } 243 244 if (current_os == "mingw" || current_os == "mac" || current_os == "linux" || 245 current_os == "ios") { 246 sources -= [ "src/common/rs_shared_context.cpp" ] 247 } 248 249 if (current_os == "ohos") { 250 sources += [ 251 "src/benchmarks/file_utils.cpp", 252 "src/benchmarks/rs_recording_thread.cpp", 253 ] 254 } 255 256 include_dirs = [ 257 "$graphic_2d_root/frameworks/surface/include", 258 "$graphic_2d_root/rosen/modules/render_service_base/src", 259 "$graphic_2d_root/rosen/modules/render_service_base/include", 260 "$graphic_2d_root/utils/log", 261 ] 262 if (defined(use_new_skia) && use_new_skia) { 263 include_dirs += [ "//third_party/skia/src" ] 264 } else { 265 include_dirs += [ "//third_party/flutter/skia/src" ] 266 sources -= [ "src/render/rs_kawase_blur.cpp" ] 267 } 268 deps = [ 269 "$graphic_2d_root/utils/sandbox:sandbox_utils", 270 "$rosen_root/modules/platform:hilog", 271 "$rosen_root/modules/platform:ipc_core", 272 ] 273 external_deps = [] 274 275 if (!is_mingw && !is_mac && !is_cross_platform) { 276 defines += [ "ENABLE_RUST" ] 277 sources += get_target_outputs(":particle_cxx_gen") 278 include_dirs += [ 279 "//third_party/rust/crates/cxx/include", 280 "${target_gen_dir}/rust/src", 281 ] 282 deps += [ 283 ":particle_cxx_cppdeps", 284 ":particle_cxx_gen", 285 ":particle_cxx_rust", 286 ] 287 } 288 289 if (enable_ipc_security) { 290 defines += [ "ENABLE_IPC_SECURITY" ] 291 include_dirs += [ 292 "$access_token_root/interfaces/innerkits/accesstoken/include", 293 "$ipc_root/interfaces/innerkits/ipc_core/include", 294 ] 295 external_deps += [ 296 "access_token:libaccesstoken_sdk", 297 "access_token:libtokenid_sdk", 298 "ipc:ipc_core", 299 ] 300 } 301 302 if (defined(use_rosen_drawing) && use_rosen_drawing) { 303 defines += [ "USE_ROSEN_DRAWING" ] 304 if (ace_enable_gpu) { 305 defines += [ "ACE_ENABLE_GPU" ] 306 } 307 308 deps += [ "$rosen_root/modules/2d_graphics:2d_graphics" ] 309 } 310 311 if (rosen_cross_platform) { 312 public_configs += [ 313 "$rosen_root/modules/platform:eventhandler_config", 314 "$rosen_root/modules/platform:image_native_config", 315 ] 316 } else { 317 external_deps += [ "hitrace:hitrace_meter" ] 318 } 319 320 if (rosen_is_win) { 321 defines += [ "_USE_MATH_DEFINES" ] 322 } 323 324 if (defined(ddgr_ext_configs)) { 325 libs = ddgr_ext_configs.ddgr_libs 326 defines += ddgr_ext_configs.ddgr_defines 327 sources += ddgr_ext_configs.libddgr_ext_adaptor_base_sources 328 include_dirs += ddgr_ext_configs.libddgr_ext_adaptor_include_dirs 329 } 330 331 if (defined(graphic_2d_ext_configs.vendor_root)) { 332 sources -= graphic_2d_ext_configs.librender_service_base_ext_sources_del 333 sources += graphic_2d_ext_configs.librender_service_base_ext_sources 334 } 335 336 part_name = "graphic_2d" 337 subsystem_name = "graphic" 338} 339 340config("render_service_base_all_deps_config") { 341 include_dirs = [ "include" ] 342} 343 344ohos_shared_library("librender_service_base") { 345 all_dependent_configs = [ ":render_service_base_all_deps_config" ] 346 347 deps = [ "$rosen_root/modules/platform:eventhandler" ] 348 public_deps = [ 349 ":render_service_base_src", 350 "src/platform:platform", 351 ] 352 353 if (defined(use_new_render_context) && use_new_render_context) { 354 public_deps += [ "src/render_backend:librender_backend" ] 355 } 356 357 innerapi_tags = [ "platformsdk_indirect" ] 358 part_name = "graphic_2d" 359 subsystem_name = "graphic" 360} 361 362ohos_source_set("librender_service_base_static") { 363 all_dependent_configs = [ ":render_service_base_all_deps_config" ] 364 deps = [ "$rosen_root/modules/platform:eventhandler" ] 365 public_deps = [ 366 ":render_service_base_src", 367 "src/platform:platform", 368 ] 369 370 if (defined(use_new_render_context) && use_new_render_context) { 371 public_deps += [ "src/render_backend:librender_backend" ] 372 } 373 374 part_name = "graphic_2d" 375 subsystem_name = "graphic" 376} 377