mirror of
https://github.com/SFML/SFML.git
synced 2025-01-19 15:55:13 +08:00
Improve Xcode templates post build script : now copy freetype too
Additionally, the script is more robust and can explain what failed.
This commit is contained in:
parent
54bc864484
commit
a674135834
@ -155,35 +155,77 @@ case "$SFML_BINARY_TYPE" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Echoes to stderr
|
||||||
|
error () # $* message to display
|
||||||
|
{
|
||||||
|
echo $* 1>&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
assert () # $1 is a boolean, $2...N is an error message
|
||||||
|
{
|
||||||
|
if [ $# -lt 2 ]
|
||||||
|
then
|
||||||
|
error "Internal error in assert : not enough args"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $1 -ne 0 ]
|
||||||
|
then
|
||||||
|
shift
|
||||||
|
error "$*"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
force_remove () # $1 is a path
|
||||||
|
{
|
||||||
|
test $# -eq 1
|
||||||
|
assert $? "force_remove() requires one parameter"
|
||||||
|
rm -fr "$1"
|
||||||
|
assert $? "couldn't remove $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
copy () # $1 is a source, $2 is a destination
|
||||||
|
{
|
||||||
|
test $# -eq 2
|
||||||
|
assert $? "copy() requires two parameters"
|
||||||
|
ditto "$1" "$2"
|
||||||
|
assert $? "couldn't copy $1 to $2"
|
||||||
|
}
|
||||||
|
|
||||||
require () # $1 is a SFML module like 'system' or 'audio'
|
require () # $1 is a SFML module like 'system' or 'audio'
|
||||||
{
|
{
|
||||||
dest="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Contents/Frameworks"
|
dest="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Contents/Frameworks"
|
||||||
|
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
then
|
then
|
||||||
echo "no parameter! ERROR!"
|
error "require() requires one parameter!"
|
||||||
exit
|
|
||||||
else
|
else
|
||||||
# clean potentially old stuff
|
# clean potentially old stuff
|
||||||
rm -f "$dest/libsfml-$1.2.dylib"
|
force_remove "$dest/libsfml-$1.2.dylib"
|
||||||
rm -f "$dest/libsfml-$1-d.2.dylib"
|
force_remove "$dest/libsfml-$1-d.2.dylib"
|
||||||
rm -fr "$dest/sfml-$1.framework"
|
force_remove "$dest/sfml-$1.framework"
|
||||||
|
|
||||||
# copy SFML libraries
|
# copy SFML libraries
|
||||||
if [ "$frameworks" = "true" ]
|
if [ "$frameworks" = "true" ]
|
||||||
then
|
then
|
||||||
ditto "/Library/Frameworks/sfml-$1.framework" "$dest/sfml-$1.framework"
|
copy "/Library/Frameworks/sfml-$1.framework" "$dest/sfml-$1.framework"
|
||||||
elif [ $CONFIGURATION = "Debug" ] && [ $SFML_LINK_DYLIBS_SUFFIX_DEBUG != "" ]
|
elif [ $CONFIGURATION = "Debug" ] && [ $SFML_LINK_DYLIBS_SUFFIX_DEBUG != "" ]
|
||||||
then
|
then
|
||||||
ditto "/usr/local/lib/libsfml-$1-d.2.dylib" "$dest/libsfml-$1-d.2.dylib"
|
copy "/usr/local/lib/libsfml-$1-d.2.dylib" "$dest/libsfml-$1-d.2.dylib"
|
||||||
else
|
else
|
||||||
ditto "/usr/local/lib/libsfml-$1.2.dylib" "$dest/libsfml-$1.2.dylib"
|
copy "/usr/local/lib/libsfml-$1.2.dylib" "$dest/libsfml-$1.2.dylib"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "audio" ]
|
if [ "$1" = "audio" ]
|
||||||
then
|
then
|
||||||
# copy sndfile framework too
|
# copy sndfile framework too
|
||||||
ditto "/Library/Frameworks/sndfile.framework" "$dest/sndfile.framework"
|
copy "/Library/Frameworks/sndfile.framework" "$dest/sndfile.framework"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "graphics" ]
|
||||||
|
then
|
||||||
|
# copy freetype framework too
|
||||||
|
copy "/Library/Frameworks/freetype.framework" "$dest/freetype.framework"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user