Swift Package with Core Image .ci.metal resources

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.

1 Like

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.

1 Like

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.

Cheers.

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.

1 Like

Hi Frank,

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. :slight_smile:

Cheers.

1 Like