| # Copyright 2019 The ANGLE Project Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| # |
| # This file houses the build configuration for the ANGLE Metal back-end. |
| |
| import("../../../../gni/angle.gni") |
| |
| assert(is_mac || is_ios) |
| assert(angle_enable_metal) |
| |
| _metal_backend_sources = [ |
| "BufferMtl.h", |
| "BufferMtl.mm", |
| "CompilerMtl.h", |
| "CompilerMtl.mm", |
| "ContextMtl.h", |
| "ContextMtl.mm", |
| "DeviceMtl.h", |
| "DeviceMtl.mm", |
| "DisplayMtl.h", |
| "DisplayMtl.mm", |
| "DisplayMtl_api.h", |
| "FrameBufferMtl.h", |
| "FrameBufferMtl.mm", |
| "IOSurfaceSurfaceMtl.h", |
| "IOSurfaceSurfaceMtl.mm", |
| "ImageMtl.h", |
| "ImageMtl.mm", |
| "ProgramMtl.h", |
| "ProgramMtl.mm", |
| "ProvokingVertexHelper.h", |
| "ProvokingVertexHelper.mm", |
| "QueryMtl.h", |
| "QueryMtl.mm", |
| "RenderBufferMtl.h", |
| "RenderBufferMtl.mm", |
| "RenderTargetMtl.h", |
| "RenderTargetMtl.mm", |
| "SamplerMtl.h", |
| "SamplerMtl.mm", |
| "ShaderMtl.h", |
| "ShaderMtl.mm", |
| "SurfaceMtl.h", |
| "SurfaceMtl.mm", |
| "SyncMtl.h", |
| "SyncMtl.mm", |
| "TextureMtl.h", |
| "TextureMtl.mm", |
| "TransformFeedbackMtl.h", |
| "TransformFeedbackMtl.mm", |
| "VertexArrayMtl.h", |
| "VertexArrayMtl.mm", |
| "mtl_buffer_manager.h", |
| "mtl_buffer_manager.mm", |
| "mtl_buffer_pool.h", |
| "mtl_buffer_pool.mm", |
| "mtl_command_buffer.h", |
| "mtl_command_buffer.mm", |
| "mtl_common.h", |
| "mtl_common.mm", |
| "mtl_context_device.h", |
| "mtl_context_device.mm", |
| "mtl_default_shaders_compiled.inc", |
| "mtl_format_table_autogen.mm", |
| "mtl_format_utils.h", |
| "mtl_format_utils.mm", |
| "mtl_glslang_mtl_utils.h", |
| "mtl_glslang_mtl_utils.mm", |
| "mtl_occlusion_query_pool.h", |
| "mtl_occlusion_query_pool.mm", |
| "mtl_render_utils.h", |
| "mtl_render_utils.mm", |
| "mtl_resource_spi.h", |
| "mtl_resources.h", |
| "mtl_resources.mm", |
| "mtl_state_cache.h", |
| "mtl_state_cache.mm", |
| "mtl_utils.h", |
| "mtl_utils.mm", |
| "shaders/constants.h", |
| "shaders/format_autogen.h", |
| "shaders/mtl_default_shaders_src_autogen.inc", |
| "shaders/rewrite_indices_shared.h", |
| ] |
| |
| config("angle_metal_spirv_backend_config") { |
| defines = [ "ANGLE_ENABLE_METAL_SPIRV" ] |
| } |
| |
| config("angle_metal_backend_config") { |
| defines = [ "ANGLE_ENABLE_METAL" ] |
| ldflags = [ |
| "-weak_framework", |
| "Metal", |
| ] |
| } |
| |
| angle_source_set("angle_metal_backend") { |
| public_configs = [ ":angle_metal_backend_config" ] |
| |
| sources = _metal_backend_sources |
| |
| cflags = [] |
| cflags_cc = [] |
| cflags_objc = [] |
| cflags_objcc = [] |
| ldflags = [] |
| libs = [] |
| |
| public_deps = [ |
| "${angle_root}:angle_common", |
| "${angle_root}:angle_glslang_wrapper", |
| "${angle_root}:angle_gpu_info_util", |
| "${angle_root}:angle_image_util", |
| "${angle_root}:libANGLE_headers", |
| "${angle_root}:translator", |
| ] |
| |
| if (angle_enable_msl_through_spirv) { |
| public_configs += [ ":angle_metal_spirv_backend_config" ] |
| deps = [ "${angle_spirv_cross_dir}/gn:spirv_cross_sources" ] |
| sources += [ |
| "mtl_glslang_utils.h", |
| "mtl_glslang_utils.mm", |
| ] |
| } |
| |
| objc_flags = [ |
| "-Wno-nullability-completeness", |
| "-Wno-unguarded-availability", |
| "-fno-objc-arc", |
| ] |
| cflags_objc += objc_flags |
| cflags_objcc += objc_flags |
| |
| if (is_mac) { |
| frameworks = [ |
| "Cocoa.framework", |
| "IOSurface.framework", |
| "QuartzCore.framework", |
| ] |
| } |
| |
| # TODO(hqle): iOS support. |
| } |