• 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("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/surface",
25    "$graphic_2d_root/interfaces/inner_api/composer",
26    "$graphic_2d_root/rosen/modules/2d_engine/rosen_text/export/rosen_text/",
27
28    "//drivers/peripheral/display/interfaces/include",
29    "//drivers/peripheral/base",
30    "$graphic_2d_root/frameworks/surface/include",
31    "$graphic_2d_root/rosen/modules/2d_graphics",
32    "$graphic_2d_root/rosen/modules/2d_graphics/include",
33    "$graphic_2d_root/rosen/modules/2d_graphics/src",
34    "$graphic_2d_root/rosen/modules/2d_graphics/src/drawing/engine_adapter",
35  ]
36  defines = rs_common_define
37  if (defined(is_arkui_x) && is_arkui_x && ace_enable_gpu) {
38    defines += [ "ACE_ENABLE_GPU" ]
39  }
40}
41
42template("render_service_client_source_set") {
43  ohos_source_set(target_name) {
44    branch_protector_ret = "pac_ret"
45    sanitize = {
46      cfi = false
47      cfi_cross_dso = false
48      debug = false
49      blocklist = "./rs_client_blocklist.txt"
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/render_frame_trace/include",
58      "$graphic_2d_root/rosen/modules/render_service_base/src",
59      "$graphic_2d_root/utils/color_manager/export",
60      "$graphic_2d_root/rosen/modules/2d_engine/rosen_text/symbol/symbol_animation",
61      "$graphic_2d_root/utils/log",
62      "$graphic_2d_root/utils/sandbox",
63    ]
64
65    sources = [
66      #animation
67      "core/animation/rs_animation.cpp",
68      "core/animation/rs_animation_callback.cpp",
69      "core/animation/rs_animation_group.cpp",
70      "core/animation/rs_animation_timing_curve.cpp",
71      "core/animation/rs_curve_animation.cpp",
72      "core/animation/rs_implicit_animation_param.cpp",
73      "core/animation/rs_implicit_animator.cpp",
74      "core/animation/rs_implicit_animator_map.cpp",
75      "core/animation/rs_interpolating_spring_animation.cpp",
76      "core/animation/rs_keyframe_animation.cpp",
77      "core/animation/rs_path_animation.cpp",
78      "core/animation/rs_property_animation.cpp",
79      "core/animation/rs_spring_animation.cpp",
80      "core/animation/rs_symbol_animation.cpp",
81      "core/animation/rs_transition.cpp",
82      "core/animation/rs_transition_effect.cpp",
83
84      #modifier
85      "core/modifier/rs_extended_modifier.cpp",
86      "core/modifier/rs_modifier.cpp",
87      "core/modifier/rs_modifier_extractor.cpp",
88      "core/modifier/rs_modifier_manager.cpp",
89      "core/modifier/rs_modifier_manager_map.cpp",
90      "core/modifier/rs_property.cpp",
91      "core/modifier/rs_property_modifier.cpp",
92      "core/modifier/rs_showing_properties_freezer.cpp",
93
94      #jank_detector
95      "core/jank_detector/rs_jank_detector.cpp",
96
97      #pipeline
98      "core/pipeline/rs_divided_ui_capture.cpp",
99      "core/pipeline/rs_node_map.cpp",
100      "core/pipeline/rs_render_thread.cpp",
101      "core/pipeline/rs_render_thread_visitor.cpp",
102
103      #transaction
104      "core/transaction/rs_application_agent_impl.cpp",
105      "core/transaction/rs_interfaces.cpp",
106      "core/transaction/rs_render_thread_client.cpp",
107      "core/transaction/rs_sync_transaction_controller.cpp",
108      "core/transaction/rs_transaction.cpp",
109
110      #ui
111      "core/ui/rs_canvas_drawing_node.cpp",
112      "core/ui/rs_canvas_node.cpp",
113      "core/ui/rs_display_node.cpp",
114      "core/ui/rs_effect_node.cpp",
115      "core/ui/rs_frame_rate_linker.cpp",
116      "core/ui/rs_frame_rate_policy.cpp",
117      "core/ui/rs_node.cpp",
118      "core/ui/rs_proxy_node.cpp",
119      "core/ui/rs_root_node.cpp",
120      "core/ui/rs_surface_extractor.cpp",
121      "core/ui/rs_surface_node.cpp",
122      "core/ui/rs_texture_export.cpp",
123      "core/ui/rs_ui_director.cpp",
124      "core/ui/rs_ui_share_context.cpp",
125    ]
126
127    if (is_cross_platform) {
128      #ui
129      sources -= [ "core/ui/rs_display_node.cpp" ]
130      defines += [ "CROSS_PLATFORM" ]
131    }
132
133    if (defined(graphic_2d_ext_configs.vendor_root)) {
134      sources += graphic_2d_ext_configs.librender_service_client_ext_sources
135      sources -= graphic_2d_ext_configs.librender_service_client_ext_sources_del
136    }
137
138    cflags = [
139      "-Wall",
140      "-Wno-pointer-arith",
141      "-Wno-non-virtual-dtor",
142      "-Wno-missing-field-initializers",
143      "-Wno-c++11-narrowing",
144      "-fvisibility=hidden",
145    ]
146
147    if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) {
148      cflags += [ "-flto=thin" ]
149      if (enhanced_opt) {
150        cflags += [ "-fwhole-program-vtables" ]
151      }
152    }
153
154    cflags_cc = [
155      "-std=c++17",
156      "-fvisibility-inlines-hidden",
157    ]
158
159    deps = [
160      "$graphic_2d_root/rosen/modules/platform:ipc_core",
161      "$graphic_2d_root/rosen/modules/render_frame_trace:render_frame_trace",
162    ]
163    public_deps = []
164    if (enable_export_macro) {
165      defines += [ "ENABLE_EXPORT_MACRO" ]
166    }
167
168    if (defined(use_rosen_drawing) && use_rosen_drawing) {
169      defines += [ "USE_ROSEN_DRAWING" ]
170      deps += [ "$graphic_2d_root/rosen/modules/2d_graphics:2d_graphics" ]
171      if (ace_enable_gpu) {
172        defines += [ "ACE_ENABLE_GPU" ]
173      }
174      if (current_os == "mingw") {
175        defines += [ "WINDOWS_PLATFORM" ]
176      }
177    }
178    if (rosen_is_ohos) {
179      public_deps += [
180        "$graphic_2d_root:libsurface",
181        "$graphic_2d_root/rosen/modules/frame_analyzer:libframe_analyzer",
182        "$graphic_2d_root/utils/color_manager:color_manager",
183      ]
184      external_deps = [
185        "c_utils:utils",
186        "hisysevent:libhisysevent",
187        "hitrace:hitrace_meter",
188        "image_framework:image_native",
189      ]
190
191      if (accessibility_enable) {
192        external_deps += [ "accessibility:accessibilityconfig" ]
193        defines += accessibility_defines
194      }
195    } else if (rosen_preview) {
196      deps += [
197        "$graphic_2d_root:libgl",
198        "$graphic_2d_root/rosen/modules/glfw_render_context:libglfw_render_context",
199      ]
200
201      if (rss_enabled) {
202        external_deps = []
203      }
204    }
205    if (defined(external_deps)) {
206      external_deps += [ "hilog:libhilog" ]
207    } else {
208      external_deps = [ "hilog:libhilog" ]
209    }
210    if (rosen_cross_platform) {
211      deps += [ "$rosen_root/modules/platform:hilog" ]
212    }
213
214    if (rss_enabled) {
215      defines += [ "OHOS_RSS_CLIENT" ]
216      external_deps += [ "resource_schedule_service:ressched_client" ]
217    }
218
219    if (is_static_lib) {
220      public_deps += [ "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base_static" ]
221    } else {
222      public_deps += [ "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base" ]
223      deps += [ "$rosen_root/modules/platform:eventhandler" ]
224    }
225
226    if (tp_feature_enable) {
227      defines += tp_defines
228    }
229
230    if (defined(use_new_render_context) && use_new_render_context) {
231      public_deps += [ "$graphic_2d_root/rosen/modules/render_service_base/src/render_backend:librender_backend" ]
232    }
233
234    public_configs = [ ":render_service_client_config" ]
235
236    part_name = "graphic_2d"
237    subsystem_name = "graphic"
238  }
239}
240
241render_service_client_source_set("render_service_client_src") {
242  is_static_lib = false
243}
244
245render_service_client_source_set("render_service_client_src_static") {
246  is_static_lib = true
247}
248
249config("render_service_client_link_config") {
250  if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) {
251    ldflags = [
252      "-Wl,--lto-O2",
253      "-Wl,-mllvm",
254      "-Wl,-wholeprogramdevirt-check=fallback",
255      "-Wl,-Bsymbolic",
256    ]
257  }
258}
259
260ohos_shared_library("librender_service_client") {
261  branch_protector_ret = "pac_ret"
262  sanitize = {
263    cfi = false
264    cfi_cross_dso = false
265    debug = false
266    blocklist = "./rs_client_blocklist.txt"
267  }
268  public_deps = [ ":render_service_client_src" ]
269  external_deps = [ "hilog:libhilog" ]
270  innerapi_tags = [ "platformsdk" ]
271
272  if (enhanced_opt) {
273    configs = [ ":render_service_client_link_config" ]
274  }
275
276  part_name = "graphic_2d"
277  subsystem_name = "graphic"
278}
279
280ohos_source_set("librender_service_client_static") {
281  branch_protector_ret = "pac_ret"
282  sanitize = {
283    cfi = false
284    cfi_cross_dso = false
285    debug = false
286    blocklist = "./rs_client_blocklist.txt"
287  }
288  public_deps = [ ":render_service_client_src_static" ]
289  deps = [ "$rosen_root/modules/platform:eventhandler" ]
290  part_name = "graphic_2d"
291  subsystem_name = "graphic"
292}
293
294group("test") {
295  if (rosen_is_ohos) {
296    testonly = true
297
298    deps = [ "test:test" ]
299  }
300}
301