Ignore .metal files when creating for iOS Simulator target

Whenever I create a project that includes a metal shader in the x86_64 target (iOS simulator), I get a dependency analysis warning:

warning: no rule to process file '[File Path]/Shaders.metal' of type sourcecode.metal for architecture x86_64

I know this is not a huge problem, but I like to leave my projects free of warnings when building, so when a real problem arises, I actually notice a yellow warning triangle.

Any quick way to get Xcode to ignore metal files for simulator purposes?

+10
source share
2 answers

, .metal Metal .metal .

.metal

.metal , .

bash- CompileMetalLib.sh .metal :

xcrun -sdk iphoneos metal -c MyShader.metal -o MyShader.air
xcrun -sdk iphoneos metallib MyShader.air -o MyShader.metallib
rm MyShader.air

, , chmod +x CompileMetalLib.sh.

MyShader.air - , MyShader.metallib - .

OS X, iphoneos macosx.

.

. :

cd ${SRCROOT}/path/to/folder/containing/yourshader
./CompileMetalLib.sh

, .

, Metal

Metal .

-:

let metalLibPath = Bundle.main.path(forResource: "MyShader", ofType: "metallib")
let myLibrary = try metalDevice.makeLibrary(filepath: metalLibPath)

.metal . . , .metal, x86_64.

+2

Xcode 11, Simulator Metal macOS Catalina. , MacOS Mojave . , . (, iOS 13/tvOS 13 10.15 Metal ).

0

All Articles