From 78941e415bb2b15a2b1d00db0c6b078a495ccb77 Mon Sep 17 00:00:00 2001 From: Nick Gravelyn Date: Sun, 13 Sep 2020 11:04:22 -0700 Subject: [PATCH] Add Metal shader files as source code Xcode generally puts these in the Resources category so that's what I've done, but I don't know if that's strictly necessary. --- modules/xcode/tests/test_xcode_project.lua | 11 +++++++++++ modules/xcode/xcode_common.lua | 2 ++ 2 files changed, 13 insertions(+) diff --git a/modules/xcode/tests/test_xcode_project.lua b/modules/xcode/tests/test_xcode_project.lua index 97a1ed85..bf775655 100644 --- a/modules/xcode/tests/test_xcode_project.lua +++ b/modules/xcode/tests/test_xcode_project.lua @@ -72,6 +72,17 @@ ]] end + function suite.PBXBuildFile_ListsMetalFileInResources() + files { "source.metal", "Info.plist" } + prepare() + xcode.PBXBuildFile(tr) + test.capture [[ +/* Begin PBXBuildFile section */ + 3873A08432355CF66C345EC4 /* source.metal in Resources */ = {isa = PBXBuildFile; fileRef = 35B2856C7E23699EC2C23BAC /* source.metal */; }; +/* End PBXBuildFile section */ + ]] + end + function suite.PBXBuildFile_ListsResourceFilesOnlyOnceWithGroupID() files { "English.lproj/MainMenu.xib", "French.lproj/MainMenu.xib" } prepare() diff --git a/modules/xcode/xcode_common.lua b/modules/xcode/xcode_common.lua index c29c1964..14116c32 100644 --- a/modules/xcode/xcode_common.lua +++ b/modules/xcode/xcode_common.lua @@ -42,6 +42,7 @@ [".s"] = "Sources", [".S"] = "Sources", [".swift"] = "Sources", + [".metal"] = "Resources", } if node.isResource then return "Resources" @@ -142,6 +143,7 @@ [".wav"] = "audio.wav", [".xcassets"] = "folder.assetcatalog", [".swift"] = "sourcecode.swift", + [".metal"] = "sourcecode.metal", } return types[path.getextension(node.path)] or "text" end