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) 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 "DisplayMtl.h", 20 "DisplayMtl.mm", 21 "DisplayMtl_api.h", 22 "FrameBufferMtl.h", 23 "FrameBufferMtl.mm", 24 "ProgramMtl.h", 25 "ProgramMtl.mm", 26 "RenderBufferMtl.h", 27 "RenderBufferMtl.mm", 28 "RenderTargetMtl.h", 29 "RenderTargetMtl.mm", 30 "ShaderMtl.h", 31 "ShaderMtl.mm", 32 "SurfaceMtl.h", 33 "SurfaceMtl.mm", 34 "TextureMtl.h", 35 "TextureMtl.mm", 36 "VertexArrayMtl.h", 37 "VertexArrayMtl.mm", 38 "mtl_buffer_pool.h", 39 "mtl_buffer_pool.mm", 40 "mtl_command_buffer.h", 41 "mtl_command_buffer.mm", 42 "mtl_common.h", 43 "mtl_common.mm", 44 "mtl_format_table_autogen.mm", 45 "mtl_format_utils.h", 46 "mtl_format_utils.mm", 47 "mtl_glslang_utils.h", 48 "mtl_glslang_utils.mm", 49 "mtl_render_utils.h", 50 "mtl_render_utils.mm", 51 "mtl_resources.h", 52 "mtl_resources.mm", 53 "mtl_state_cache.h", 54 "mtl_state_cache.mm", 55 "mtl_utils.h", 56 "mtl_utils.mm", 57 "shaders/compiled/mtl_default_shaders.inc", 58 "shaders/mtl_default_shaders_src_autogen.inc", 59] 60 61config("angle_metal_backend_config") { 62 defines = [ "ANGLE_ENABLE_METAL" ] 63 ldflags = [ 64 "-weak_framework", 65 "Metal", 66 ] 67} 68 69angle_source_set("angle_metal_backend") { 70 public_configs = [ ":angle_metal_backend_config" ] 71 72 sources = _metal_backend_sources 73 74 cflags = [] 75 cflags_cc = [] 76 cflags_objc = [] 77 cflags_objcc = [] 78 ldflags = [] 79 libs = [] 80 81 public_deps = [ 82 "${angle_root}:angle_glslang_wrapper", 83 "${angle_root}:libANGLE_headers", 84 ] 85 86 deps = [ "${angle_spirv_cross_dir}/gn:spirv_cross_sources" ] 87 88 objc_flags = [ 89 "-Wno-nullability-completeness", 90 "-Wno-unguarded-availability", 91 "-fno-objc-arc", 92 ] 93 cflags_objc += objc_flags 94 cflags_objcc += objc_flags 95 96 if (is_mac) { 97 libs += [ 98 "Cocoa.framework", 99 "IOSurface.framework", 100 "QuartzCore.framework", 101 ] 102 } 103 104 # TODO(hqle): iOS support. 105} 106