Merge pull request #1505 from iKarith/master

Make iOS build GLSL shaders
This commit is contained in:
Twinaphex 2015-03-15 05:33:50 +01:00
commit 6181306e5d
3 changed files with 71 additions and 27 deletions

View File

@ -29,6 +29,7 @@
84F9A9C51A87E1D0003AF12F /* cursors in Resources */ = {isa = PBXBuildFile; fileRef = 84F9A9C41A87E1D0003AF12F /* cursors */; };
84F9A9C71A87E1E8003AF12F /* rdb in Resources */ = {isa = PBXBuildFile; fileRef = 84F9A9C61A87E1E8003AF12F /* rdb */; };
84F9A9C81A87E250003AF12F /* cht in Resources */ = {isa = PBXBuildFile; fileRef = 84F9A9C11A87E180003AF12F /* cht */; };
84FD66AE1AB530B20074AC3A /* shaders_glsl in Resources */ = {isa = PBXBuildFile; fileRef = 84FD66AD1AB530B20074AC3A /* shaders_glsl */; };
96366C5516C9AC3300D64A22 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96366C5416C9AC3300D64A22 /* CoreAudio.framework */; };
96366C5916C9ACF500D64A22 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96366C5816C9ACF500D64A22 /* AudioToolbox.framework */; };
967894631788EBD800D6CA69 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 967894611788EBD800D6CA69 /* InfoPlist.strings */; };
@ -61,6 +62,7 @@
84F9A9C11A87E180003AF12F /* cht */ = {isa = PBXFileReference; lastKnownFileType = folder; name = cht; path = ../../../media/libretrodb/cht; sourceTree = "<group>"; };
84F9A9C41A87E1D0003AF12F /* cursors */ = {isa = PBXFileReference; lastKnownFileType = folder; name = cursors; path = ../../../media/libretrodb/cursors; sourceTree = "<group>"; };
84F9A9C61A87E1E8003AF12F /* rdb */ = {isa = PBXFileReference; lastKnownFileType = folder; name = rdb; path = ../../../media/libretrodb/rdb; sourceTree = "<group>"; };
84FD66AD1AB530B20074AC3A /* shaders_glsl */ = {isa = PBXFileReference; lastKnownFileType = folder; name = shaders_glsl; path = ../../../media/shaders_glsl; sourceTree = "<group>"; };
96366C5416C9AC3300D64A22 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
96366C5816C9ACF500D64A22 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
963C3C33186E3DED00A6EB1E /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
@ -104,6 +106,7 @@
83D632D719ECFCC4009E3161 /* Assets */ = {
isa = PBXGroup;
children = (
84FD66AD1AB530B20074AC3A /* shaders_glsl */,
84F9A9C31A87E1AA003AF12F /* Database */,
83EB675F19EEAF050096F441 /* modules */,
84F9A9BB1A87E068003AF12F /* assets */,
@ -235,6 +238,7 @@
buildPhases = (
96AFAE2116C1D4EA009DE44C /* Sources */,
96AFAE2216C1D4EA009DE44C /* Frameworks */,
84FD66AC1AB520100074AC3A /* ShellScript */,
96AFAE2316C1D4EA009DE44C /* Resources */,
);
buildRules = (
@ -282,6 +286,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
84FD66AE1AB530B20074AC3A /* shaders_glsl in Resources */,
83D632E219ECFCC4009E3161 /* ic_pause.png in Resources */,
967894631788EBD800D6CA69 /* InfoPlist.strings in Resources */,
69D31DE41A547EC800EF4C92 /* Media.xcassets in Resources */,
@ -298,6 +303,22 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
84FD66AC1AB520100074AC3A /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd ../..\n\necho \"=== GLSL shaders\"\nmkdir -p \"media/shaders_glsl\"\nfor a in \"python3.4\" \"python3.3\" \"python3.2\" \"python3.1\" \"python3\" \"python\"; do\n echo -n \"Checking for $a... \"\n if command -v $a > /dev/null; then\n echo \"yes.\"\n make -f Makefile.griffin PYTHON3=$a shaders-convert-glsl\n break\n else\n echo \"no.\"\n fi\ndone";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
96AFAE2116C1D4EA009DE44C /* Sources */ = {
isa = PBXSourcesBuildPhase;

View File

@ -1,58 +1,77 @@
#! /usr/bin/env bash
# vim: set ts=3 sw=3 noet ft=sh : bash
# TODO: This entire script _should_ be replaced with git submodules, but
# that cannot be done until we sort out the limitations of that option. At
# this time, this script is called by libretro-super. Revisit the whole
# issue at some point.
SCRIPT="${0#./}"
BASE_DIR="${SCRIPT%/*}"
WORKDIR=$(pwd)
WORKDIR="$PWD"
if [ "$BASE_DIR" = "$SCRIPT" ]; then
BASE_DIR="$WORKDIR"
else
BASE_DIR="$WORKDIR/$BASE_DIR"
if [[ "$0" != /* ]]; then
# Make the path absolute
BASE_DIR="$WORKDIR/$BASE_DIR"
fi
fi
WORKDIR=$(pwd)
# Inserted here is libretro-super's script-modules/fetch-rules.sh, with a
# couple of features related to core submodules removed from fetch_git. If
# that file is changed, it should be safe to import it verbatim.
### START OF FETCH-RULES.SH (with mods)
# A stripped-down version of the fetch_git rule from libretro-super
# Clones or pulls updates from a git repository into a local directory
# fetch_git: Clones or pulls updates from a git repository into a local directory
#
# $1 The URI to fetch
# $2 The local directory to fetch to (relative)
#
# NOTE: git _now_ has a -C argument that would replace the cd commands in
# this rule, but this is a fairly recent addition to git, so we can't
# use it here. --iKarith
fetch_git() {
fetch_dir="$WORKDIR/$2"
if [ -d "$fetch_dir/.git" ]; then
echo "cd \"$fetch_dir\""
cd "$fetch_dir"
echo git pull
echo "git pull"
git pull
else
echo "git clone \"$1\" \"$fetch_dir\""
git clone "$1" "$fetch_dir"
clone_type=
[ -n "$SHALLOW_CLONE" ] && depth="--depth 1"
echo "git clone $depth \"$1\" \"$WORKDIR/$2\""
git clone $depth "$1" "$WORKDIR/$2"
fi
}
# fetch_revision_git: Output the hash of the last commit in a git repository
#
# $1 Local directory to run git in
fetch_revision_git() {
[ -n "$1" ] && cd "$1"
git log -n 1 --pretty=format:%H
}
# fetch_revision: Output SCM-dependent revision string of a module
# (currently just calls fetch_revision_git)
#
# $1 The directory of the module
fetch_revision() {
fetch_revision_git $1
}
### END OF FETCH-RULES.SH
echo "Fetching RetroArch's submodules..."
fetch_git "https://github.com/libretro/common-shaders.git" "media/shaders_cg"
fetch_git "https://github.com/libretro/common-overlays.git" "media/overlays"
fetch_git "https://github.com/libretro/retroarch-assets.git" "media/assets"
fetch_git "https://github.com/libretro/retroarch-joypad-autoconfig.git" "media/autoconfig"
fetch_git "https://github.com/libretro/libretro-database.git" "media/libretrodb"
# FIXME: This entire script should be unnecessary. It exists because we don't
# use git submodules in libretro/RetroArch, which introduces one of three
# possible build dependencies:
#
# 1. The user is using libretro-super. But libretro-super is not supposed to
# be required because "no dependencies!"
#
# 2. Unreasonable expectations of the user: That they are deeply versed in the
# changing inner workings of a massively-multi-platform project with dozens
# of modules and submodules, or that they are somehow psychic.
#
# 3. The user has a script which cannot depend on libretro-super to fetch the
# submodules for them. This is it.
#
# The third choice is the path of least resistance, but the correct solution
# is to fix the submodules issue.

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
"""
Python 3 script which converts simple RetroArch Cg shaders to modern GLSL (ES) format.
@ -7,6 +7,10 @@ License: Public domain
"""
import sys
if sys.version_info<(3,0,0):
sys.stderr.write("You need python 3.0 or later to run this script\n")
exit(1)
import os
import errno
import subprocess