src/render/metal/build-metal-shaders.sh
author Sam Lantinga <slouken@libsdl.org>
Thu, 07 Dec 2017 16:08:09 -0800
changeset 11730 ac6c607e065c
parent 11729 d1ce8396c356
child 13016 e25b2c6a8155
permissions -rwxr-xr-x
Enable building the Metal renderer by default, and weak link the Metal framework so the SDL library is safe to use on older Macs
Also generate iOS versions of the Metal shaders
     1 #!/bin/bash
     2 
     3 set -x
     4 set -e
     5 cd `dirname "$0"`
     6 
     7 generate_shaders()
     8 {
     9     platform=$1
    10     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal -std=$platform-metal1.1 -Wall -O3 -o ./sdl.air ./SDL_shaders_metal.metal || exit $?
    11     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air || exit $?
    12     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar || exit $?
    13     xxd -i sdl.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal_$platform.h
    14     rm -f sdl.air sdl.metalar sdl.metallib
    15 }
    16 
    17 generate_shaders osx
    18 generate_shaders ios