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