• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#
5# This file houses the build configuration for the ANGLE Metal back-end.
6
7import("../../../../gni/angle.gni")
8
9assert(is_mac || is_ios)
10assert(angle_enable_metal)
11
12_metal_backend_sources = [
13  "BufferMtl.h",
14  "BufferMtl.mm",
15  "CompilerMtl.h",
16  "CompilerMtl.mm",
17  "ContextMtl.h",
18  "ContextMtl.mm",
19  "DeviceMtl.h",
20  "DeviceMtl.mm",
21  "DisplayMtl.h",
22  "DisplayMtl.mm",
23  "DisplayMtl_api.h",
24  "FrameBufferMtl.h",
25  "FrameBufferMtl.mm",
26  "IOSurfaceSurfaceMtl.h",
27  "IOSurfaceSurfaceMtl.mm",
28  "ImageMtl.h",
29  "ImageMtl.mm",
30  "ProgramMtl.h",
31  "ProgramMtl.mm",
32  "ProvokingVertexHelper.h",
33  "ProvokingVertexHelper.mm",
34  "QueryMtl.h",
35  "QueryMtl.mm",
36  "RenderBufferMtl.h",
37  "RenderBufferMtl.mm",
38  "RenderTargetMtl.h",
39  "RenderTargetMtl.mm",
40  "SamplerMtl.h",
41  "SamplerMtl.mm",
42  "ShaderMtl.h",
43  "ShaderMtl.mm",
44  "SurfaceMtl.h",
45  "SurfaceMtl.mm",
46  "SyncMtl.h",
47  "SyncMtl.mm",
48  "TextureMtl.h",
49  "TextureMtl.mm",
50  "TransformFeedbackMtl.h",
51  "TransformFeedbackMtl.mm",
52  "VertexArrayMtl.h",
53  "VertexArrayMtl.mm",
54  "mtl_buffer_pool.h",
55  "mtl_buffer_pool.mm",
56  "mtl_command_buffer.h",
57  "mtl_command_buffer.mm",
58  "mtl_common.h",
59  "mtl_common.mm",
60  "mtl_context_device.h",
61  "mtl_context_device.mm",
62  "mtl_default_shaders_compiled.inc",
63  "mtl_format_table_autogen.mm",
64  "mtl_format_utils.h",
65  "mtl_format_utils.mm",
66  "mtl_glslang_mtl_utils.h",
67  "mtl_glslang_mtl_utils.mm",
68  "mtl_glslang_utils.h",
69  "mtl_glslang_utils.mm",
70  "mtl_occlusion_query_pool.h",
71  "mtl_occlusion_query_pool.mm",
72  "mtl_render_utils.h",
73  "mtl_render_utils.mm",
74  "mtl_resource_spi.h",
75  "mtl_resources.h",
76  "mtl_resources.mm",
77  "mtl_state_cache.h",
78  "mtl_state_cache.mm",
79  "mtl_utils.h",
80  "mtl_utils.mm",
81  "shaders/constants.h",
82  "shaders/format_autogen.h",
83  "shaders/mtl_default_shaders_src_autogen.inc",
84  "shaders/rewrite_indices_shared.h",
85]
86
87config("angle_metal_backend_config") {
88  defines = [
89    "ANGLE_ENABLE_METAL",
90    "ANGLE_ENABLE_METAL_SPIRV",
91  ]
92  ldflags = [
93    "-weak_framework",
94    "Metal",
95  ]
96}
97
98angle_source_set("angle_metal_backend") {
99  public_configs = [ ":angle_metal_backend_config" ]
100
101  sources = _metal_backend_sources
102
103  cflags = []
104  cflags_cc = []
105  cflags_objc = []
106  cflags_objcc = []
107  ldflags = []
108  libs = []
109
110  public_deps = [
111    "${angle_root}:angle_common",
112    "${angle_root}:angle_glslang_wrapper",
113    "${angle_root}:angle_gpu_info_util",
114    "${angle_root}:angle_image_util",
115    "${angle_root}:libANGLE_headers",
116    "${angle_root}:translator",
117  ]
118
119  deps = [ "${angle_spirv_cross_dir}/gn:spirv_cross_sources" ]
120
121  objc_flags = [
122    "-Wno-nullability-completeness",
123    "-Wno-unguarded-availability",
124    "-fno-objc-arc",
125  ]
126  cflags_objc += objc_flags
127  cflags_objcc += objc_flags
128
129  if (is_mac) {
130    frameworks = [
131      "Cocoa.framework",
132      "IOSurface.framework",
133      "QuartzCore.framework",
134    ]
135  }
136
137  # TODO(hqle): iOS support.
138}
139