Building a Library with Metal’s Command-Line Tools
- Use the
metal
tool to compile each.metal
file into a single.air
file, which stores an intermediate representation of Metal Shading Language source code. - Optionally, use the
metal-ar
tool to archive several.air
files together into a single.metalar
file. (Themetal-ar
tool is similar to the UNIXar
tool.) - Use the
metallib
tool to build.air
or.metalar
files into a single.metallib
file, which stores the Metal library.
1
2
xcrun -sdk macosx metal -c MyLibrary.metal -o MyLibrary.air
xcrun -sdk macosx metallib MyLibrary.air -o MyLibrary.metallib