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