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