Use command-line tools to run the Metal compiler toolchain.
Manually compiling Metal Shading Language source code and building a Metal library without using Xcode involves the following process:
metaltool to compile each
.metalfile into a single
.airfile, which stores an intermediate representation of Metal Shading Language source code.
Optionally, use the
metal-artool to archive several
.airfiles together into a single
metal-artool is similar to the UNIX
metallibtool to build
.metalarfiles into a single
.metallibfile, which stores the Metal library.
Run Metal's Command-Line Tools
The following code shows the minimum number of commands that you need to compile and build a single
.metal file into a single
.metallib file. You can run these commands in the Terminal app and use the
-help command to display the available options for each Metal tool. This example uses the
macosx SDK, but you can use the
appletvos SDK instead.