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_has_frame_capture) { 236 config("angle_frame_capture_test_utils_config") { 237 include_dirs = [ "$angle_root/util/capture" ] 238 } 239 240 angle_source_set("angle_frame_capture_test_utils") { 241 testonly = true 242 243 if (restricted_traces_outside_of_apk) { 244 # On Android, if we are building the entire trace library, 245 # we need to load the libraries from outside the APK 246 defines = [ "ANGLE_TRACE_EXTERNAL_BINARIES" ] 247 } 248 249 sources = [ 250 "capture/frame_capture_test_utils.cpp", 251 "capture/frame_capture_test_utils.h", 252 "capture/trace_interface.h", 253 ] 254 deps = [ "$angle_root/third_party/rapidjson" ] 255 256 public_configs += [ ":angle_frame_capture_test_utils_config" ] 257 public_deps = [ 258 "$angle_root:angle_capture_common", 259 "$angle_root:angle_common", 260 "$angle_root:angle_compression", 261 ] 262 } 263 264 angle_shared_library("angle_trace_interpreter") { 265 testonly = true 266 sources = [ 267 "capture/frame_capture_replay_autogen.cpp", 268 "capture/trace_interpreter.cpp", 269 "capture/trace_interpreter.h", 270 "capture/trace_interpreter_autogen.cpp", 271 ] 272 deps = [ 273 ":angle_frame_capture_test_utils", 274 ":angle_trace_fixture", 275 ":angle_trace_loader", 276 ] 277 defines = [ "ANGLE_REPLAY_IMPLEMENTATION" ] 278 } 279} 280 281config("angle_util_config") { 282 # Force users to include "util/header.h" instead of just "header.h". 283 include_dirs = [ ".." ] 284 if ((is_linux || is_chromeos) && angle_use_x11) { 285 libs = [ "X11" ] 286 } 287 configs = [ "$angle_root:angle_vulkan_wayland_config" ] 288} 289 290foreach(is_shared_library, 291 [ 292 true, 293 false, 294 ]) { 295 if (is_shared_library) { 296 library_type = "angle_shared_library" 297 library_name = "angle_util" 298 dep_suffix = "${angle_libs_suffix}" 299 } else { 300 library_type = "angle_static_library" 301 library_name = "angle_util_static" 302 dep_suffix = "_static" 303 } 304 305 target(library_type, library_name) { 306 testonly = true 307 sources = _util_sources 308 public_deps = [ 309 ":angle_test_utils", 310 ":angle_util_loader_headers", 311 ] 312 libs = [] 313 314 if (is_linux || is_chromeos) { 315 libs += [ 316 "rt", 317 "dl", 318 ] 319 } 320 321 if (is_apple) { 322 frameworks = [ "QuartzCore.framework" ] 323 if (is_mac) { 324 frameworks += [ "AppKit.framework" ] 325 } 326 if (is_ios) { 327 frameworks += [ "UIKit.framework" ] 328 } 329 } 330 331 if (is_android) { 332 libs += [ 333 "android", 334 "log", 335 ] 336 } 337 338 configs += [ "$angle_root:debug_annotations_config" ] 339 340 public_configs += [ ":angle_util_config" ] 341 342 if (is_fuchsia) { 343 public_deps += [ 344 "$angle_root/src/common/fuchsia_egl", 345 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.element", 346 "//third_party/fuchsia-sdk/sdk/pkg/async-loop-cpp", 347 "//third_party/fuchsia-sdk/sdk/pkg/async-loop-default", 348 "//third_party/fuchsia-sdk/sdk/pkg/fdio", 349 ] 350 } 351 352 if (is_shared_library) { 353 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] 354 355 public_deps += [ ":angle_util_loader" ] 356 357 if ((is_mac || is_ios) && !is_component_build) { 358 ldflags = [ 359 "-install_name", 360 "@rpath/libangle_util.dylib", 361 ] 362 } 363 364 # Currently excluded from the static build because of build issues. 365 # Would be nice if could be included. 366 if (is_win && !angle_is_winuwp) { 367 sources += [ "windows/WGLWindow.cpp" ] 368 } 369 } else { 370 public_configs += [ 371 "$angle_root:angle_static_config", 372 "$angle_root:gl_prototypes", 373 ] 374 } 375 } 376} 377 378if (is_win && !angle_is_winuwp) { 379 angle_source_set("angle_stack_walker") { 380 sources = [ 381 "windows/third_party/StackWalker/src/StackWalker.cpp", 382 "windows/third_party/StackWalker/src/StackWalker.h", 383 ] 384 385 if (is_clang) { 386 cflags_cc = [ 387 "-Wno-c++98-compat-extra-semi", 388 "-Wno-missing-declarations", 389 "-Wno-switch", 390 ] 391 } else { 392 cflags_cc = [ "/wd4740" ] 393 } 394 } 395} 396 397config("angle_png_utils_config") { 398 include_dirs = [ ".." ] 399} 400 401angle_source_set("angle_png_utils") { 402 deps = [ "$angle_libpng_dir" ] 403 sources = [ 404 "png_utils.cpp", 405 "png_utils.h", 406 ] 407 public_configs = [ ":angle_png_utils_config" ] 408} 409 410config("angle_test_util_config") { 411 include_dirs = [ ".." ] 412} 413 414angle_source_set("angle_test_utils") { 415 public_configs = [ ":angle_test_util_config" ] 416 417 public_deps = [ "$angle_root:angle_common" ] 418 if (angle_use_wayland) { 419 public_deps += [ "$angle_root:angle_wayland" ] 420 } 421 422 deps = [] 423 sources = [ 424 "Timer.cpp", 425 "Timer.h", 426 "test_utils.cpp", 427 "test_utils.h", 428 ] 429 430 if (is_win) { 431 sources += [ "windows/test_utils_win.cpp" ] 432 if (angle_is_winuwp) { 433 sources += [ "windows/test_utils_winuwp.cpp" ] 434 } else { 435 deps += [ ":angle_stack_walker" ] 436 sources += [ "windows/win32/test_utils_win32.cpp" ] 437 } 438 } else { 439 sources += [ 440 "posix/crash_handler_posix.cpp", 441 "posix/test_utils_posix.cpp", 442 ] 443 } 444} 445