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 external_deps = [ 94 "bundle_framework:appexecfwk_base", 95 "bundle_framework:appexecfwk_core", 96 "c_utils:utils", 97 "config_policy:configpolicy_util", 98 "graphic_surface:surface", 99 "hilog:libhilog", 100 "init:libbeget_proxy", 101 "init:libbegetutil", 102 "ipc:ipc_core", 103 "samgr:samgr_proxy", 104 ] 105 106 if (graphic_2d_feature_use_aps_igameservice_func) { 107 external_deps += aps_client_external_deps 108 external_deps += gameservice_render_slice_report_external_deps 109 } 110 111 if (is_emulator) { 112 defines += [ "IS_EMULATOR" ] 113 } 114 output_name = "EGL" 115 output_extension = "so" 116 117 part_name = "graphic_2d" 118 subsystem_name = "graphic" 119 } 120} 121 122## Build libEGL.so }}} 123 124## Build libGLESv1.so {{{ 125config("glesv1_config") { 126 visibility = [ ":*" ] 127 128 cflags = [ 129 "-Wall", 130 "-Werror", 131 "-g3", 132 ] 133} 134 135config("glesv1_public_config") { 136 include_dirs = [ "include" ] 137} 138 139ohos_shared_library("GLESv1") { 140 sources = [ 141 "src/GLES1/gles1.cpp", 142 "src/thread_private_data_ctl.cpp", 143 ] 144 configs = [ ":glesv1_config" ] 145 146 public_configs = [ ":glesv1_public_config" ] 147 148 public_external_deps = [ 149 "egl:libEGL", 150 "opengles:libGLES", 151 ] 152 153 external_deps = [ "hilog:libhilog" ] 154 155 output_name = "GLESv1" 156 output_extension = "so" 157 158 part_name = "graphic_2d" 159 subsystem_name = "graphic" 160} 161 162## Build libGLESv1.so }}} 163 164## Build libGLESv2.so {{{ 165config("glesv2_config") { 166 visibility = [ ":*" ] 167 168 cflags = [ 169 "-Wall", 170 "-Werror", 171 "-g3", 172 ] 173} 174 175config("glesv2_public_config") { 176 include_dirs = [ "include" ] 177} 178 179ohos_shared_library("GLESv2") { 180 sources = [ 181 "src/GLES2/gles2.cpp", 182 "src/thread_private_data_ctl.cpp", 183 ] 184 configs = [ ":glesv2_config" ] 185 186 public_configs = [ ":glesv2_public_config" ] 187 188 public_external_deps = [ 189 "egl:libEGL", 190 "opengles:libGLES", 191 ] 192 193 external_deps = [ "hilog:libhilog" ] 194 195 output_name = "GLESv2" 196 output_extension = "so" 197 innerapi_tags = [ "ndk" ] 198 part_name = "graphic_2d" 199 subsystem_name = "graphic" 200} 201 202## Build libGLESv2.so }}} 203 204## Build libGLESv3.so {{{ 205config("glesv3_config") { 206 visibility = [ ":*" ] 207 208 cflags = [ 209 "-Wall", 210 "-Werror", 211 "-g3", 212 ] 213} 214 215config("glesv3_public_config") { 216 include_dirs = [ "include" ] 217} 218 219if (current_os != "ohos") { 220 group("GLESv3") { 221 public_external_deps = [ 222 "egl:libEGL", 223 "opengles:libGLES", 224 ] 225 } 226} else { 227 ohos_shared_library("GLESv3") { 228 sources = [ "src/GLES3/gles3.cpp" ] 229 configs = [ ":glesv3_config" ] 230 231 public_configs = [ ":glesv3_public_config" ] 232 233 public_external_deps = [ 234 "egl:libEGL", 235 "opengles:libGLES", 236 ] 237 238 external_deps = [ "hilog:libhilog" ] 239 240 output_name = "GLESv3" 241 output_extension = "so" 242 243 part_name = "graphic_2d" 244 subsystem_name = "graphic" 245 } 246} 247 248## Build libGLESv3.so }}} 249 250## Build opengl_wrapper_native_test {{{ 251ohos_executable("opengl_wrapper_native_test") { 252 install_enable = true 253 254 sources = [ "test/opengl_wrapper_native_test.cpp" ] 255 256 include_dirs = [ 257 "$graphic_2d_root/interfaces/inner_api/common", 258 "$graphic_2d_root/rosen/modules/render_service_client", 259 ] 260 261 deps = [ 262 ":EGL", 263 ":GLESv3", 264 "$graphic_2d_root/rosen/modules/render_service_client:librender_service_client", 265 ] 266 267 external_deps = [ 268 "c_utils:utils", 269 "graphic_surface:surface_headers", 270 "hilog:libhilog", 271 ] 272 273 part_name = "graphic_2d" 274 subsystem_name = "graphic" 275} 276 277## Build opengl_wrapper_native_test }}} 278 279## Build libdebug_layer_test.so {{{ 280config("debug_layer_test_config") { 281 visibility = [ ":*" ] 282 283 defines = [ "EGL_WRAPPER_DEBUG_ENABLE" ] 284 285 cflags = [ 286 "-Wall", 287 "-Werror", 288 "-g3", 289 ] 290} 291 292config("debug_layer_test_public_config") { 293 include_dirs = [ "include" ] 294} 295 296ohos_shared_library("debug_layer_test1") { 297 sources = [ "test/debug_layer_test1.cpp" ] 298 configs = [ ":debug_layer_test_config" ] 299 300 public_configs = [ ":debug_layer_test_public_config" ] 301 302 public_external_deps = [ "egl:libEGL" ] 303 304 external_deps = [ "hilog:libhilog" ] 305 306 symlink_target_name = [ "libdebug_layer_test1.so" ] 307 308 part_name = "graphic_2d" 309 subsystem_name = "graphic" 310} 311 312ohos_shared_library("debug_layer_test2") { 313 sources = [ "test/debug_layer_test2.cpp" ] 314 configs = [ ":debug_layer_test_config" ] 315 316 public_configs = [ ":debug_layer_test_public_config" ] 317 318 public_external_deps = [ "egl:libEGL" ] 319 320 external_deps = [ "hilog:libhilog" ] 321 322 symlink_target_name = [ "libdebug_layer_test2.so" ] 323 324 part_name = "graphic_2d" 325 subsystem_name = "graphic" 326} 327## Build libdebug_layer_test.so }}} 328