This will need to be a co-op with Xcode probably, but we need a way of having SPM correctly handle .ci.metal (Core Image metal files). They need to be treated slightly different than normal .metal files and must be compiled with correct Metal compiler and linker flags. Happy to provide examples if necessary.
Any update on this ?
Yes, this would be a much-needed addition to be able to ship custom CI kernels with a package. Even the new
[[stitchable]] kernels (see WWDC21-10159) require a custom Metal linker flag which can't be set in a package.
I found that it is possible to compile Core Image kernels via
BuildToolPlugin. However, it seems one can't prevent SPM from also compiling the
.metal files with the default build rules (as outlined in this post).
Hi Frank. Would you mind sharing your build tool plugin for compiling Core Image Metal kernels? It would be cool to be able to re-use a common tool rather than build my own.
Hi Michael. I only did a local prototype so far to figure out if it is possible. And I stopped when I ran into the issue mentioned above. If you know how to solve it, please let me know!
I will probably look into this again soonish and will let you know when I found a solution.
Thanks for the info. I misunderstood your previous comment about SPM building
.metal files with the default build tools. I thought that was merely a nuisance. I didn't know that was actually interfering with the proper operation of a Core Image build tool. Let's hope the SPM people take up your idea of preventing the default build operation. They seem open to the idea.