diff --git a/CMakeLists.txt b/CMakeLists.txt index c068f7207..6909a24eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,13 +330,17 @@ elseif(SFML_OS_MACOSX) # install the Xcode templates if requested if(SFML_INSTALL_XCODE_TEMPLATES) - configure_file( - "tools/xcode/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist.in" - "${CMAKE_CURRENT_BINARY_DIR}/tools/xcode/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist" - @ONLY) + # configure the templates plist files + foreach(TEMPLATE "SFML Compiler" "SFML App") + configure_file( + "tools/xcode/templates/SFML/${TEMPLATE}.xctemplate/TemplateInfo.plist.in" + "${CMAKE_CURRENT_BINARY_DIR}/tools/xcode/templates/SFML/${TEMPLATE}.xctemplate/TemplateInfo.plist" + @ONLY) + endforeach() install(DIRECTORY "tools/xcode/templates/SFML" "${CMAKE_CURRENT_BINARY_DIR}/tools/xcode/templates/SFML" DESTINATION /Library/Developer/Xcode/Templates - PATTERN "*.in" EXCLUDE) + PATTERN "*.in" EXCLUDE + PATTERN ".DS_Store" EXCLUDE) endif() elseif(SFML_OS_IOS) diff --git a/tools/xcode/templates/SFML/SFML App.xctemplate/TemplateInfo.plist b/tools/xcode/templates/SFML/SFML App.xctemplate/TemplateInfo.plist.in similarity index 88% rename from tools/xcode/templates/SFML/SFML App.xctemplate/TemplateInfo.plist rename to tools/xcode/templates/SFML/SFML App.xctemplate/TemplateInfo.plist.in index 3350596da..fccfa9c52 100644 --- a/tools/xcode/templates/SFML/SFML App.xctemplate/TemplateInfo.plist +++ b/tools/xcode/templates/SFML/SFML App.xctemplate/TemplateInfo.plist.in @@ -145,6 +145,11 @@ subject to the following restrictions: # This shell script simply copies required SFML dylibs/frameworks into the application bundle frameworks folder. # If you're using static libraries (which is not recommended) you should remove this script from your project. +# SETTINGS +CMAKE_INSTALL_FRAMEWORK_PREFIX="@CMAKE_INSTALL_FRAMEWORK_PREFIX@" +CMAKE_INSTALL_LIB_PREFIX="@CMAKE_INSTALL_PREFIX@/lib" +FRAMEWORKS_FULL_PATH="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/" + # Are we building a project that uses frameworks or dylibs? case "$SFML_BINARY_TYPE" in DYLIBS) @@ -166,7 +171,7 @@ assert () # $1 is a boolean, $2...N is an error message { if [ $# -lt 2 ] then - error "Internal error in assert : not enough args" + error "Internal error in assert: not enough args" fi if [ $1 -ne 0 ] @@ -194,7 +199,7 @@ copy () # $1 is a source, $2 is a destination require () # $1 is a SFML module like 'system' or 'audio' { - dest="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Contents/Frameworks" + dest="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/" if [ -z "$1" ] then @@ -207,14 +212,14 @@ require () # $1 is a SFML module like 'system' or 'audio' # copy SFML libraries if [ "$frameworks" = "true" ] then - source="/Library/Frameworks/sfml-$1.framework" + source="$CMAKE_INSTALL_FRAMEWORK_PREFIX/sfml-$1.framework" target="sfml-$1.framework" elif [ "$SFML_LINK_DYLIBS_SUFFIX" = "-d" ] then - source="/usr/local/lib/libsfml-$1-d.dylib" + source="$CMAKE_INSTALL_LIB_PREFIX/libsfml-$1-d.dylib" target="`readlink $source`" else - source="/usr/local/lib/libsfml-$1.dylib" + source="$CMAKE_INSTALL_LIB_PREFIX/libsfml-$1.dylib" target="`readlink $source`" fi @@ -223,12 +228,15 @@ require () # $1 is a SFML module like 'system' or 'audio' # copy extra dependencies if [ "$1" = "audio" ] then - # copy sndfile framework too - copy "/Library/Frameworks/sndfile.framework" "$dest/sndfile.framework" + # copy "FLAC" "ogg" "vorbis" "vorbisenc" "vorbisfile" frameworks too + for f in "FLAC" "ogg" "vorbis" "vorbisenc" "vorbisfile" + do + copy "$CMAKE_INSTALL_FRAMEWORK_PREFIX/$f.framework" "$dest/$f.framework" + done elif [ "$1" = "graphics" ] then # copy freetype framework too - copy "/Library/Frameworks/freetype.framework" "$dest/freetype.framework" + copy "$CMAKE_INSTALL_FRAMEWORK_PREFIX/freetype.framework" "$dest/freetype.framework" fi fi }