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
icculus@11729
     1
#!/bin/bash
icculus@11729
     2
icculus@11729
     3
set -x
icculus@11729
     4
set -e
slouken@11730
     5
cd `dirname "$0"`
icculus@11729
     6
slouken@11730
     7
generate_shaders()
slouken@11730
     8
{
slouken@11730
     9
    platform=$1
slouken@11730
    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 $?
slouken@11730
    11
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air || exit $?
slouken@11730
    12
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar || exit $?
slouken@11730
    13
    xxd -i sdl.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal_$platform.h
slouken@11730
    14
    rm -f sdl.air sdl.metalar sdl.metallib
slouken@11730
    15
}
icculus@11729
    16
slouken@11730
    17
generate_shaders osx
slouken@11730
    18
generate_shaders ios