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