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