blob: bb53dde5da3a167935d1233cf6cada528dffd2d4 [file] [log] [blame]
Stephen White0d70b712019-07-10 15:51:30 -04001# Copyright 2018 The Dawn Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Stephen White20c626a2019-10-15 13:35:37 -040015import("../externals/dawn/generator/dawn_generator.gni")
16import("../externals/dawn/scripts/dawn_features.gni")
Stephen White0d70b712019-07-10 15:51:30 -040017
18###############################################################################
Stephen White20c626a2019-10-15 13:35:37 -040019# dawn_platform
20###############################################################################
21
22source_set("dawn_platform") {
23 configs += [ ":dawn_internal" ]
24
25 sources =
26 rebase_path([
27 "${dawn_root}/src/include/dawn_platform/DawnPlatform.h",
28 "src/dawn_platform/tracing/EventTracer.cpp",
29 "src/dawn_platform/tracing/EventTracer.h",
30 "src/dawn_platform/tracing/TraceEvent.h",
31 ],
32 ".",
33 "$dawn_root")
34}
35
36###############################################################################
Stephen White96d9a072019-10-17 11:31:34 -040037# libdawn_native
Stephen White0d70b712019-07-10 15:51:30 -040038###############################################################################
39
40config("libdawn_native_internal") {
41 configs = [ ":dawn_internal" ]
Stephen White0d70b712019-07-10 15:51:30 -040042
Stephen White96d9a072019-10-17 11:31:34 -040043 # Suppress warnings that Metal isn't in the deployment target of Chrome:
44 # initialization of the Metal backend is behind a IsMetalSupported check so
45 # Dawn won't call Metal functions on macOS 10.10.
46 # TODO(cwallez@chromium.org): Consider using API_AVAILABLE annotations on all
47 # metal code in dawn once crbug.com/1004024 is sorted out.
Stephen White0d70b712019-07-10 15:51:30 -040048 if (is_mac) {
49 cflags_objcc = [ "-Wno-unguarded-availability" ]
50 }
51}
52
Stephen White3e45e122019-07-22 09:12:29 -040053dawn_json_generator("libdawn_native_utils_gen") {
Stephen White0d70b712019-07-10 15:51:30 -040054 target = "dawn_native_utils"
55 outputs = [
Stephen White20c626a2019-10-15 13:35:37 -040056 "src/dawn_native/ProcTable.cpp",
57 "src/dawn_native/dawn_structs_autogen.h",
58 "src/dawn_native/dawn_structs_autogen.cpp",
59 "src/dawn_native/ValidationUtils_autogen.h",
60 "src/dawn_native/ValidationUtils_autogen.cpp",
Stephen White0d70b712019-07-10 15:51:30 -040061 ]
62}
63
Stephen White3e45e122019-07-22 09:12:29 -040064if (dawn_enable_opengl) {
65 dawn_generator("libdawn_native_opengl_loader_gen") {
66 script = "${dawn_root}/generator/opengl_loader_generator.py"
67 args = [
68 "--gl-xml",
Stephen Whited36dc302019-08-27 12:41:55 -040069 rebase_path("../externals/opengl-registry/xml/gl.xml", root_build_dir),
Stephen White20c626a2019-10-15 13:35:37 -040070 "--supported-extensions",
71 rebase_path("$dawn_root/src/dawn_native/opengl/supported_extensions.json",
72 root_build_dir),
Stephen White3e45e122019-07-22 09:12:29 -040073 ]
74 outputs = [
Stephen White20c626a2019-10-15 13:35:37 -040075 "src/dawn_native/opengl/OpenGLFunctionsBase_autogen.cpp",
76 "src/dawn_native/opengl/OpenGLFunctionsBase_autogen.h",
77 "src/dawn_native/opengl/opengl_platform_autogen.h",
Stephen White3e45e122019-07-22 09:12:29 -040078 ]
79 }
80}
81
Stephen White0d70b712019-07-10 15:51:30 -040082# Public libdawn_native headers so they can be publically visible for
83# dependencies of libdawn_native
84source_set("libdawn_native_headers") {
85 public_deps = [
Stephen White96d9a072019-10-17 11:31:34 -040086 ":dawncpp_headers",
Stephen White0d70b712019-07-10 15:51:30 -040087 ]
88 sources = rebase_path(
89 [
90 "src/include/dawn_native/DawnNative.h",
91 "src/include/dawn_native/dawn_native_export.h",
92
93 # Include all backend's public headers so that dependencies can include
94 # them even when the backends are disabled.
95 "src/include/dawn_native/D3D12Backend.h",
96 "src/include/dawn_native/MetalBackend.h",
97 "src/include/dawn_native/NullBackend.h",
98 "src/include/dawn_native/OpenGLBackend.h",
99 "src/include/dawn_native/VulkanBackend.h",
100 ],
101 ".",
102 "$dawn_root")
103}
104
Stephen Whitefbffb992019-10-17 10:32:40 -0400105static_library("libdawn_native") {
Stephen White0d70b712019-07-10 15:51:30 -0400106 deps = [
107 ":dawn_common",
Stephen White96d9a072019-10-17 11:31:34 -0400108 ":libdawn_native_headers",
Stephen White0d70b712019-07-10 15:51:30 -0400109 ":libdawn_native_utils_gen",
Stephen White15d0a262019-08-27 12:24:45 -0400110 "//third_party/spirv-cross:spirv_cross",
Stephen Whitec445c7d2019-08-27 10:53:59 -0400111 "//third_party/spirv-tools:spvtools_val",
Stephen White0d70b712019-07-10 15:51:30 -0400112 ]
113
Stephen White96d9a072019-10-17 11:31:34 -0400114 configs += [ ":libdawn_native_internal" ]
115 libs = []
Stephen White0d70b712019-07-10 15:51:30 -0400116
Stephen White96d9a072019-10-17 11:31:34 -0400117 # Dependencies that are needed to compile libdawn_native entry points in
118 # FooBackend.cpp need to be public deps so they are propagated to the
119 # libdawn_native target
Stephen White0d70b712019-07-10 15:51:30 -0400120 public_deps = [
Stephen White20c626a2019-10-15 13:35:37 -0400121 ":dawn_platform",
Stephen White0d70b712019-07-10 15:51:30 -0400122 ]
123
Stephen White0d70b712019-07-10 15:51:30 -0400124 sources = rebase_path(get_target_outputs(":libdawn_native_utils_gen"),
125 ".",
126 "$dawn_root")
127 sources += rebase_path([
128 "src/dawn_native/Adapter.cpp",
129 "src/dawn_native/Adapter.h",
Stephen White20c626a2019-10-15 13:35:37 -0400130 "src/dawn_native/AttachmentState.cpp",
131 "src/dawn_native/AttachmentState.h",
Stephen White0d70b712019-07-10 15:51:30 -0400132 "src/dawn_native/BackendConnection.cpp",
133 "src/dawn_native/BackendConnection.h",
134 "src/dawn_native/BindGroup.cpp",
135 "src/dawn_native/BindGroup.h",
136 "src/dawn_native/BindGroupLayout.cpp",
137 "src/dawn_native/BindGroupLayout.h",
138 "src/dawn_native/Buffer.cpp",
139 "src/dawn_native/Buffer.h",
140 "src/dawn_native/CommandAllocator.cpp",
141 "src/dawn_native/CommandAllocator.h",
142 "src/dawn_native/CommandBuffer.cpp",
143 "src/dawn_native/CommandBuffer.h",
144 "src/dawn_native/CommandBufferStateTracker.cpp",
145 "src/dawn_native/CommandBufferStateTracker.h",
146 "src/dawn_native/CommandEncoder.cpp",
147 "src/dawn_native/CommandEncoder.h",
Stephen White20c626a2019-10-15 13:35:37 -0400148 "src/dawn_native/CommandValidation.cpp",
149 "src/dawn_native/CommandValidation.h",
Stephen White0d70b712019-07-10 15:51:30 -0400150 "src/dawn_native/Commands.cpp",
151 "src/dawn_native/Commands.h",
152 "src/dawn_native/ComputePassEncoder.cpp",
153 "src/dawn_native/ComputePassEncoder.h",
154 "src/dawn_native/ComputePipeline.cpp",
155 "src/dawn_native/ComputePipeline.h",
156 "src/dawn_native/DawnNative.cpp",
157 "src/dawn_native/Device.cpp",
158 "src/dawn_native/Device.h",
159 "src/dawn_native/DynamicUploader.cpp",
160 "src/dawn_native/DynamicUploader.h",
161 "src/dawn_native/Device.h",
Stephen White20c626a2019-10-15 13:35:37 -0400162 "src/dawn_native/EncodingContext.cpp",
163 "src/dawn_native/EncodingContext.h",
Stephen White0d70b712019-07-10 15:51:30 -0400164 "src/dawn_native/Error.cpp",
165 "src/dawn_native/Error.h",
166 "src/dawn_native/ErrorData.cpp",
167 "src/dawn_native/ErrorData.h",
Stephen White20c626a2019-10-15 13:35:37 -0400168 "src/dawn_native/ErrorScope.cpp",
169 "src/dawn_native/ErrorScope.h",
170 "src/dawn_native/ErrorScopeTracker.cpp",
171 "src/dawn_native/ErrorScopeTracker.h",
172 "src/dawn_native/Extensions.cpp",
173 "src/dawn_native/Extensions.h",
Stephen White0d70b712019-07-10 15:51:30 -0400174 "src/dawn_native/Fence.cpp",
175 "src/dawn_native/Fence.h",
176 "src/dawn_native/FenceSignalTracker.cpp",
177 "src/dawn_native/FenceSignalTracker.h",
Stephen White3e45e122019-07-22 09:12:29 -0400178 "src/dawn_native/Format.cpp",
179 "src/dawn_native/Format.h",
Stephen White0d70b712019-07-10 15:51:30 -0400180 "src/dawn_native/Forward.h",
181 "src/dawn_native/Instance.cpp",
182 "src/dawn_native/Instance.h",
183 "src/dawn_native/ObjectBase.h",
184 "src/dawn_native/ObjectBase.cpp",
185 "src/dawn_native/PassResourceUsage.h",
Stephen White20c626a2019-10-15 13:35:37 -0400186 "src/dawn_native/PassResourceUsageTracker.cpp",
187 "src/dawn_native/PassResourceUsageTracker.h",
Stephen White0d70b712019-07-10 15:51:30 -0400188 "src/dawn_native/PerStage.cpp",
189 "src/dawn_native/PerStage.h",
190 "src/dawn_native/Pipeline.cpp",
191 "src/dawn_native/Pipeline.h",
192 "src/dawn_native/PipelineLayout.cpp",
193 "src/dawn_native/PipelineLayout.h",
194 "src/dawn_native/ProgrammablePassEncoder.cpp",
195 "src/dawn_native/ProgrammablePassEncoder.h",
196 "src/dawn_native/Queue.cpp",
197 "src/dawn_native/Queue.h",
198 "src/dawn_native/RefCounted.cpp",
199 "src/dawn_native/RefCounted.h",
Stephen White20c626a2019-10-15 13:35:37 -0400200 "src/dawn_native/RenderBundle.cpp",
201 "src/dawn_native/RenderBundle.h",
202 "src/dawn_native/RenderBundleEncoder.cpp",
203 "src/dawn_native/RenderBundleEncoder.h",
204 "src/dawn_native/RenderEncoderBase.cpp",
205 "src/dawn_native/RenderEncoderBase.h",
Stephen White0d70b712019-07-10 15:51:30 -0400206 "src/dawn_native/RenderPassEncoder.cpp",
207 "src/dawn_native/RenderPassEncoder.h",
208 "src/dawn_native/RenderPipeline.cpp",
209 "src/dawn_native/RenderPipeline.h",
Stephen White20c626a2019-10-15 13:35:37 -0400210 "src/dawn_native/ResourceMemoryAllocation.cpp",
211 "src/dawn_native/ResourceMemoryAllocation.h",
212 "src/dawn_native/RingBufferAllocator.cpp",
213 "src/dawn_native/RingBufferAllocator.h",
Stephen White0d70b712019-07-10 15:51:30 -0400214 "src/dawn_native/Sampler.cpp",
215 "src/dawn_native/Sampler.h",
216 "src/dawn_native/ShaderModule.cpp",
217 "src/dawn_native/ShaderModule.h",
218 "src/dawn_native/StagingBuffer.cpp",
219 "src/dawn_native/StagingBuffer.h",
220 "src/dawn_native/SwapChain.cpp",
221 "src/dawn_native/SwapChain.h",
222 "src/dawn_native/Texture.cpp",
223 "src/dawn_native/Texture.h",
Stephen White20c626a2019-10-15 13:35:37 -0400224 "src/dawn_native/Toggles.cpp",
225 "src/dawn_native/Toggles.h",
Stephen White0d70b712019-07-10 15:51:30 -0400226 "src/dawn_native/ToBackend.h",
227 "src/dawn_native/dawn_platform.h",
228 ],
229 ".",
230 "$dawn_root")
231
232 if (dawn_enable_d3d12) {
233 libs += [ "dxguid.lib" ]
Stephen White36446f22019-10-16 10:20:18 -0400234 sources += rebase_path(
235 [
236 "src/dawn_native/d3d12/AdapterD3D12.cpp",
237 "src/dawn_native/d3d12/AdapterD3D12.h",
238 "src/dawn_native/d3d12/BackendD3D12.cpp",
239 "src/dawn_native/d3d12/BackendD3D12.h",
240 "src/dawn_native/d3d12/BindGroupD3D12.cpp",
241 "src/dawn_native/d3d12/BindGroupD3D12.h",
242 "src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp",
243 "src/dawn_native/d3d12/BindGroupLayoutD3D12.h",
244 "src/dawn_native/d3d12/BufferD3D12.cpp",
245 "src/dawn_native/d3d12/BufferD3D12.h",
246 "src/dawn_native/d3d12/CommandAllocatorManager.cpp",
247 "src/dawn_native/d3d12/CommandAllocatorManager.h",
248 "src/dawn_native/d3d12/CommandBufferD3D12.cpp",
249 "src/dawn_native/d3d12/CommandBufferD3D12.h",
250 "src/dawn_native/d3d12/CommandRecordingContext.cpp",
251 "src/dawn_native/d3d12/CommandRecordingContext.h",
252 "src/dawn_native/d3d12/CommittedResourceAllocatorD3D12.cpp",
253 "src/dawn_native/d3d12/CommittedResourceAllocatorD3D12.h",
254 "src/dawn_native/d3d12/ComputePipelineD3D12.cpp",
255 "src/dawn_native/d3d12/ComputePipelineD3D12.h",
256 "src/dawn_native/d3d12/D3D12Backend.cpp",
Stephen White96d9a072019-10-17 11:31:34 -0400257 "src/dawn_native/d3d12/D3D12Error.cpp",
258 "src/dawn_native/d3d12/D3D12Error.h",
Stephen White36446f22019-10-16 10:20:18 -0400259 "src/dawn_native/d3d12/D3D12Info.cpp",
260 "src/dawn_native/d3d12/D3D12Info.h",
261 "src/dawn_native/d3d12/DescriptorHeapAllocator.cpp",
262 "src/dawn_native/d3d12/DescriptorHeapAllocator.h",
263 "src/dawn_native/d3d12/DeviceD3D12.cpp",
264 "src/dawn_native/d3d12/DeviceD3D12.h",
265 "src/dawn_native/d3d12/Forward.h",
266 "src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp",
267 "src/dawn_native/d3d12/NativeSwapChainImplD3D12.h",
268 "src/dawn_native/d3d12/PipelineLayoutD3D12.cpp",
269 "src/dawn_native/d3d12/PipelineLayoutD3D12.h",
270 "src/dawn_native/d3d12/PlatformFunctions.cpp",
271 "src/dawn_native/d3d12/PlatformFunctions.h",
272 "src/dawn_native/d3d12/QueueD3D12.cpp",
273 "src/dawn_native/d3d12/QueueD3D12.h",
274 "src/dawn_native/d3d12/RenderPipelineD3D12.cpp",
275 "src/dawn_native/d3d12/RenderPipelineD3D12.h",
276 "src/dawn_native/d3d12/ResourceAllocator.cpp",
277 "src/dawn_native/d3d12/ResourceAllocator.h",
278 "src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.cpp",
279 "src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.h",
280 "src/dawn_native/d3d12/ResourceHeapAllocationD3D12.cpp",
281 "src/dawn_native/d3d12/ResourceHeapAllocationD3D12.h",
282 "src/dawn_native/d3d12/SamplerD3D12.cpp",
283 "src/dawn_native/d3d12/SamplerD3D12.h",
284 "src/dawn_native/d3d12/ShaderModuleD3D12.cpp",
285 "src/dawn_native/d3d12/ShaderModuleD3D12.h",
286 "src/dawn_native/d3d12/StagingBufferD3D12.cpp",
287 "src/dawn_native/d3d12/StagingBufferD3D12.h",
288 "src/dawn_native/d3d12/SwapChainD3D12.cpp",
289 "src/dawn_native/d3d12/SwapChainD3D12.h",
290 "src/dawn_native/d3d12/TextureCopySplitter.cpp",
291 "src/dawn_native/d3d12/TextureCopySplitter.h",
292 "src/dawn_native/d3d12/TextureD3D12.cpp",
293 "src/dawn_native/d3d12/TextureD3D12.h",
294 "src/dawn_native/d3d12/UtilsD3D12.cpp",
295 "src/dawn_native/d3d12/UtilsD3D12.h",
296 "src/dawn_native/d3d12/d3d12_platform.h",
297 ],
298 ".",
299 "$dawn_root")
Stephen White0d70b712019-07-10 15:51:30 -0400300 }
301
302 if (dawn_enable_metal) {
303 libs += [
304 "Metal.framework",
305 "Cocoa.framework",
306 "IOKit.framework",
307 "IOSurface.framework",
308 ]
309 sources += rebase_path([
310 "src/dawn_native/metal/BackendMTL.h",
311 "src/dawn_native/metal/BackendMTL.mm",
312 "src/dawn_native/metal/BufferMTL.h",
313 "src/dawn_native/metal/BufferMTL.mm",
314 "src/dawn_native/metal/CommandBufferMTL.h",
315 "src/dawn_native/metal/CommandBufferMTL.mm",
316 "src/dawn_native/metal/ComputePipelineMTL.h",
317 "src/dawn_native/metal/ComputePipelineMTL.mm",
318 "src/dawn_native/metal/DeviceMTL.h",
319 "src/dawn_native/metal/DeviceMTL.mm",
320 "src/dawn_native/metal/Forward.h",
321 "src/dawn_native/metal/MetalBackend.mm",
322 "src/dawn_native/metal/PipelineLayoutMTL.h",
323 "src/dawn_native/metal/PipelineLayoutMTL.mm",
324 "src/dawn_native/metal/QueueMTL.h",
325 "src/dawn_native/metal/QueueMTL.mm",
326 "src/dawn_native/metal/RenderPipelineMTL.h",
327 "src/dawn_native/metal/RenderPipelineMTL.mm",
328 "src/dawn_native/metal/SamplerMTL.h",
329 "src/dawn_native/metal/SamplerMTL.mm",
330 "src/dawn_native/metal/ShaderModuleMTL.h",
331 "src/dawn_native/metal/ShaderModuleMTL.mm",
332 "src/dawn_native/metal/StagingBufferMTL.h",
333 "src/dawn_native/metal/StagingBufferMTL.mm",
334 "src/dawn_native/metal/SwapChainMTL.h",
335 "src/dawn_native/metal/SwapChainMTL.mm",
336 "src/dawn_native/metal/TextureMTL.h",
337 "src/dawn_native/metal/TextureMTL.mm",
338 "src/dawn_native/metal/UtilsMetal.h",
339 "src/dawn_native/metal/UtilsMetal.mm",
340 ],
341 ".",
342 "$dawn_root")
343 }
344
345 if (dawn_enable_null) {
346 sources += rebase_path([
347 "src/dawn_native/null/DeviceNull.cpp",
348 "src/dawn_native/null/DeviceNull.h",
349 "src/dawn_native/null/NullBackend.cpp",
350 ],
351 ".",
352 "$dawn_root")
353 }
354
355 if (dawn_enable_opengl) {
Stephen Whiteb288c8d2019-08-27 16:35:11 -0400356 deps += [ ":libdawn_native_opengl_loader_gen" ]
Stephen White3e45e122019-07-22 09:12:29 -0400357 sources += get_target_outputs(":libdawn_native_opengl_loader_gen")
Stephen White0d70b712019-07-10 15:51:30 -0400358 sources +=
359 rebase_path([
360 "src/dawn_native/opengl/BackendGL.cpp",
361 "src/dawn_native/opengl/BackendGL.h",
362 "src/dawn_native/opengl/BufferGL.cpp",
363 "src/dawn_native/opengl/BufferGL.h",
364 "src/dawn_native/opengl/CommandBufferGL.cpp",
365 "src/dawn_native/opengl/CommandBufferGL.h",
366 "src/dawn_native/opengl/ComputePipelineGL.cpp",
367 "src/dawn_native/opengl/ComputePipelineGL.h",
368 "src/dawn_native/opengl/DeviceGL.cpp",
369 "src/dawn_native/opengl/DeviceGL.h",
370 "src/dawn_native/opengl/Forward.h",
Stephen White20c626a2019-10-15 13:35:37 -0400371 "src/dawn_native/opengl/GLFormat.h",
372 "src/dawn_native/opengl/GLFormat.cpp",
Stephen White3e45e122019-07-22 09:12:29 -0400373 "src/dawn_native/opengl/NativeSwapChainImplGL.cpp",
374 "src/dawn_native/opengl/NativeSwapChainImplGL.h",
375 "src/dawn_native/opengl/OpenGLFunctions.cpp",
376 "src/dawn_native/opengl/OpenGLFunctions.h",
Stephen White0d70b712019-07-10 15:51:30 -0400377 "src/dawn_native/opengl/OpenGLBackend.cpp",
378 "src/dawn_native/opengl/PersistentPipelineStateGL.cpp",
379 "src/dawn_native/opengl/PersistentPipelineStateGL.h",
380 "src/dawn_native/opengl/PipelineGL.cpp",
381 "src/dawn_native/opengl/PipelineGL.h",
382 "src/dawn_native/opengl/PipelineLayoutGL.cpp",
383 "src/dawn_native/opengl/PipelineLayoutGL.h",
384 "src/dawn_native/opengl/QueueGL.cpp",
385 "src/dawn_native/opengl/QueueGL.h",
386 "src/dawn_native/opengl/RenderPipelineGL.cpp",
387 "src/dawn_native/opengl/RenderPipelineGL.h",
388 "src/dawn_native/opengl/SamplerGL.cpp",
389 "src/dawn_native/opengl/SamplerGL.h",
390 "src/dawn_native/opengl/ShaderModuleGL.cpp",
391 "src/dawn_native/opengl/ShaderModuleGL.h",
392 "src/dawn_native/opengl/SwapChainGL.cpp",
393 "src/dawn_native/opengl/SwapChainGL.h",
394 "src/dawn_native/opengl/TextureGL.cpp",
395 "src/dawn_native/opengl/TextureGL.h",
396 "src/dawn_native/opengl/UtilsGL.cpp",
397 "src/dawn_native/opengl/UtilsGL.h",
Stephen White3e45e122019-07-22 09:12:29 -0400398 "src/dawn_native/opengl/opengl_platform.h",
Stephen White0d70b712019-07-10 15:51:30 -0400399 ],
400 ".",
401 "$dawn_root")
402 }
403
404 configs -= [ "//gn:warnings" ]
405 if (dawn_enable_vulkan) {
Stephen Whited36dc302019-08-27 12:41:55 -0400406 configs += [ "//:our_vulkan_headers" ]
407 include_dirs = [ "../.." ] # for "include/third_party/vulkan/vulkan/vk_platform.h" in vulkan.h
Stephen White20c626a2019-10-15 13:35:37 -0400408 sources += rebase_path(
409 [
410 "src/dawn_native/vulkan/AdapterVk.cpp",
411 "src/dawn_native/vulkan/AdapterVk.h",
412 "src/dawn_native/vulkan/BackendVk.cpp",
413 "src/dawn_native/vulkan/BackendVk.h",
414 "src/dawn_native/vulkan/BindGroupLayoutVk.cpp",
415 "src/dawn_native/vulkan/BindGroupLayoutVk.h",
416 "src/dawn_native/vulkan/BindGroupVk.cpp",
417 "src/dawn_native/vulkan/BindGroupVk.h",
418 "src/dawn_native/vulkan/BufferVk.cpp",
419 "src/dawn_native/vulkan/BufferVk.h",
420 "src/dawn_native/vulkan/CommandBufferVk.cpp",
421 "src/dawn_native/vulkan/CommandBufferVk.h",
422 "src/dawn_native/vulkan/ComputePipelineVk.cpp",
423 "src/dawn_native/vulkan/ComputePipelineVk.h",
424 "src/dawn_native/vulkan/DeviceVk.cpp",
425 "src/dawn_native/vulkan/DeviceVk.h",
426 "src/dawn_native/vulkan/ExternalHandle.h",
427 "src/dawn_native/vulkan/FencedDeleter.cpp",
428 "src/dawn_native/vulkan/FencedDeleter.h",
429 "src/dawn_native/vulkan/Forward.h",
430 "src/dawn_native/vulkan/MemoryAllocator.cpp",
431 "src/dawn_native/vulkan/MemoryAllocator.h",
432 "src/dawn_native/vulkan/MemoryResourceAllocatorVk.cpp",
433 "src/dawn_native/vulkan/MemoryResourceAllocatorVk.h",
434 "src/dawn_native/vulkan/NativeSwapChainImplVk.cpp",
435 "src/dawn_native/vulkan/NativeSwapChainImplVk.h",
436 "src/dawn_native/vulkan/PipelineLayoutVk.cpp",
437 "src/dawn_native/vulkan/PipelineLayoutVk.h",
438 "src/dawn_native/vulkan/QueueVk.cpp",
439 "src/dawn_native/vulkan/QueueVk.h",
440 "src/dawn_native/vulkan/RenderPassCache.cpp",
441 "src/dawn_native/vulkan/RenderPassCache.h",
442 "src/dawn_native/vulkan/RenderPipelineVk.cpp",
443 "src/dawn_native/vulkan/RenderPipelineVk.h",
444 "src/dawn_native/vulkan/ResourceMemoryVk.cpp",
445 "src/dawn_native/vulkan/ResourceMemoryVk.h",
446 "src/dawn_native/vulkan/SamplerVk.cpp",
447 "src/dawn_native/vulkan/SamplerVk.h",
448 "src/dawn_native/vulkan/ShaderModuleVk.cpp",
449 "src/dawn_native/vulkan/ShaderModuleVk.h",
450 "src/dawn_native/vulkan/StagingBufferVk.cpp",
451 "src/dawn_native/vulkan/StagingBufferVk.h",
452 "src/dawn_native/vulkan/SwapChainVk.cpp",
453 "src/dawn_native/vulkan/SwapChainVk.h",
454 "src/dawn_native/vulkan/TextureVk.cpp",
455 "src/dawn_native/vulkan/TextureVk.h",
456 "src/dawn_native/vulkan/UtilsVulkan.cpp",
457 "src/dawn_native/vulkan/UtilsVulkan.h",
458 "src/dawn_native/vulkan/VulkanBackend.cpp",
459 "src/dawn_native/vulkan/VulkanError.cpp",
460 "src/dawn_native/vulkan/VulkanError.h",
461 "src/dawn_native/vulkan/VulkanFunctions.cpp",
462 "src/dawn_native/vulkan/VulkanFunctions.h",
463 "src/dawn_native/vulkan/VulkanInfo.cpp",
464 "src/dawn_native/vulkan/VulkanInfo.h",
465 "src/dawn_native/vulkan/external_memory/MemoryService.h",
466 "src/dawn_native/vulkan/external_semaphore/SemaphoreService.h",
467 ],
468 ".",
469 "$dawn_root")
470 if (is_linux) {
471 sources += rebase_path(
472 [
473 "src/dawn_native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp",
474 "src/dawn_native/vulkan/external_semaphore/SemaphoreServiceOpaqueFD.cpp",
475 ],
476 ".",
477 "$dawn_root")
478 } else {
479 sources += rebase_path(
480 [
481 "src/dawn_native/vulkan/external_memory/MemoryServiceNull.cpp",
482 "src/dawn_native/vulkan/external_semaphore/SemaphoreServiceNull.cpp",
483 ],
484 ".",
485 "$dawn_root")
486 }
Stephen White0d70b712019-07-10 15:51:30 -0400487 }
488}
Stephen White96d9a072019-10-17 11:31:34 -0400489
490config("libdawn_public") {
491 include_dirs = [
492 "$dawn_gen_root/src/include",
493 "$dawn_gen_root/src",
494 "$dawn_root/src/include",
495 "$dawn_root/src",
496 ]
497}
498
499config("dawn_internal") {
500 include_dirs = [ "$dawn_root/src" ]
501
502 defines = []
503 if (dawn_always_assert || is_debug) {
504 defines += [ "DAWN_ENABLE_ASSERTS" ]
505 }
506
507 if (dawn_enable_d3d12) {
508 defines += [ "DAWN_ENABLE_BACKEND_D3D12" ]
509 }
510 if (dawn_enable_metal) {
511 defines += [ "DAWN_ENABLE_BACKEND_METAL" ]
512 }
513 if (dawn_enable_null) {
514 defines += [ "DAWN_ENABLE_BACKEND_NULL" ]
515 }
516 if (dawn_enable_opengl) {
517 defines += [ "DAWN_ENABLE_BACKEND_OPENGL" ]
518 }
519 if (dawn_enable_vulkan) {
520 defines += [ "DAWN_ENABLE_BACKEND_VULKAN" ]
521 }
522
523 configs = [ ":libdawn_public" ]
524
525 # Only internal Dawn targets can use this config, this means only targets in
526 # this BUILD.gn file.
527 visibility = [ ":*" ]
528}
529
530static_library("dawn_common") {
531 sources = rebase_path([
532 "Assert.cpp",
533 "Assert.h",
534 "BitSetIterator.h",
535 "Compiler.h",
536 "DynamicLib.cpp",
537 "DynamicLib.h",
538 "HashUtils.h",
539 "Math.cpp",
540 "Math.h",
541 "Platform.h",
542 "Result.cpp",
543 "Result.h",
544 "Serial.h",
545 "SerialMap.h",
546 "SerialQueue.h",
547 "SerialStorage.h",
548 "SwapChainUtils.h",
549 "vulkan_platform.h",
550 "windows_with_undefs.h",
551 ],
552 ".",
553 "$dawn_root/src/common")
554
555 configs += [ ":dawn_internal" ]
556 deps = [
557 ":dawn_headers",
558 ]
559}
560
561###############################################################################
562# Dawn headers and libdawn.so
563###############################################################################
564
565dawn_json_generator("dawn_headers_gen") {
566 target = "dawn_headers"
567 outputs = [
568 "src/include/dawn/dawn.h",
569 "src/include/dawn/dawn_proc_table.h",
570 ]
571}
572
573source_set("dawn_headers") {
574 public_configs = [ ":libdawn_public" ]
575 public_deps = [
576 ":dawn_headers_gen",
577 ]
578
579 sources = get_target_outputs(":dawn_headers_gen")
580 sources += [
581 "${dawn_root}/src/include/dawn/dawn_export.h",
582 "${dawn_root}/src/include/dawn/dawn_wsi.h",
583 ]
584}
585
586###############################################################################
587# Dawn C++ headers
588###############################################################################
589
590dawn_json_generator("dawncpp_headers_gen") {
591 target = "dawncpp_headers"
592 outputs = [
593 "src/include/dawn/dawncpp.h",
594 ]
595}
596
597source_set("dawncpp_headers") {
598 public_deps = [
599 ":dawn_headers",
600 ":dawncpp_headers_gen",
601 ]
602
603 sources = get_target_outputs(":dawncpp_headers_gen")
604 sources += [ "${dawn_root}/src/include/dawn/EnumClassBitmasks.h" ]
605}
606
607###############################################################################
608# Dawn C++ wrapper
609###############################################################################
610
611dawn_json_generator("dawncpp_gen") {
612 target = "dawncpp"
613 outputs = [
614 "src/dawn/dawncpp.cpp",
615 ]
616}
617
618source_set("dawncpp") {
619 deps = [
620 ":dawncpp_gen",
621 ":dawncpp_headers",
622 ]
623 sources = get_target_outputs(":dawncpp_gen")
624}
625
626###############################################################################
627# libdawn_proc
628###############################################################################
629
630dawn_json_generator("libdawn_proc_gen") {
631 target = "dawn_proc"
632 outputs = [
633 "src/dawn/dawn_proc.c",
634 ]
635}
636
637static_library("libdawn_proc") {
638 public_deps = [
639 ":dawn_headers",
640 ]
641 deps = [
642 ":libdawn_proc_gen",
643 ]
644 sources = get_target_outputs(":libdawn_proc_gen")
645 sources += [ "${dawn_root}/src/include/dawn/dawn_proc.h" ]
646}