本文介绍了将每个.metal文件编译成一个单独的.metallib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想覆盖默认的Xcode Metal编译器行为,即将所有项目.metal文件编译为单个default.metallib,而是将每个.metal文件编译为单独的.metallib文件.

I would like to override the default Xcode Metal compiler behaviour of compiling all project .metal files into a single default.metallib and instead compile each .metal file into a separate .metallib file.

但是我看不到如何解决这个问题;谁能提供线索?

However I cannot see how to approach this; can anyone provide a lead?

Xcode版本:10.1

Xcode version: 10.1

推荐答案

我分两步实现了这一目标:

I achieved this in two steps:

1)为.metal文件添加自定义构建规则,将其分别编译为.metallib s:

1) Add a custom build rule for .metal files that compiles them individually into .metallibs:

2)添加一个自定义构建步骤,以将那些.metallib复制到目标中:

2) Add a custom build step for copying those .metallibs into your target:

这篇关于将每个.metal文件编译成一个单独的.metallib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 03:49