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 = [ "include" ] 43 if (graphic_2d_feature_use_igraphics_extend_hooks) { 44 include_dirs += egl_igraphics_extend_hooks_include_dirs 45 } 46 if (graphic_2d_feature_use_aps_igameservice_func) { 47 include_dirs += aps_client_include_dirs 48 include_dirs += gameservice_render_slice_report_include_dirs 49 } 50} 51 52if (current_os != "ohos") { 53 group("EGL") { 54 public_external_deps = [ 55 "egl:libEGL", 56 "opengles:libGLES", 57 ] 58 } 59} else { 60 ohos_shared_library("EGL") { 61 defines = [ "EGL_ERROR_ENABLE" ] 62 sources = [ 63 "src/EGL/egl.cpp", 64 "src/EGL/egl_blob_cache.cpp", 65 "src/EGL/egl_bundle_mgr_helper.cpp", 66 "src/EGL/egl_core.cpp", 67 "src/EGL/egl_system_layers_manager.cpp", 68 "src/EGL/egl_wrapper_context.cpp", 69 "src/EGL/egl_wrapper_display.cpp", 70 "src/EGL/egl_wrapper_entry.cpp", 71 "src/EGL/egl_wrapper_layer.cpp", 72 "src/EGL/egl_wrapper_loader.cpp", 73 "src/EGL/egl_wrapper_object.cpp", 74 "src/EGL/egl_wrapper_surface.cpp", 75 "src/thread_private_data_ctl.cpp", 76 ] 77 if (graphic_2d_feature_use_igraphics_extend_hooks) { 78 sources += egl_igraphics_extend_hooks_sources 79 } 80 if (graphic_2d_feature_use_aps_igameservice_func) { 81 sources += aps_client_sources 82 sources += gameservice_render_slice_report_sources 83 } 84 configs = [ ":egl_config" ] 85 86 public_configs = [ ":egl_public_config" ] 87 88 public_external_deps = [ 89 "egl:libEGL", 90 "jsoncpp:jsoncpp", 91 "opengles:libGLES", 92 ] 93 94 external_deps = [ 95 "bundle_framework:appexecfwk_base", 96 "bundle_framework:appexecfwk_core", 97 "c_utils:utils", 98 "config_policy:configpolicy_util", 99 "graphic_surface:surface", 100 "hilog:libhilog", 101 "init:libbeget_proxy", 102 "init:libbegetutil", 103 "ipc:ipc_core", 104 "samgr:samgr_proxy", 105 ] 106 107 if (graphic_2d_feature_use_aps_igameservice_func) { 108 external_deps += aps_client_external_deps 109 external_deps += gameservice_render_slice_report_external_deps 110 } 111 112 if (defined(graphic_2d_ext_configs.vendor_root)) { 113 install_enable = false 114 } 115 if (is_emulator) { 116 defines += [ "IS_EMULATOR" ] 117 } 118 output_name = "EGL" 119 output_extension = "so" 120 121 part_name = "graphic_2d" 122 subsystem_name = "graphic" 123 } 124} 125 126## Build libEGL.so }}} 127 128## Build libGLESv1.so {{{ 129config("glesv1_config") { 130 visibility = [ ":*" ] 131 132 cflags = [ 133 "-Wall", 134 "-Werror", 135 "-g3", 136 ] 137} 138 139config("glesv1_public_config") { 140 include_dirs = [ "include" ] 141} 142 143ohos_shared_library("GLESv1") { 144 sources = [ 145 "src/GLES1/gles1.cpp", 146 "src/thread_private_data_ctl.cpp", 147 ] 148 configs = [ ":glesv1_config" ] 149 150 public_configs = [ ":glesv1_public_config" ] 151 152 public_external_deps = [ 153 "egl:libEGL", 154 "opengles:libGLES", 155 ] 156 157 external_deps = [ "hilog:libhilog" ] 158 159 output_name = "GLESv1" 160 output_extension = "so" 161 162 part_name = "graphic_2d" 163 subsystem_name = "graphic" 164} 165 166## Build libGLESv1.so }}} 167 168## Build libGLESv2.so {{{ 169config("glesv2_config") { 170 visibility = [ ":*" ] 171 172 cflags = [ 173 "-Wall", 174 "-Werror", 175 "-g3", 176 ] 177} 178 179config("glesv2_public_config") { 180 include_dirs = [ "include" ] 181} 182 183ohos_shared_library("GLESv2") { 184 sources = [ 185 "src/GLES2/gles2.cpp", 186 "src/thread_private_data_ctl.cpp", 187 ] 188 configs = [ ":glesv2_config" ] 189 190 public_configs = [ ":glesv2_public_config" ] 191 192 public_external_deps = [ 193 "egl:libEGL", 194 "opengles:libGLES", 195 ] 196 197 external_deps = [ "hilog:libhilog" ] 198 199 output_name = "GLESv2" 200 output_extension = "so" 201 innerapi_tags = [ "ndk" ] 202 part_name = "graphic_2d" 203 subsystem_name = "graphic" 204} 205 206## Build libGLESv2.so }}} 207 208## Build libGLESv3.so {{{ 209config("glesv3_config") { 210 visibility = [ ":*" ] 211 212 cflags = [ 213 "-Wall", 214 "-Werror", 215 "-g3", 216 ] 217} 218 219config("glesv3_public_config") { 220 include_dirs = [ "include" ] 221} 222 223if (current_os != "ohos") { 224 group("GLESv3") { 225 public_external_deps = [ 226 "egl:libEGL", 227 "opengles:libGLES", 228 ] 229 } 230} else { 231 ohos_shared_library("GLESv3") { 232 sources = [ "src/GLES3/gles3.cpp" ] 233 configs = [ ":glesv3_config" ] 234 235 public_configs = [ ":glesv3_public_config" ] 236 237 public_external_deps = [ 238 "egl:libEGL", 239 "opengles:libGLES", 240 ] 241 242 external_deps = [ "hilog:libhilog" ] 243 244 if (defined(graphic_2d_ext_configs.vendor_root)) { 245 install_enable = false 246 } 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