From 19012c66ea40cda064bfc158a5cac7eabd21280d Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Tue, 15 Apr 2014 18:44:55 +0200 Subject: [PATCH] Updated Xcode templates and cmake script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What's new in the templates: - Removed support for 32 bits and gcc - Removed useless code - Removed custom warnings settings – let Xcode decide with its default values - Set default target version to CMAKE_OSX_DEPLOYMENT_TARGET What's new in cmake script: - Added cmake options for archs and deployment target - Added minimum requirements checking --- CMakeLists.txt | 28 +++- cmake/Config.cmake | 2 +- ...mplateInfo.plist => TemplateInfo.plist.in} | 126 ++---------------- tools/xcode/templates/readme.txt | 6 +- 4 files changed, 37 insertions(+), 125 deletions(-) rename tools/xcode/templates/SFML/SFML Compiler.xctemplate/{TemplateInfo.plist => TemplateInfo.plist.in} (56%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 336b79ed4..f81718bc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,12 @@ sfml_set_option(SFML_BUILD_EXAMPLES FALSE BOOL "TRUE to build the SFML examples, # add an option for building the API documentation sfml_set_option(SFML_BUILD_DOC FALSE BOOL "TRUE to generate the API documentation, FALSE to ignore it") +# set default CMAKE_OSX_ARCHITECTURES value to x86_64 +sfml_set_option(CMAKE_OSX_ARCHITECTURES "x86_64" STRING "Build architectures for OS X") + +# set default CMAKE_OSX_DEPLOYMENT_TARGET value to 10.7 +sfml_set_option(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" STRING "Minimum OS version to target for deployment (at runtime)") + # Mac OS X specific options if(SFML_OS_MACOSX) # add an option to build frameworks instead of dylibs (release only) @@ -107,6 +113,12 @@ if(SFML_OS_MACOSX) message(FATAL_ERROR "CMAKE_OSX_ARCHITECTURES should be 'x86_64' to support ARC") return() endif() + + # make sure CMAKE_OSX_DEPLOYMENT_TARGET is >= 10.7 + if (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.7") + message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET (${CMAKE_OSX_DEPLOYMENT_TARGET}) should be 10.7 or better") + return() + endif() endif() if(SFML_OS_LINUX OR SFML_OS_FREEBSD) @@ -118,8 +130,8 @@ if(SFML_OS_LINUX OR SFML_OS_FREEBSD) "tools/pkg-config/sfml-${sfml_module}.pc.in" "tools/pkg-config/sfml-${sfml_module}.pc" @ONLY) - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc" - DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig") + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc" + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig") endforeach() endif() else() @@ -180,8 +192,8 @@ else() POST_BUILD COMMAND cp -r ${PROJECT_SOURCE_DIR}/include/SFML/* SFML.framework/Versions/${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}/Headers) - # adapt install directory to allow distributing dylibs/frameworks in user’s frameworks/application bundle - # NOTE : it's not required to link agains SFML.framework + # adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle + # NOTE : it's not required to link against SFML.framework set_target_properties(SFML PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@executable_path/../Frameworks") @@ -218,6 +230,12 @@ elseif(SFML_OS_MACOSX) install(DIRECTORY extlibs/libs-osx/Frameworks/freetype.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) if(SFML_INSTALL_XCODE4_TEMPLATES) - install(DIRECTORY tools/xcode/templates/SFML DESTINATION /Library/Developer/Xcode/Templates) + install(DIRECTORY tools/xcode/templates/SFML + DESTINATION /Library/Developer/Xcode/Templates + PATTERN "*.in" EXCLUDE) + configure_file( + "tools/xcode/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist.in" + "/Library/Developer/Xcode/Templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist" + @ONLY) endif() endif() diff --git a/cmake/Config.cmake b/cmake/Config.cmake index de6efde9d..cb5e72ba8 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -24,7 +24,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW) STRING(REGEX REPLACE "10\\.([0-9]).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}") if(${MACOSX_VERSION} LESS 7) - message(FATAL_ERROR "Unsupported version of OS X : ${MACOSX_VERSION_RAW}") + message(FATAL_ERROR "Unsupported version of OS X: ${MACOSX_VERSION_RAW}") return() endif() else() diff --git a/tools/xcode/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist b/tools/xcode/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist.in similarity index 56% rename from tools/xcode/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist rename to tools/xcode/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist.in index dc667c625..30782842f 100644 --- a/tools/xcode/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist +++ b/tools/xcode/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist.in @@ -27,9 +27,10 @@ subject to the following restrictions: @@ -69,32 +70,6 @@ subject to the following restrictions: Units - - C++98 with GCC and libstdc++ and target 10.5 - - Project - - SharedSettings - - GCC_VERSION - com.apple.compilers.llvmgcc42 - - MACOSX_DEPLOYMENT_TARGET - 10.5 - - - - Targets - - - Frameworks - - Foundation - - - - - C++98 with Clang and libstdc++ @@ -135,67 +110,6 @@ subject to the following restrictions: - - Identifier - archType - - Name - [ADVANCED] Architectures - - Description - Choose which architecture(s) you want to support - - Default - Universal - - NotPersisted - - - Type - popup - - Units - - - Universal - - Project - - SharedSettings - - ARCHS - $(ARCHS_STANDARD_32_64_BIT) - - - - - - 64 bits - - Project - - SharedSettings - - ARCHS - $(ARCHS_STANDARD_64_BIT) - - - - - - 32 bits - - Project - - SharedSettings - - ARCHS - $(ARCHS_STANDARD_32_BIT) - - - - - SUPPORTED_PLATFORMS macosx - - - GCC_WARN_ABOUT_RETURN_TYPE - YES - GCC_WARN_UNINITIALIZED_AUTOS - YES - GCC_WARN_UNUSED_VARIABLE - YES - CLANG_WARN__DUPLICATE_METHOD_MATCH - YES - CLANG_WARN_EMPTY_BODY - YES + + ARCHS + $(ARCHS_STANDARD_64_BIT) + + + MACOSX_DEPLOYMENT_TARGET + @CMAKE_OSX_DEPLOYMENT_TARGET@ FRAMEWORK_SEARCH_PATHS @@ -237,25 +146,10 @@ subject to the following restrictions: Debug - GCC_OPTIMIZATION_LEVEL - 0 - - GCC_PREPROCESSOR_DEFINITIONS - DEBUG=1 $(inherited) - - - ONLY_ACTIVE_ARCH - NO Release - COPY_PHASE_STRIP - YES - - - ONLY_ACTIVE_ARCH - NO diff --git a/tools/xcode/templates/readme.txt b/tools/xcode/templates/readme.txt index 23f6eee01..2b1564056 100644 --- a/tools/xcode/templates/readme.txt +++ b/tools/xcode/templates/readme.txt @@ -38,7 +38,7 @@ Before installing the template, make sure you have installed: - Xcode 4 or Xcode 5, up to date - Installed Xcode's Command Line Tools - - SFML 2, either as framework or dylibs binaries + - SFML 2, either framework or dylib binaries There is one constraint on the installation of SFML: the frameworks needs to be installed in /Library/Frameworks and the dylibs into /usr/local/lib. You don't need both but make sure they are in the correct folder. @@ -71,8 +71,8 @@ Note : some settings are marked as "[ADVANCED]" in the wizard. If you're not sur -Question & Answer ------------------ +FAQ +--- * I want to use Xcode 3. Can I use these templates anyway?