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_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 (angle_use_x11) { 44 _util_sources += [ 45 "x11/X11Pixmap.cpp", 46 "x11/X11Pixmap.h", 47 "x11/X11Window.cpp", 48 "x11/X11Window.h", 49 ] 50} 51 52if (is_fuchsia) { 53 _util_sources += [ 54 "fuchsia/ScenicWindow.cpp", 55 "fuchsia/ScenicWindow.h", 56 ] 57} else if (use_ozone) { 58 _util_sources += [ 59 "ozone/OzonePixmap.cpp", 60 "ozone/OzoneWindow.cpp", 61 "ozone/OzoneWindow.h", 62 ] 63} 64 65if (is_mac) { 66 _util_sources += [ 67 "osx/OSXPixmap.h", 68 "osx/OSXPixmap.mm", 69 "osx/OSXWindow.h", 70 "osx/OSXWindow.mm", 71 ] 72} 73 74if (is_android) { 75 _util_sources += [ 76 "android/AndroidPixmap.cpp", 77 "android/AndroidWindow.cpp", 78 "android/AndroidWindow.h", 79 "android/third_party/android_native_app_glue.c", 80 "android/third_party/android_native_app_glue.h", 81 ] 82} 83 84config("angle_util_loader_config") { 85 defines = [ "ANGLE_USE_UTIL_LOADER" ] 86} 87 88config("angle_util_loader_headers_config") { 89 # Force users to include "util/header.h" instead of just "header.h". 90 include_dirs = [ ".." ] 91} 92 93angle_source_set("angle_util_loader_headers") { 94 testonly = true 95 sources = [ 96 "egl_loader_autogen.h", 97 "gles_loader_autogen.h", 98 "util_export.h", 99 ] 100 101 if (is_win && !angle_is_winuwp) { 102 sources += [ "windows/wgl_loader_autogen.h" ] 103 } 104 105 public_deps = [ "$angle_root:includes" ] 106 107 public_configs = [ ":angle_util_loader_headers_config" ] 108} 109 110angle_source_set("angle_util_loader") { 111 testonly = true 112 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] 113 114 sources = [ 115 "egl_loader_autogen.cpp", 116 "gles_loader_autogen.cpp", 117 ] 118 119 if (is_win && !angle_is_winuwp) { 120 sources += [ "windows/wgl_loader_autogen.cpp" ] 121 } 122 123 deps = [ ":angle_util_loader_headers" ] 124 125 public_configs += [ 126 "$angle_root:no_gl_prototypes", 127 ":angle_util_config", 128 ":angle_util_loader_config", 129 ":angle_util_loader_headers_config", 130 ] 131} 132 133config("angle_util_config") { 134 # Force users to include "util/header.h" instead of just "header.h". 135 include_dirs = [ ".." ] 136 if (is_linux && angle_use_x11) { 137 libs = [ "X11" ] 138 } 139} 140 141foreach(is_shared_library, 142 [ 143 true, 144 false, 145 ]) { 146 if (is_shared_library) { 147 library_type = "angle_shared_library" 148 library_name = "angle_util" 149 dep_suffix = "${angle_libs_suffix}" 150 } else { 151 library_type = "angle_static_library" 152 library_name = "angle_util_static" 153 dep_suffix = "_static" 154 } 155 156 target(library_type, library_name) { 157 testonly = true 158 sources = _util_sources 159 deps = [ "$angle_root:angle_common" ] 160 public_deps = [ 161 ":angle_test_utils", 162 ":angle_util_loader_headers", 163 ] 164 libs = [] 165 166 if (is_linux) { 167 libs += [ 168 "rt", 169 "dl", 170 ] 171 } 172 173 if (is_mac) { 174 libs += [ 175 "AppKit.framework", 176 "QuartzCore.framework", 177 ] 178 } 179 180 if (is_android) { 181 # To prevent linux sources filtering on android 182 set_sources_assignment_filter([]) 183 libs += [ 184 "android", 185 "log", 186 ] 187 } 188 189 configs += [ "$angle_root:debug_annotations_config" ] 190 191 public_configs += [ ":angle_util_config" ] 192 193 if (is_fuchsia) { 194 public_deps += [ 195 "$angle_root/src/common/fuchsia_egl", 196 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.images", 197 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.policy", 198 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.scenic", 199 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.views", 200 "//third_party/fuchsia-sdk/sdk/pkg/async-loop-cpp", 201 "//third_party/fuchsia-sdk/sdk/pkg/async-loop-default", 202 "//third_party/fuchsia-sdk/sdk/pkg/fdio", 203 "//third_party/fuchsia-sdk/sdk/pkg/scenic_cpp", 204 ] 205 } 206 207 if (is_shared_library) { 208 defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] 209 210 public_deps += [ ":angle_util_loader" ] 211 212 if (is_mac && !is_component_build) { 213 ldflags = [ 214 "-install_name", 215 "@rpath/libangle_util.dylib", 216 ] 217 } 218 219 # Currently excluded from the static build because of build issues. 220 # Would be nice if could be included. 221 if (is_win && !angle_is_winuwp) { 222 sources += [ "windows/WGLWindow.cpp" ] 223 } 224 } else { 225 public_configs += [ 226 "$angle_root:angle_static", 227 "$angle_root:gl_prototypes", 228 ] 229 } 230 } 231} 232 233if (is_win && !angle_is_winuwp) { 234 angle_source_set("angle_stack_walker") { 235 sources = [ 236 "windows/third_party/StackWalker/src/StackWalker.cpp", 237 "windows/third_party/StackWalker/src/StackWalker.h", 238 ] 239 240 if (is_clang) { 241 cflags_cc = [ 242 "-Wno-c++98-compat-extra-semi", 243 "-Wno-missing-declarations", 244 "-Wno-switch", 245 ] 246 } else { 247 cflags_cc = [ "/wd4740" ] 248 } 249 } 250} 251 252config("angle_png_utils_config") { 253 include_dirs = [ ".." ] 254} 255 256angle_source_set("angle_png_utils") { 257 deps = [ "$angle_libpng_dir" ] 258 sources = [ 259 "png_utils.cpp", 260 "png_utils.h", 261 ] 262 public_configs = [ ":angle_png_utils_config" ] 263} 264 265config("angle_test_util_config") { 266 include_dirs = [ ".." ] 267} 268 269angle_source_set("angle_test_utils") { 270 public_configs = [ ":angle_test_util_config" ] 271 deps = [ "$angle_root:angle_common" ] 272 sources = [ 273 "Timer.cpp", 274 "Timer.h", 275 "test_utils.cpp", 276 "test_utils.h", 277 ] 278 279 if (is_win) { 280 sources += [ "windows/test_utils_win.cpp" ] 281 if (angle_is_winuwp) { 282 sources += [ "windows/test_utils_winuwp.cpp" ] 283 } else { 284 deps += [ ":angle_stack_walker" ] 285 sources += [ "windows/win32/test_utils_win32.cpp" ] 286 } 287 } else { 288 sources += [ 289 "posix/crash_handler_posix.cpp", 290 "posix/test_utils_posix.cpp", 291 ] 292 } 293} 294