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