1# Copyright 2019 The ANGLE Project Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("../gni/angle.gni") 6 7_util_sources = [ 8 "EGLPlatformParameters.h", 9 "EGLWindow.cpp", 10 "EGLWindow.h", 11 "Event.h", 12 "Matrix.cpp", 13 "Matrix.h", 14 "OSPixmap.h", 15 "OSWindow.cpp", 16 "OSWindow.h", 17 "autogen/angle_features_autogen.cpp", 18 "autogen/angle_features_autogen.h", 19 "com_utils.h", 20 "geometry_utils.cpp", 21 "geometry_utils.h", 22 "keyboard.h", 23 "mouse.h", 24 "random_utils.cpp", 25 "random_utils.h", 26 "shader_utils.cpp", 27 "shader_utils.h", 28 "util_export.h", 29 "util_gl.h", 30] 31 32if (is_win) { 33 _util_sources += [ "windows/WGLWindow.h" ] 34 if (!angle_is_winuwp) { 35 _util_sources += [ 36 "windows/win32/Win32Pixmap.cpp", 37 "windows/win32/Win32Pixmap.h", 38 "windows/win32/Win32Window.cpp", 39 "windows/win32/Win32Window.h", 40 ] 41 } 42} 43 44if (is_linux) { 45 _util_sources += [ 46 "display/DisplayPixmap.cpp", 47 "display/DisplayWindow.cpp", 48 "display/DisplayWindow.h", 49 ] 50} 51 52if (angle_use_x11) { 53 _util_sources += [ 54 "linux/x11/X11Pixmap.cpp", 55 "linux/x11/X11Pixmap.h", 56 "linux/x11/X11Window.cpp", 57 "linux/x11/X11Window.h", 58 ] 59} 60 61if (angle_use_wayland) { 62 _util_sources += [ 63 "linux/wayland/WaylandWindow.cpp", 64 "linux/wayland/WaylandWindow.h", 65 ] 66} 67 68if (angle_use_x11 || angle_use_wayland) { 69 _util_sources += [ "linux/LinuxWindow.cpp" ] 70} 71 72if (is_fuchsia) { 73 _util_sources += [ 74 "fuchsia/FuchsiaPixmap.cpp", 75 "fuchsia/FuchsiaPixmap.h", 76 "fuchsia/ScenicWindow.cpp", 77 "fuchsia/ScenicWindow.h", 78 ] 79} else if (use_ozone && !(angle_use_x11 || angle_use_wayland)) { 80 # Use X11 impl by default otherwise switch to fake Ozone impl that does not 81 # seem to do anything real. 82 # TODO(msisov): probably, we need to have a proper support for different 83 # Ozone backends, and be able to switch between them for proper tests. 84 # For example, Wayland, X11, etc. 85 _util_sources += [ 86 "ozone/OzonePixmap.cpp", 87 "ozone/OzoneWindow.cpp", 88 "ozone/OzoneWindow.h", 89 ] 90} 91 92if (is_mac) { 93 _util_sources += [ 94 "osx/OSXPixmap.h", 95 "osx/OSXPixmap.mm", 96 "osx/OSXWindow.h", 97 "osx/OSXWindow.mm", 98 ] 99} 100 101if (is_ios) { 102 _util_sources += [ 103 "ios/IOSPixmap.h", 104 "ios/IOSPixmap.mm", 105 "ios/IOSWindow.h", 106 "ios/IOSWindow.mm", 107 ] 108} 109 110if (is_android) { 111 _util_sources += [ 112 "android/AndroidPixmap.cpp", 113 "android/AndroidWindow.cpp", 114 "android/AndroidWindow.h", 115 "android/third_party/android_native_app_glue.c", 116 "android/third_party/android_native_app_glue.h", 117 ] 118} 119 120# Backtrace utils 121if (is_linux) { 122 _util_sources += [ "linux/linux_backtrace.cpp" ] 123} 124 125if (is_fuchsia) { 126 _util_sources += [ "fuchsia/fuchsia_backtrace.cpp" ] 127} 128 129if (is_ios) { 130 _util_sources += [ "ios/ios_backtrace.cpp" ] 131} 132 133if (is_mac) { 134 _util_sources += [ "osx/osx_backtrace.cpp" ] 135} 136 137if (is_android) { 138 _util_sources += [ "android/android_backtrace.cpp" ] 139} 140 141config("angle_util_loader_config") { 142 defines = [ "ANGLE_USE_UTIL_LOADER" ] 143} 144 145config("angle_util_loader_headers_config") { 146 # Force users to include "util/header.h" instead of just "header.h". 147 include_dirs = [ ".." ] 148} 149 150angle_source_set("angle_util_loader_headers") { 151 testonly = true 152 sources = [ 153 "egl_loader_autogen.h", 154 "gles_loader_autogen.h", 155 "util_export.h", 156 ] 157 158 if (is_win && !angle_is_winuwp) { 159 sources += [ "windows/wgl_loader_autogen.h" ] 160 } 161 162 public_deps = [ "$angle_root:includes" ] 163 164 public_configs = [ ":angle_util_loader_headers_config" ] 165} 166 167angle_source_set("angle_util_loader") { 168 testonly = true 169 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] 170 171 sources = [ 172 "egl_loader_autogen.cpp", 173 "gles_loader_autogen.cpp", 174 ] 175 176 if (is_win && !angle_is_winuwp) { 177 sources += [ "windows/wgl_loader_autogen.cpp" ] 178 } 179 180 deps = [ ":angle_util_loader_headers" ] 181 182 public_configs += [ 183 "$angle_root:no_gl_prototypes", 184 ":angle_util_config", 185 ":angle_util_loader_config", 186 ":angle_util_loader_headers_config", 187 ] 188} 189 190config("angle_trace_loader_config") { 191 include_dirs = [ "$angle_root/util/capture" ] 192} 193 194angle_shared_library("angle_trace_loader") { 195 defines = [ "ANGLE_TRACE_LOADER_IMPLEMENTATION" ] 196 197 sources = [ 198 "capture/trace_egl_loader_autogen.cpp", 199 "capture/trace_egl_loader_autogen.h", 200 "capture/trace_gles_loader_autogen.cpp", 201 "capture/trace_gles_loader_autogen.h", 202 "capture/traces_export.h", 203 ] 204 deps = [ 205 "$angle_root:angle_common", 206 "$angle_root:angle_compression", 207 ] 208 209 public_configs += [ 210 "$angle_root:no_gl_prototypes", 211 ":angle_trace_loader_config", 212 ] 213} 214 215angle_source_set("angle_trace_fixture") { 216 testonly = true 217 defines = [ "ANGLE_REPLAY_IMPLEMENTATION" ] 218 suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ] 219 sources = [ 220 "capture/angle_trace_gl.h", 221 "capture/trace_fixture.cpp", 222 "capture/trace_fixture.h", 223 "capture/trace_interface.h", 224 ] 225 public_deps = [ 226 ":angle_trace_loader", 227 "$angle_root:includes", 228 ] 229 if (is_ios) { 230 # shared libraries are hidden inside ios_framework_bundle, but we include headers from them 231 check_includes = false 232 } 233} 234 235if (angle_enable_cl) { 236 angle_source_set("angle_trace_fixture_cl") { 237 testonly = true 238 defines = [ "ANGLE_REPLAY_IMPLEMENTATION" ] 239 suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ] 240 sources = [ 241 "capture/trace_fixture_cl.cpp", 242 "capture/trace_fixture_cl.h", 243 "capture/trace_interface.h", 244 ] 245 public_deps = [ 246 ":angle_trace_loader", 247 "$angle_root:includes", 248 ] 249 if (is_ios) { 250 # shared libraries are hidden inside ios_framework_bundle, but we include headers from them 251 check_includes = false 252 } 253 } 254} 255 256if (angle_has_frame_capture) { 257 config("angle_frame_capture_test_utils_config") { 258 include_dirs = [ "$angle_root/util/capture" ] 259 } 260 261 angle_source_set("angle_frame_capture_test_utils") { 262 testonly = true 263 264 if (restricted_traces_outside_of_apk) { 265 # On Android, if we are building the entire trace library, 266 # we need to load the libraries from outside the APK 267 defines = [ "ANGLE_TRACE_EXTERNAL_BINARIES" ] 268 } 269 270 sources = [ 271 "capture/frame_capture_test_utils.cpp", 272 "capture/frame_capture_test_utils.h", 273 "capture/trace_interface.h", 274 ] 275 deps = [ "$angle_root/third_party/rapidjson" ] 276 277 public_configs += [ ":angle_frame_capture_test_utils_config" ] 278 public_deps = [ 279 "$angle_root:angle_capture_common", 280 "$angle_root:angle_common", 281 "$angle_root:angle_compression", 282 ] 283 } 284 285 angle_shared_library("angle_trace_interpreter") { 286 testonly = true 287 sources = [ 288 "capture/frame_capture_replay_autogen.cpp", 289 "capture/trace_interpreter.cpp", 290 "capture/trace_interpreter.h", 291 "capture/trace_interpreter_autogen.cpp", 292 ] 293 deps = [ 294 ":angle_frame_capture_test_utils", 295 ":angle_trace_fixture", 296 ":angle_trace_loader", 297 ] 298 defines = [ "ANGLE_REPLAY_IMPLEMENTATION" ] 299 } 300} 301 302config("angle_util_config") { 303 # Force users to include "util/header.h" instead of just "header.h". 304 include_dirs = [ ".." ] 305 if ((is_linux || is_chromeos) && angle_use_x11) { 306 libs = [ "X11" ] 307 } 308 configs = [ "$angle_root:angle_vulkan_wayland_config" ] 309} 310 311foreach(is_shared_library, 312 [ 313 true, 314 false, 315 ]) { 316 if (is_shared_library) { 317 library_type = "angle_shared_library" 318 library_name = "angle_util" 319 dep_suffix = "${angle_libs_suffix}" 320 } else { 321 library_type = "angle_static_library" 322 library_name = "angle_util_static" 323 dep_suffix = "_static" 324 } 325 326 target(library_type, library_name) { 327 testonly = true 328 sources = _util_sources 329 public_deps = [ 330 ":angle_test_utils", 331 ":angle_util_loader_headers", 332 ] 333 libs = [] 334 335 if (is_linux || is_chromeos) { 336 libs += [ 337 "rt", 338 "dl", 339 ] 340 } 341 342 if (is_apple) { 343 frameworks = [ "QuartzCore.framework" ] 344 if (is_mac) { 345 frameworks += [ "AppKit.framework" ] 346 } 347 if (is_ios) { 348 frameworks += [ "UIKit.framework" ] 349 } 350 } 351 352 if (is_android) { 353 libs += [ 354 "android", 355 "log", 356 ] 357 } 358 359 configs += [ "$angle_root:debug_annotations_config" ] 360 361 public_configs += [ ":angle_util_config" ] 362 363 if (is_fuchsia) { 364 public_deps += [ 365 "$angle_root/src/common/fuchsia_egl", 366 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.element", 367 "//third_party/fuchsia-sdk/sdk/pkg/async-loop-cpp", 368 "//third_party/fuchsia-sdk/sdk/pkg/async-loop-default", 369 "//third_party/fuchsia-sdk/sdk/pkg/fdio", 370 ] 371 } 372 373 if (is_shared_library) { 374 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] 375 376 public_deps += [ ":angle_util_loader" ] 377 378 if ((is_mac || is_ios) && !is_component_build) { 379 ldflags = [ 380 "-install_name", 381 "@rpath/libangle_util.dylib", 382 ] 383 } 384 385 # Currently excluded from the static build because of build issues. 386 # Would be nice if could be included. 387 if (is_win && !angle_is_winuwp) { 388 sources += [ "windows/WGLWindow.cpp" ] 389 } 390 } else { 391 public_configs += [ 392 "$angle_root:angle_static_config", 393 "$angle_root:gl_prototypes", 394 ] 395 } 396 } 397} 398 399if (is_win && !angle_is_winuwp) { 400 angle_source_set("angle_stack_walker") { 401 sources = [ 402 "windows/third_party/StackWalker/src/StackWalker.cpp", 403 "windows/third_party/StackWalker/src/StackWalker.h", 404 ] 405 406 if (is_clang) { 407 cflags_cc = [ 408 "-Wno-c++98-compat-extra-semi", 409 "-Wno-missing-declarations", 410 "-Wno-switch", 411 ] 412 } else { 413 cflags_cc = [ "/wd4740" ] 414 } 415 } 416} 417 418config("angle_png_utils_config") { 419 include_dirs = [ ".." ] 420} 421 422angle_source_set("angle_png_utils") { 423 deps = [ "$angle_libpng_dir" ] 424 sources = [ 425 "png_utils.cpp", 426 "png_utils.h", 427 ] 428 public_configs = [ ":angle_png_utils_config" ] 429} 430 431config("angle_test_util_config") { 432 include_dirs = [ ".." ] 433} 434 435angle_source_set("angle_test_utils") { 436 public_configs = [ ":angle_test_util_config" ] 437 438 public_deps = [ "$angle_root:angle_common" ] 439 if (angle_use_wayland) { 440 public_deps += [ "$angle_root:angle_wayland" ] 441 } 442 443 deps = [] 444 sources = [ 445 "Timer.cpp", 446 "Timer.h", 447 "test_utils.cpp", 448 "test_utils.h", 449 ] 450 451 if (is_win) { 452 sources += [ "windows/test_utils_win.cpp" ] 453 if (angle_is_winuwp) { 454 sources += [ "windows/test_utils_winuwp.cpp" ] 455 } else { 456 deps += [ ":angle_stack_walker" ] 457 sources += [ "windows/win32/test_utils_win32.cpp" ] 458 } 459 } else { 460 sources += [ 461 "posix/crash_handler_posix.cpp", 462 "posix/test_utils_posix.cpp", 463 ] 464 } 465} 466