• 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.
13import("//build/ohos.gni")
14import("//foundation/graphic/graphic_2d/graphic_config.gni")
15
16## Build libEGL.so {{{
17config("egl_config") {
18  visibility = [ ":*" ]
19
20  defines = []
21
22  # defines += [ "EGL_WRAPPER_DEBUG_ENABLE" ]
23  if (graphic_2d_feature_use_igraphics_extend_hooks) {
24    defines += [ "USE_IGRAPHICS_EXTENDS_HOOKS=1" ]
25  } else {
26    defines += [ "USE_IGRAPHICS_EXTENDS_HOOKS=0" ]
27  }
28  if (graphic_2d_feature_use_aps_igameservice_func) {
29    defines += [ "USE_APS_IGAMESERVICE_FUNC=1" ]
30  } else {
31    defines += [ "USE_APS_IGAMESERVICE_FUNC=0" ]
32  }
33  if (graphic_2d_feature_enable_opengl_to_vulkan) {
34    defines += [ "OPENGL_WRAPPER_ENABLE_GL4" ]
35  }
36  if (use_video_processing_engine) {
37    defines += [ "USE_VIDEO_PROCESSING_ENGINE" ]
38  }
39  cflags = [
40    "-Wall",
41    "-Werror",
42    "-g3",
43  ]
44}
45
46config("egl_public_config") {
47  include_dirs = [
48    "include",
49    "src/EGL/include/private/EGL",
50  ]
51  if (graphic_2d_feature_use_igraphics_extend_hooks) {
52    include_dirs += egl_igraphics_extend_hooks_include_dirs
53  }
54  if (graphic_2d_feature_use_aps_igameservice_func) {
55    include_dirs += aps_client_include_dirs
56    include_dirs += gameservice_render_slice_report_include_dirs
57  }
58}
59
60if (current_os != "ohos") {
61  group("EGL") {
62    public_external_deps = [
63      "egl:libEGL",
64      "opengles:libGLES",
65    ]
66  }
67} else {
68  ohos_shared_library("EGL") {
69    branch_protector_ret = "pac_ret"
70    defines = [ "EGL_ERROR_ENABLE" ]
71    sources = [
72      "src/EGL/egl.cpp",
73      "src/EGL/egl_blob_cache.cpp",
74      "src/EGL/egl_bundle_mgr_helper.cpp",
75      "src/EGL/egl_core.cpp",
76      "src/EGL/egl_system_layers_manager.cpp",
77      "src/EGL/egl_wrapper_context.cpp",
78      "src/EGL/egl_wrapper_display.cpp",
79      "src/EGL/egl_wrapper_entry.cpp",
80      "src/EGL/egl_wrapper_layer.cpp",
81      "src/EGL/egl_wrapper_loader.cpp",
82      "src/EGL/egl_wrapper_object.cpp",
83      "src/EGL/egl_wrapper_surface.cpp",
84      "src/thread_private_data_ctl.cpp",
85    ]
86    if (graphic_2d_feature_use_igraphics_extend_hooks) {
87      sources += egl_igraphics_extend_hooks_sources
88    }
89    if (graphic_2d_feature_use_aps_igameservice_func) {
90      sources += aps_client_sources
91      sources += gameservice_render_slice_report_sources
92    }
93    if (graphic_2d_feature_product == "wearable") {
94      defines += [ "PRELOAD_BLOB_CACHE" ]
95    }
96    configs = [ ":egl_config" ]
97
98    public_configs = [ ":egl_public_config" ]
99
100    public_external_deps = [
101      "egl:libEGL",
102      "jsoncpp:jsoncpp",
103      "opengles:libGLES",
104    ]
105    external_deps = [
106      "bundle_framework:appexecfwk_base",
107      "bundle_framework:appexecfwk_core",
108      "c_utils:utils",
109      "config_policy:configpolicy_util",
110      "graphic_surface:surface",
111      "hilog:libhilog",
112      "init:libbeget_proxy",
113      "init:libbegetutil",
114      "ipc:ipc_core",
115      "samgr:samgr_proxy",
116    ]
117
118    if (graphic_2d_feature_use_aps_igameservice_func) {
119      external_deps += aps_client_external_deps
120      external_deps += gameservice_render_slice_report_external_deps
121    }
122
123    if (is_emulator) {
124      defines += [ "IS_EMULATOR" ]
125    }
126    output_name = "EGL"
127    output_extension = "so"
128
129    part_name = "graphic_2d"
130    subsystem_name = "graphic"
131  }
132}
133
134## Build libEGL.so }}}
135
136## Build libGLESv1.so {{{
137config("glesv1_config") {
138  visibility = [ ":*" ]
139
140  cflags = [
141    "-Wall",
142    "-Werror",
143    "-g3",
144  ]
145}
146
147config("glesv1_public_config") {
148  include_dirs = [ "include" ]
149}
150
151ohos_shared_library("GLESv1") {
152  sources = [
153    "src/GLES1/gles1.cpp",
154    "src/thread_private_data_ctl.cpp",
155  ]
156  configs = [ ":glesv1_config" ]
157
158  public_configs = [ ":glesv1_public_config" ]
159
160  public_external_deps = [
161    "egl:libEGL",
162    "opengles:libGLES",
163  ]
164
165  external_deps = [ "hilog:libhilog" ]
166
167  output_name = "GLESv1"
168  output_extension = "so"
169
170  part_name = "graphic_2d"
171  subsystem_name = "graphic"
172}
173
174## Build libGLESv1.so }}}
175
176## Build libGLESv2.so {{{
177config("glesv2_config") {
178  visibility = [ ":*" ]
179
180  cflags = [
181    "-Wall",
182    "-Werror",
183    "-g3",
184  ]
185}
186
187config("glesv2_public_config") {
188  include_dirs = [ "include" ]
189}
190
191ohos_shared_library("GLESv2") {
192  sources = [
193    "src/GLES2/gles2.cpp",
194    "src/thread_private_data_ctl.cpp",
195  ]
196  configs = [ ":glesv2_config" ]
197
198  public_configs = [ ":glesv2_public_config" ]
199
200  public_external_deps = [
201    "egl:libEGL",
202    "opengles:libGLES",
203  ]
204
205  external_deps = [ "hilog:libhilog" ]
206
207  output_name = "GLESv2"
208  output_extension = "so"
209  innerapi_tags = [ "ndk" ]
210  part_name = "graphic_2d"
211  subsystem_name = "graphic"
212}
213
214## Build libGLESv2.so }}}
215
216## Build libGLESv3.so {{{
217config("glesv3_config") {
218  visibility = [ ":*" ]
219
220  cflags = [
221    "-Wall",
222    "-Werror",
223    "-g3",
224  ]
225}
226
227config("glesv3_public_config") {
228  include_dirs = [ "include" ]
229}
230
231if (current_os != "ohos") {
232  group("GLESv3") {
233    public_external_deps = [
234      "egl:libEGL",
235      "opengles:libGLES",
236    ]
237  }
238} else {
239  ohos_shared_library("GLESv3") {
240    branch_protector_ret = "pac_ret"
241    sources = [ "src/GLES3/gles3.cpp" ]
242    configs = [ ":glesv3_config" ]
243
244    public_configs = [ ":glesv3_public_config" ]
245
246    public_external_deps = [
247      "egl:libEGL",
248      "opengles:libGLES",
249    ]
250
251    external_deps = [ "hilog:libhilog" ]
252
253    output_name = "GLESv3"
254    output_extension = "so"
255
256    part_name = "graphic_2d"
257    subsystem_name = "graphic"
258  }
259}
260
261## Build libGLESv3.so }}}
262
263## Build libGLv4.so {{{
264config("glv4_config") {
265  visibility = [ ":*" ]
266
267  cflags = [
268    "-Wall",
269    "-Werror",
270    "-g3",
271  ]
272
273  defines = []
274
275  if (graphic_2d_feature_enable_opengl_to_vulkan) {
276    defines += [ "OPENGL_WRAPPER_ENABLE_GL4" ]
277  }
278}
279
280config("glv4_public_config") {
281  include_dirs = [ "include" ]
282}
283
284if (current_os != "ohos" || !graphic_2d_feature_enable_opengl_to_vulkan) {
285  group("GLv4") {
286    public_external_deps = [
287      "egl:libEGL",
288      "opengles:libGLES",
289    ]
290  }
291} else {
292  ohos_shared_library("GLv4") {
293    branch_protector_ret = "pac_ret"
294    sources = [ "src/GL4/gl4.cpp" ]
295    configs = [ ":glv4_config" ]
296
297    public_configs = [ ":glv4_public_config" ]
298
299    public_external_deps = [
300      "egl:libEGL",
301      "opengles:libGLES",
302    ]
303
304    external_deps = [
305      "hilog:libhilog",
306      "mesa3d:zink_opengl",
307    ]
308
309    output_name = "GLv4"
310    output_extension = "so"
311
312    innerapi_tags = [ "ndk" ]
313
314    part_name = "graphic_2d"
315    subsystem_name = "graphic"
316  }
317}
318
319## Build libGLv4.so }}}
320
321## Build opengl_wrapper_native_test {{{
322ohos_executable("opengl_wrapper_native_test") {
323  install_enable = true
324
325  sources = [ "test/opengl_wrapper_native_test.cpp" ]
326
327  include_dirs = [
328    "$graphic_2d_root/interfaces/inner_api/common",
329    "$graphic_2d_root/rosen/modules/render_service_client",
330  ]
331
332  deps = [
333    ":EGL",
334    ":GLESv3",
335    "$graphic_2d_root/rosen/modules/render_service_client:librender_service_client",
336  ]
337
338  external_deps = [
339    "c_utils:utils",
340    "graphic_surface:surface_headers",
341    "hilog:libhilog",
342  ]
343
344  part_name = "graphic_2d"
345  subsystem_name = "graphic"
346}
347
348## Build opengl_wrapper_native_test }}}
349
350## Build libdebug_layer_test.so {{{
351config("debug_layer_test_config") {
352  visibility = [ ":*" ]
353
354  defines = [ "EGL_WRAPPER_DEBUG_ENABLE" ]
355
356  cflags = [
357    "-Wall",
358    "-Werror",
359    "-g3",
360  ]
361}
362
363config("debug_layer_test_public_config") {
364  include_dirs = [ "include" ]
365}
366
367ohos_shared_library("debug_layer_test1") {
368  sources = [ "test/debug_layer_test1.cpp" ]
369  configs = [ ":debug_layer_test_config" ]
370
371  public_configs = [ ":debug_layer_test_public_config" ]
372
373  public_external_deps = [ "egl:libEGL" ]
374
375  external_deps = [ "hilog:libhilog" ]
376
377  symlink_target_name = [ "libdebug_layer_test1.so" ]
378
379  part_name = "graphic_2d"
380  subsystem_name = "graphic"
381}
382
383ohos_shared_library("debug_layer_test2") {
384  sources = [ "test/debug_layer_test2.cpp" ]
385  configs = [ ":debug_layer_test_config" ]
386
387  public_configs = [ ":debug_layer_test_public_config" ]
388
389  public_external_deps = [ "egl:libEGL" ]
390
391  external_deps = [ "hilog:libhilog" ]
392
393  symlink_target_name = [ "libdebug_layer_test2.so" ]
394
395  part_name = "graphic_2d"
396  subsystem_name = "graphic"
397}
398## Build libdebug_layer_test.so }}}
399