Skip to content

whaison/metal-without-xcode

 
 

Repository files navigation

Metal Programming without Xcode

A simple example of Metal written in Objective-C++ which can be compiled in command-line. result_whaison.png result_whaison2.png

How to pre-compile Metal shaders

Export PATH for Metal compiler

export PATH="$PATH:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin

or

echo 'export PATH="$PATH:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin"' >> ~/.bashrc

Compile

Just run the following command:

make shaders.metallib

or, if you want to do it manually:

Compile .metal file into .air

metal -std=osx-metal1.1 -o shaders.air shaders.metal

Archive .air into .metal-ar

metal-ar r shaders.metal-ar shaders.air

Make .metallib from metal-ar

metallib -o shaders.metallib shaders.metal-ar

Run

cd metal-without-xcode
make
sh main_run.sh

About

A command-line-compilable example of Metal.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C++ 76.7%
  • Metal 12.0%
  • Shell 4.9%
  • Makefile 3.1%
  • C 2.6%
  • Objective-C 0.7%