Debian Codegraph @

tools/window/BUILD.gn

raw
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
6 import("../../gn/skia.gni")
7 import("../../third_party/dawn/args.gni")
8
9 config("public_config") {
10 defines = []
11 include_dirs = [ "." ]
12 }
13
14 skia_component("window") {
15 check_includes = false
16 testonly = true # For access to gpu_tool_utils. TODO: clean up
17 public_configs = [ ":public_config" ]
18 public = [
19 "DisplayParams.h",
20 "WindowContext.h",
21 ]
22 sources = [
23 "DisplayParams.h",
24 "RasterWindowContext.h",
25 "WindowContext.cpp",
26 "WindowContext.h",
27 ]
28
29 libs = []
30 frameworks = []
31
32 if (is_android) {
33 sources += [
34 "android/RasterWindowContext_android.cpp",
35 "android/WindowContextFactory_android.h",
36 ]
37 libs += [ "android" ]
38 } else if (is_linux) {
39 sources += [
40 "unix/RasterWindowContext_unix.cpp",
41 "unix/RasterWindowContext_unix.h",
42 "unix/XlibWindowInfo.h",
43 ]
44 libs += [ "X11" ]
45 } else if (is_win) {
46 sources += [
47 "win/RasterWindowContext_win.cpp",
48 "win/WindowContextFactory_win.h",
49 ]
50 } else if (is_mac) {
51 sources += [ "mac/MacWindowInfo.h" ]
52 frameworks += [
53 "QuartzCore.framework",
54 "Cocoa.framework",
55 "Foundation.framework",
56 ]
57 } else if (is_ios) {
58 sources += [ "ios/WindowContextFactory_ios.h" ]
59 frameworks += [ "QuartzCore.framework" ]
60 }
61
62 if (skia_use_gl) {
63 sources += [
64 "GLWindowContext.cpp",
65 "GLWindowContext.h",
66 ]
67 if (skia_use_angle) {
68 sources += [ "ANGLEWindowContext.cpp" ]
69 }
70 if (is_android) {
71 sources += [ "android/GLWindowContext_android.cpp" ]
72 } else if (is_linux) {
73 sources += [
74 "unix/GaneshGLWindowContext_unix.cpp",
75 "unix/GaneshGLWindowContext_unix.h",
76 ]
77 libs += [ "GL" ]
78 } else if (is_win) {
79 sources += [ "win/GLWindowContext_win.cpp" ]
80 if (skia_use_angle) {
81 sources += [ "win/ANGLEWindowContext_win.cpp" ]
82 }
83 } else if (is_mac) {
84 sources += [
85 # The Mac Raster implementation has a GL dependency
86 "mac/GaneshGLWindowContext_mac.h",
87 "mac/GaneshGLWindowContext_mac.mm",
88 "mac/MacWindowGLUtils.h",
89 "mac/RasterWindowContext_mac.h",
90 "mac/RasterWindowContext_mac.mm",
91 ]
92 if (skia_use_angle) {
93 sources += [
94 "mac/GaneshANGLEWindowContext_mac.h",
95 "mac/GaneshANGLEWindowContext_mac.mm",
96 "mac/MacWindowGLUtils.h",
97 ]
98 }
99 } else if (is_ios) {
100 sources += [
101 "ios/GLWindowContext_ios.mm",
102 "ios/RasterWindowContext_ios.mm",
103 ]
104 }
105 }
106
107 if (skia_use_vulkan) {
108 if (skia_enable_ganesh) {
109 sources += [
110 "VulkanWindowContext.cpp",
111 "VulkanWindowContext.h",
112 ]
113 }
114 if (skia_enable_graphite) {
115 sources += [
116 "GraphiteNativeVulkanWindowContext.cpp",
117 "GraphiteNativeVulkanWindowContext.h",
118 ]
119 }
120 if (is_android) {
121 sources += [ "android/VulkanWindowContext_android.cpp" ]
122 if (skia_enable_graphite) {
123 sources += [ "android/GraphiteVulkanWindowContext_android.cpp" ]
124 }
125 } else if (is_linux) {
126 sources += [
127 "unix/GaneshVulkanWindowContext_unix.cpp",
128 "unix/GaneshVulkanWindowContext_unix.h",
129 ]
130 if (skia_enable_graphite) {
131 sources += [
132 "unix/GraphiteNativeVulkanWindowContext_unix.cpp",
133 "unix/GraphiteNativeVulkanWindowContext_unix.h",
134 ]
135 }
136 libs += [ "X11-xcb" ]
137 } else if (is_win) {
138 sources += [ "win/VulkanWindowContext_win.cpp" ]
139 if (skia_enable_graphite) {
140 sources += [ "win/GraphiteVulkanWindowContext_win.cpp" ]
141 }
142 }
143 }
144
145 if (skia_use_metal) {
146 if (skia_enable_ganesh) {
147 sources += [
148 "MetalWindowContext.h",
149 "MetalWindowContext.mm",
150 ]
151 }
152 if (skia_enable_graphite) {
153 sources += [
154 "GraphiteNativeMetalWindowContext.h",
155 "GraphiteNativeMetalWindowContext.mm",
156 ]
157 }
158 if (is_mac) {
159 if (skia_enable_ganesh) {
160 sources += [
161 "mac/GaneshMetalWindowContext_mac.h",
162 "mac/GaneshMetalWindowContext_mac.mm",
163 ]
164 }
165 if (skia_enable_graphite) {
166 sources += [
167 "mac/GraphiteNativeMetalWindowContext_mac.h",
168 "mac/GraphiteNativeMetalWindowContext_mac.mm",
169 ]
170 }
171 } else if (is_ios) {
172 if (skia_enable_ganesh) {
173 sources += [ "ios/MetalWindowContext_ios.mm" ]
174 }
175 if (skia_enable_graphite) {
176 sources += [ "ios/GraphiteMetalWindowContext_ios.mm" ]
177 }
178 }
179 }
180
181 if (skia_use_direct3d) {
182 sources += [ "win/D3D12WindowContext_win.cpp" ]
183 }
184
185 if (skia_use_dawn) {
186 if (skia_enable_graphite) {
187 sources += [
188 "GraphiteDawnWindowContext.cpp",
189 "GraphiteDawnWindowContext.h",
190 ]
191 }
192 if (is_linux) {
193 if (skia_enable_graphite) {
194 sources += [
195 "unix/GraphiteDawnXlibWindowContext_unix.cpp",
196 "unix/GraphiteDawnXlibWindowContext_unix.h",
197 ]
198 }
199 if (dawn_enable_vulkan) {
200 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
201 libs += [ "X11-xcb" ]
202 }
203 } else if (is_win) {
204 if (dawn_enable_d3d12 || dawn_enable_d3d11 || dawn_enable_vulkan) {
205 if (skia_enable_graphite) {
206 sources += [ "win/GraphiteDawnWindowContext_win.cpp" ]
207 }
208 }
209 } else if (is_mac) {
210 if (dawn_enable_metal) {
211 if (skia_enable_graphite) {
212 sources += [
213 "mac/GraphiteDawnMetalWindowContext_mac.h",
214 "mac/GraphiteDawnMetalWindowContext_mac.mm",
215 ]
216 }
217 }
218 } else if (is_android) {
219 if (skia_enable_graphite) {
220 sources += [ "android/GraphiteDawnWindowContext_android.cpp" ]
221 }
222 }
223 }
224
225 configs = [ "../../:skia_private" ]
226 deps = [ "../..:skia" ]
227
228 if (skia_enable_ganesh || skia_enable_graphite) {
229 deps += [ "../..:gpu_tool_utils" ]
230 }
231
232 if (skia_use_gl && skia_use_angle) {
233 deps += [ "//third_party/angle2" ]
234 }
235 }