Updated Xcode templates and cmake script

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
This commit is contained in:
Marco Antognini 2014-04-15 18:44:55 +02:00
parent 0a5f38157f
commit 19012c66ea
4 changed files with 37 additions and 125 deletions

View File

@ -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 # 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") 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 # Mac OS X specific options
if(SFML_OS_MACOSX) if(SFML_OS_MACOSX)
# add an option to build frameworks instead of dylibs (release only) # 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") message(FATAL_ERROR "CMAKE_OSX_ARCHITECTURES should be 'x86_64' to support ARC")
return() return()
endif() 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() endif()
if(SFML_OS_LINUX OR SFML_OS_FREEBSD) 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.in"
"tools/pkg-config/sfml-${sfml_module}.pc" "tools/pkg-config/sfml-${sfml_module}.pc"
@ONLY) @ONLY)
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc" INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig") DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig")
endforeach() endforeach()
endif() endif()
else() else()
@ -180,8 +192,8 @@ else()
POST_BUILD POST_BUILD
COMMAND cp -r ${PROJECT_SOURCE_DIR}/include/SFML/* SFML.framework/Versions/${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}/Headers) 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 users frameworks/application bundle # adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle
# NOTE : it's not required to link agains SFML.framework # NOTE : it's not required to link against SFML.framework
set_target_properties(SFML PROPERTIES set_target_properties(SFML PROPERTIES
BUILD_WITH_INSTALL_RPATH 1 BUILD_WITH_INSTALL_RPATH 1
INSTALL_NAME_DIR "@executable_path/../Frameworks") 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}) install(DIRECTORY extlibs/libs-osx/Frameworks/freetype.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
if(SFML_INSTALL_XCODE4_TEMPLATES) 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()
endif() endif()

View File

@ -24,7 +24,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW) 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}") STRING(REGEX REPLACE "10\\.([0-9]).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}")
if(${MACOSX_VERSION} LESS 7) 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() return()
endif() endif()
else() else()

View File

@ -27,9 +27,10 @@ subject to the following restrictions:
<!-- <!--
This template defines : This template defines :
- the compiler & std lib - the compiler & std lib
- the supported arch - the supported arch (only 64 bit)
- some other target's settings (e.g. warnings flags) - some other target's settings (e.g. warnings flags)
- the search paths - the search paths
- deployment target (according to CMake build settings)
--> -->
<plist version="1.0"> <plist version="1.0">
@ -69,32 +70,6 @@ subject to the following restrictions:
<key>Units</key> <key>Units</key>
<dict> <dict>
<!-- Use GCC and libstdc++ -->
<key>C++98 with GCC and libstdc++ and target 10.5</key>
<dict>
<key>Project</key>
<dict>
<key>SharedSettings</key>
<dict>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvmgcc42</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.5</string>
</dict>
</dict>
<key>Targets</key>
<array>
<dict>
<key>Frameworks</key>
<array>
<string>Foundation</string>
</array>
</dict>
</array>
</dict>
<!-- Use Clang and libstdc++ --> <!-- Use Clang and libstdc++ -->
<key>C++98 with Clang and libstdc++</key> <key>C++98 with Clang and libstdc++</key>
<dict> <dict>
@ -135,67 +110,6 @@ subject to the following restrictions:
</dict> </dict>
</dict> </dict>
<dict>
<key>Identifier</key>
<string>archType</string>
<key>Name</key>
<string>[ADVANCED] Architectures</string>
<key>Description</key>
<string>Choose which architecture(s) you want to support</string>
<key>Default</key>
<string>Universal</string>
<key>NotPersisted</key>
<true />
<key>Type</key>
<string>popup</string>
<key>Units</key>
<dict>
<!-- Support 32 + 64 bits -->
<key>Universal</key>
<dict>
<key>Project</key>
<dict>
<key>SharedSettings</key>
<dict>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_64_BIT)</string>
</dict>
</dict>
</dict>
<!-- Support 64 bits -->
<key>64 bits</key>
<dict>
<key>Project</key>
<dict>
<key>SharedSettings</key>
<dict>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
</dict>
</dict>
</dict>
<!-- Support 32 bits -->
<key>32 bits</key>
<dict>
<key>Project</key>
<dict>
<key>SharedSettings</key>
<dict>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
</dict>
</dict>
</dict>
</dict>
</dict>
</array> </array>
<!-- <!--
@ -204,23 +118,18 @@ subject to the following restrictions:
<key>Project</key> <key>Project</key>
<dict> <dict>
<key>SharedSettings</key> <key>SharedSettings</key>
<dict <dict>
<!-- PLATFORM --> <!-- PLATFORM -->
<key>SUPPORTED_PLATFORMS</key> <key>SUPPORTED_PLATFORMS</key>
<string>macosx</string> <string>macosx</string>
<!-- WARNINGS --> <!-- ARCHITECTURES: only 64 bit -->
<!-- TODO add more warnings --> <key>ARCHS</key>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key> <string>$(ARCHS_STANDARD_64_BIT)</string>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key> <!-- DEPLOYMENT -->
<string>YES</string> <key>MACOSX_DEPLOYMENT_TARGET</key>
<key>GCC_WARN_UNUSED_VARIABLE</key> <string>@CMAKE_OSX_DEPLOYMENT_TARGET@</string>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<!-- SERACH PATHS --> <!-- SERACH PATHS -->
<key>FRAMEWORK_SEARCH_PATHS</key> <key>FRAMEWORK_SEARCH_PATHS</key>
@ -237,25 +146,10 @@ subject to the following restrictions:
<dict> <dict>
<key>Debug</key> <key>Debug</key>
<dict> <dict>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<string>DEBUG=1 $(inherited)</string>
<!-- ALWAYS compile for all arch. -->
<key>ONLY_ACTIVE_ARCH</key>
<string>NO</string>
</dict> </dict>
<key>Release</key> <key>Release</key>
<dict> <dict>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<!-- ALWAYS compile for all arch. -->
<key>ONLY_ACTIVE_ARCH</key>
<string>NO</string>
</dict> </dict>
</dict> </dict>
</dict> </dict>

View File

@ -38,7 +38,7 @@ Before installing the template, make sure you have installed:
- Xcode 4 or Xcode 5, up to date - Xcode 4 or Xcode 5, up to date
- Installed Xcode's Command Line Tools - 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. 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? * I want to use Xcode 3. Can I use these templates anyway?