Example code for Metal shaders?

I’m trying to move an Xcode project to CLion and CMake. I’ve got the C/C++ part working, but my build is doing nothing with the Metal shader files.

I found this: metal - Building metallib with CMake - Stack Overflow

I will try to follow that and do something with add_custom_command and add_custom_target.

I’m a beginner with CMake so it may take me a while. If anyone has experience with this or knows where to find some example code, I’d appreciate the pointers.

Here are some repos using CMake to compile Vulkan shaders. Hopefully they are useful as a reference to you.

1 Like