[CMake] Apple Metal Support in Xcode?

Marek Vojtko (Firaxis) Marek.Vojtko at firaxis.com
Tue Apr 28 19:25:04 EDT 2015


Hi,

I'm trying to get Apple's new shading language, Metal, to work with my CMake project, but I am not having any luck.

Xcode will automagically compile .metal files that are part of the project, but their Type (in the File Inspector in the right-hand Utilities pane) has to be set to "Default - Metal Shader Source File." 

When I add .metal files via CMake they are a) not listed in the project's Compile Sources list (in the Target's Build Phases tab), and b) their Type is set to "Source File". A) can be solved by adding source file properties (e.g. compile flags) to the .metal file in CMake, but I haven't been able to change the Type of the .metal files through CMake.

I have seen a commit log  [0] about "Add[ing] file type for Metal shader files," but that change doesn't seem to have made it to the released CMake version yet. 

My questions:
1) Is there anything I can do right now (with CMake 3.2.2.) that would make Xcode handle .metal files correctly?
2) Are there plans to support .metal files via CMake and if so, how far along are they?

Thanks,

[0] http://www.cmake.org/pipermail/cmake-commits/2015-April/022952.html
--
Marek Vojtko
mail: marek.vojtko at firaxis.com
phone: (+1) 410-229-2519



More information about the CMake mailing list