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