1# Copyright 2023 Google Inc. 2# 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import("../../gn/skia.gni") 7 8if (skia_use_dawn) { 9 import("//third_party/externals/dawn/scripts/dawn_features.gni") 10} 11 12config("public_config") { 13 defines = [] 14 include_dirs = [ "." ] 15} 16 17skia_component("window") { 18 check_includes = false 19 testonly = true # For access to gpu_tool_utils. TODO: clean up 20 public_configs = [ ":public_config" ] 21 public = [ 22 "DisplayParams.h", 23 "WindowContext.h", 24 ] 25 sources = [ 26 "DisplayParams.h", 27 "RasterWindowContext.h", 28 "WindowContext.cpp", 29 "WindowContext.h", 30 ] 31 32 libs = [] 33 frameworks = [] 34 35 if (is_android) { 36 sources += [ 37 "android/RasterWindowContext_android.cpp", 38 "android/WindowContextFactory_android.h", 39 ] 40 libs += [ "android" ] 41 } else if (is_linux) { 42 sources += [ 43 "unix/RasterWindowContext_unix.cpp", 44 "unix/WindowContextFactory_unix.h", 45 ] 46 libs += [ 47 "GL", # Used by raster window context, so cannot be behind skia_use_gl. 48 "X11", 49 ] 50 } else if (is_win) { 51 sources += [ 52 "win/RasterWindowContext_win.cpp", 53 "win/WindowContextFactory_win.h", 54 ] 55 } else if (is_mac) { 56 sources += [ "mac/WindowContextFactory_mac.h" ] 57 frameworks += [ 58 "QuartzCore.framework", 59 "Cocoa.framework", 60 "Foundation.framework", 61 ] 62 } else if (is_ios) { 63 sources += [ "ios/WindowContextFactory_ios.h" ] 64 frameworks += [ "QuartzCore.framework" ] 65 } 66 67 if (skia_use_gl) { 68 sources += [ 69 "GLWindowContext.cpp", 70 "GLWindowContext.h", 71 ] 72 if (skia_use_angle) { 73 sources += [ "ANGLEWindowContext.cpp" ] 74 } 75 if (is_android) { 76 sources += [ "android/GLWindowContext_android.cpp" ] 77 } else if (is_linux) { 78 sources += [ "unix/GLWindowContext_unix.cpp" ] 79 } else if (is_win) { 80 sources += [ "win/GLWindowContext_win.cpp" ] 81 if (skia_use_angle) { 82 sources += [ "win/ANGLEWindowContext_win.cpp" ] 83 } 84 } else if (is_mac) { 85 sources += [ 86 "mac/GLWindowContext_mac.mm", 87 "mac/RasterWindowContext_mac.mm", 88 ] 89 if (skia_use_angle) { 90 sources += [ "mac/ANGLEWindowContext_mac.mm" ] 91 } 92 } else if (is_ios) { 93 sources += [ 94 "ios/GLWindowContext_ios.mm", 95 "ios/RasterWindowContext_ios.mm", 96 ] 97 } 98 } 99 100 if (skia_use_vulkan) { 101 sources += [ 102 "VulkanWindowContext.cpp", 103 "VulkanWindowContext.h", 104 ] 105 if (skia_enable_graphite) { 106 sources += [ 107 "GraphiteVulkanWindowContext.cpp", 108 "GraphiteVulkanWindowContext.h", 109 ] 110 } 111 if (is_android) { 112 sources += [ "android/VulkanWindowContext_android.cpp" ] 113 if (skia_enable_graphite) { 114 sources += [ "android/GraphiteVulkanWindowContext_android.cpp" ] 115 } 116 } else if (is_linux) { 117 sources += [ "unix/VulkanWindowContext_unix.cpp" ] 118 if (skia_enable_graphite) { 119 sources += [ "unix/GraphiteVulkanWindowContext_unix.cpp" ] 120 } 121 libs += [ "X11-xcb" ] 122 } else if (is_win) { 123 sources += [ "win/VulkanWindowContext_win.cpp" ] 124 if (skia_enable_graphite) { 125 sources += [ "win/GraphiteVulkanWindowContext_win.cpp" ] 126 } 127 } 128 } 129 130 if (skia_use_metal) { 131 sources += [ 132 "MetalWindowContext.h", 133 "MetalWindowContext.mm", 134 ] 135 if (skia_enable_graphite) { 136 sources += [ 137 "GraphiteMetalWindowContext.h", 138 "GraphiteMetalWindowContext.mm", 139 ] 140 } 141 if (is_mac) { 142 sources += [ "mac/MetalWindowContext_mac.mm" ] 143 if (skia_enable_graphite) { 144 sources += [ "mac/GraphiteMetalWindowContext_mac.mm" ] 145 } 146 } else if (is_ios) { 147 sources += [ "ios/MetalWindowContext_ios.mm" ] 148 if (skia_enable_graphite) { 149 sources += [ "ios/GraphiteMetalWindowContext_ios.mm" ] 150 } 151 } 152 } 153 154 if (skia_use_direct3d) { 155 sources += [ "win/D3D12WindowContext_win.cpp" ] 156 } 157 158 if (skia_use_dawn) { 159 if (is_linux) { 160 if (dawn_enable_vulkan) { 161 defines = [ "VK_USE_PLATFORM_XCB_KHR" ] 162 libs += [ "X11-xcb" ] 163 if (skia_enable_graphite) { 164 sources += [ 165 "GraphiteDawnWindowContext.cpp", 166 "GraphiteDawnWindowContext.h", 167 "unix/GraphiteDawnVulkanWindowContext_unix.cpp", 168 ] 169 } 170 } 171 } else if (is_win) { 172 if (dawn_enable_d3d12 || dawn_enable_d3d11 || dawn_enable_vulkan) { 173 if (skia_enable_graphite) { 174 sources += [ 175 "GraphiteDawnWindowContext.cpp", 176 "GraphiteDawnWindowContext.h", 177 "win/GraphiteDawnD3D12WindowContext_win.cpp", 178 ] 179 } 180 } 181 } else if (is_mac) { 182 if (dawn_enable_metal) { 183 if (skia_enable_graphite) { 184 sources += [ 185 "GraphiteDawnWindowContext.cpp", 186 "GraphiteDawnWindowContext.h", 187 "mac/GraphiteDawnMetalWindowContext_mac.mm", 188 ] 189 } 190 } 191 } 192 } 193 194 configs = [ "../../:skia_private" ] 195 deps = [ 196 "../..:gpu_tool_utils", 197 "../..:skia", 198 ] 199 200 if (skia_use_gl && skia_use_angle) { 201 deps += [ "//third_party/angle2" ] 202 } 203} 204