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 "com_utils.h", 18 "frame_capture_test_utils.h", 19 "geometry_utils.cpp", 20 "geometry_utils.h", 21 "keyboard.h", 22 "mouse.h", 23 "random_utils.cpp", 24 "random_utils.h", 25 "shader_utils.cpp", 26 "shader_utils.h", 27 "util_export.h", 28 "util_gl.h", 29] 30 31if (is_win) { 32 _util_sources += [ "windows/WGLWindow.h" ] 33 if (!angle_is_winuwp) { 34 _util_sources += [ 35 "windows/win32/Win32Pixmap.cpp", 36 "windows/win32/Win32Pixmap.h", 37 "windows/win32/Win32Window.cpp", 38 "windows/win32/Win32Window.h", 39 ] 40 } 41} 42 43if (is_linux) { 44 _util_sources += [ 45 "display/DisplayPixmap.cpp", 46 "display/DisplayWindow.cpp", 47 "display/DisplayWindow.h", 48 ] 49} 50 51if (angle_use_x11) { 52 _util_sources += [ 53 "x11/X11Pixmap.cpp", 54 "x11/X11Pixmap.h", 55 "x11/X11Window.cpp", 56 "x11/X11Window.h", 57 ] 58} 59 60if (is_fuchsia) { 61 _util_sources += [ 62 "fuchsia/FuchsiaPixmap.cpp", 63 "fuchsia/FuchsiaPixmap.h", 64 "fuchsia/ScenicWindow.cpp", 65 "fuchsia/ScenicWindow.h", 66 ] 67} else if (use_ozone && !angle_use_x11 && !angle_use_vulkan_display) { 68 # Use X11 impl by default otherwise switch to fake Ozone impl that does not 69 # seem to do anything real. 70 # TODO(msisov): probably, we need to have a proper support for different 71 # Ozone backends, and be able to switch between them for proper tests. 72 # For example, Wayland, X11, etc. 73 _util_sources += [ 74 "ozone/OzonePixmap.cpp", 75 "ozone/OzoneWindow.cpp", 76 "ozone/OzoneWindow.h", 77 ] 78} 79 80if (is_mac) { 81 _util_sources += [ 82 "osx/OSXPixmap.h", 83 "osx/OSXPixmap.mm", 84 "osx/OSXWindow.h", 85 "osx/OSXWindow.mm", 86 ] 87} 88 89if (is_ios) { 90 _util_sources += [ 91 "ios/IOSPixmap.h", 92 "ios/IOSPixmap.mm", 93 "ios/IOSWindow.h", 94 "ios/IOSWindow.mm", 95 ] 96} 97 98if (is_android) { 99 _util_sources += [ 100 "android/AndroidPixmap.cpp", 101 "android/AndroidWindow.cpp", 102 "android/AndroidWindow.h", 103 "android/third_party/android_native_app_glue.c", 104 "android/third_party/android_native_app_glue.h", 105 ] 106} 107 108config("angle_util_loader_config") { 109 defines = [ "ANGLE_USE_UTIL_LOADER" ] 110} 111 112config("angle_util_loader_headers_config") { 113 # Force users to include "util/header.h" instead of just "header.h". 114 include_dirs = [ ".." ] 115} 116 117angle_source_set("angle_util_loader_headers") { 118 testonly = true 119 sources = [ 120 "egl_loader_autogen.h", 121 "gles_loader_autogen.h", 122 "util_export.h", 123 ] 124 125 if (is_win && !angle_is_winuwp) { 126 sources += [ "windows/wgl_loader_autogen.h" ] 127 } 128 129 public_deps = [ "$angle_root:includes" ] 130 131 public_configs = [ ":angle_util_loader_headers_config" ] 132} 133 134angle_source_set("angle_util_loader") { 135 testonly = true 136 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] 137 138 sources = [ 139 "egl_loader_autogen.cpp", 140 "gles_loader_autogen.cpp", 141 ] 142 143 if (is_win && !angle_is_winuwp) { 144 sources += [ "windows/wgl_loader_autogen.cpp" ] 145 } 146 147 deps = [ ":angle_util_loader_headers" ] 148 149 public_configs += [ 150 "$angle_root:no_gl_prototypes", 151 ":angle_util_config", 152 ":angle_util_loader_config", 153 ":angle_util_loader_headers_config", 154 ] 155} 156 157config("angle_util_config") { 158 # Force users to include "util/header.h" instead of just "header.h". 159 include_dirs = [ ".." ] 160 if ((is_linux || is_chromeos) && angle_use_x11) { 161 libs = [ "X11" ] 162 } 163} 164 165foreach(is_shared_library, 166 [ 167 true, 168 false, 169 ]) { 170 if (is_shared_library) { 171 library_type = "angle_shared_library" 172 library_name = "angle_util" 173 dep_suffix = "${angle_libs_suffix}" 174 } else { 175 library_type = "angle_static_library" 176 library_name = "angle_util_static" 177 dep_suffix = "_static" 178 } 179 180 target(library_type, library_name) { 181 testonly = true 182 sources = _util_sources 183 public_deps = [ 184 ":angle_test_utils", 185 ":angle_util_loader_headers", 186 ] 187 libs = [] 188 189 if (is_linux || is_chromeos) { 190 libs += [ 191 "rt", 192 "dl", 193 ] 194 } 195 196 if (is_apple) { 197 frameworks = [ "QuartzCore.framework" ] 198 if (is_mac) { 199 frameworks += [ "AppKit.framework" ] 200 } 201 if (is_ios) { 202 frameworks += [ "UIKit.framework" ] 203 } 204 } 205 206 if (is_android) { 207 libs += [ 208 "android", 209 "log", 210 ] 211 } 212 213 configs += [ "$angle_root:debug_annotations_config" ] 214 215 public_configs += [ ":angle_util_config" ] 216 217 if (is_fuchsia) { 218 public_deps += [ 219 "$angle_root/src/common/fuchsia_egl", 220 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.images", 221 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.policy", 222 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.scenic", 223 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.views", 224 "//third_party/fuchsia-sdk/sdk/pkg/async-loop-cpp", 225 "//third_party/fuchsia-sdk/sdk/pkg/async-loop-default", 226 "//third_party/fuchsia-sdk/sdk/pkg/fdio", 227 "//third_party/fuchsia-sdk/sdk/pkg/scenic_cpp", 228 ] 229 } 230 231 if (is_shared_library) { 232 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] 233 234 public_deps += [ ":angle_util_loader" ] 235 236 if ((is_mac || is_ios) && !is_component_build) { 237 ldflags = [ 238 "-install_name", 239 "@rpath/libangle_util.dylib", 240 ] 241 } 242 243 # Currently excluded from the static build because of build issues. 244 # Would be nice if could be included. 245 if (is_win && !angle_is_winuwp) { 246 sources += [ "windows/WGLWindow.cpp" ] 247 } 248 } else { 249 public_configs += [ 250 "$angle_root:angle_static", 251 "$angle_root:gl_prototypes", 252 ] 253 } 254 } 255} 256 257if (is_win && !angle_is_winuwp) { 258 angle_source_set("angle_stack_walker") { 259 sources = [ 260 "windows/third_party/StackWalker/src/StackWalker.cpp", 261 "windows/third_party/StackWalker/src/StackWalker.h", 262 ] 263 264 if (is_clang) { 265 cflags_cc = [ 266 "-Wno-c++98-compat-extra-semi", 267 "-Wno-missing-declarations", 268 "-Wno-switch", 269 ] 270 } else { 271 cflags_cc = [ "/wd4740" ] 272 } 273 } 274} 275 276config("angle_png_utils_config") { 277 include_dirs = [ ".." ] 278} 279 280angle_source_set("angle_png_utils") { 281 deps = [ "$angle_libpng_dir" ] 282 sources = [ 283 "png_utils.cpp", 284 "png_utils.h", 285 ] 286 public_configs = [ ":angle_png_utils_config" ] 287} 288 289config("angle_test_util_config") { 290 include_dirs = [ ".." ] 291} 292 293angle_source_set("angle_test_utils") { 294 public_configs = [ ":angle_test_util_config" ] 295 public_deps = [ "$angle_root:angle_common" ] 296 deps = [] 297 sources = [ 298 "Timer.cpp", 299 "Timer.h", 300 "test_utils.cpp", 301 "test_utils.h", 302 ] 303 304 if (is_win) { 305 sources += [ "windows/test_utils_win.cpp" ] 306 if (angle_is_winuwp) { 307 sources += [ "windows/test_utils_winuwp.cpp" ] 308 } else { 309 deps += [ ":angle_stack_walker" ] 310 sources += [ "windows/win32/test_utils_win32.cpp" ] 311 } 312 } else { 313 sources += [ 314 "posix/crash_handler_posix.cpp", 315 "posix/test_utils_posix.cpp", 316 ] 317 } 318} 319