Metal headers in SPM module

Viewed 139

Migrating Xcode project with metal to SPM and noticed what I can't use metal headers in swift anymore. I can duplicate metal structures in swift, but problem is header files imported by two .metal files. How to make separate module with metal in package to use in main library target? Or there no need to create separate module?

1 Answers

Actually, there are no need to put .metal files into separate module. You just have to write swift structures, that represents metal structures written in headers to use it in swift. Metal normally uses it's headers even in SPM module. Only need to process folder with metal shaders in package config (for example - https://github.com/Arsynth/osmium/blob/main/Package.swift)

Related