From c35b48bcea7509752368d39afed253bcc61d78ba Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Wed, 11 Sep 2013 23:15:08 +0200 Subject: [PATCH] [iOS] Removed support for examples, it was too much trouble and not as robust as true iOS App Xcode projects --- CMakeLists.txt | 13 ++++++++----- cmake/Macros.cmake | 26 -------------------------- examples/CMakeLists.txt | 12 ++++-------- examples/opengl/CMakeLists.txt | 8 +++----- examples/opengl/OpenGL.cpp | 13 ------------- examples/shader/Shader.cpp | 2 -- examples/window/CMakeLists.txt | 8 +++----- examples/window/Window.cpp | 10 ---------- 8 files changed, 18 insertions(+), 74 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a304bcfc..a7f73576 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,15 +28,18 @@ set(VERSION_PATCH 0) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) # add an option for choosing the build type (shared or static) -if(IOS) - set(BUILD_SHARED_LIBS_DEFAULT FALSE) +if(NOT IOS) + sfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build SFML as shared libraries, FALSE to build it as static libraries") else() - set(BUILD_SHARED_LIBS_DEFAULT TRUE) + set(BUILD_SHARED_LIBS FALSE) endif() -sfml_set_option(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_DEFAULT} BOOL "TRUE to build SFML as shared libraries, FALSE to build it as static libraries") # add an option for building the examples -sfml_set_option(SFML_BUILD_EXAMPLES FALSE BOOL "TRUE to build the SFML examples, FALSE to ignore them") +if(NOT IOS) + sfml_set_option(SFML_BUILD_EXAMPLES FALSE BOOL "TRUE to build the SFML examples, FALSE to ignore them") +else() + set(SFML_BUILD_EXAMPLES FALSE) +endif() # 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") diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index ec80cda4..46a76534 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -216,11 +216,6 @@ macro(sfml_add_example target) if(THIS_GUI_APP AND SFML_OS_WINDOWS) add_executable(${target} WIN32 ${THIS_SOURCES}) target_link_libraries(${target} sfml-main) - elseif(IOS) - add_executable(${target} MACOSX_BUNDLE ${THIS_SOURCES}) - if(THIS_GUI_APP) - target_link_libraries(${target} sfml-main) - endif() else() add_executable(${target} ${THIS_SOURCES}) endif() @@ -245,32 +240,11 @@ macro(sfml_add_example target) target_link_libraries(${target} ${THIS_DEPENDS}) endif() - # enable automatic reference counting on iOS - if (IOS) - set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES) - endif() - - # set mandatory bundle settings on iOS - if(IOS) - set_target_properties(${target} PROPERTIES - MACOSX_BUNDLE_GUI_IDENTIFIER "com.sfml.${target}" - MACOSX_BUNDLE_BUNDLE_NAME "${target}" - MACOSX_BUNDLE_BUNDLE_EXECUTABLE_NAME "${target}" - ) - endif() - # add the install rule install(TARGETS ${target} RUNTIME DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples BUNDLE DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples) - # fix install rules broken in CMake (see http://public.kitware.com/Bug/view.php?id=12506) - if(IOS) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/\$ENV{CONFIGURATION}\$ENV{EFFECTIVE_PLATFORM_NAME}/${target}.app - DESTINATION ${INSTALL_MISC_DIR}/examples/${target} - COMPONENT examples) - endif() - # install the example's source code install(FILES ${THIS_SOURCES} DESTINATION ${INSTALL_MISC_DIR}/examples/${target} diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index b52b5473..16a8711a 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -2,16 +2,12 @@ # add the examples subdirectories add_subdirectory(ftp) add_subdirectory(opengl) -if(NOT IOS) - add_subdirectory(pong) -endif() +add_subdirectory(pong) add_subdirectory(shader) add_subdirectory(sockets) -if(NOT IOS) - add_subdirectory(sound) - add_subdirectory(sound_capture) - add_subdirectory(voip) -endif() +add_subdirectory(sound) +add_subdirectory(sound_capture) +add_subdirectory(voip) add_subdirectory(window) if(SFML_OS_WINDOWS) add_subdirectory(win32) diff --git a/examples/opengl/CMakeLists.txt b/examples/opengl/CMakeLists.txt index 8ab6c9aa..f037488a 100644 --- a/examples/opengl/CMakeLists.txt +++ b/examples/opengl/CMakeLists.txt @@ -5,11 +5,9 @@ set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/opengl) set(SRC ${SRCROOT}/OpenGL.cpp) # find OpenGL and GLU -if(NOT IOS) - find_package(OpenGL REQUIRED) - include_directories(${OPENGL_INCLUDE_DIR}) - set(ADDITIONAL_LIBRARIES ${OPENGL_LIBRARIES}) -endif() +find_package(OpenGL REQUIRED) +include_directories(${OPENGL_INCLUDE_DIR}) +set(ADDITIONAL_LIBRARIES ${OPENGL_LIBRARIES}) # define the opengl target sfml_add_example(opengl GUI_APP diff --git a/examples/opengl/OpenGL.cpp b/examples/opengl/OpenGL.cpp index d655e7c0..639254bc 100644 --- a/examples/opengl/OpenGL.cpp +++ b/examples/opengl/OpenGL.cpp @@ -4,19 +4,6 @@ //////////////////////////////////////////////////////////// #include #include -#include - - -// Some platform-specific stuff -#ifdef SFML_OPENGL_ES - - #define glClearDepth glClearDepthf - #define glFrustum glFrustumf - #define gluBuild2DMipmaps(target, internalFormat, width, height, format, type, pixels) \ - glTexImage2D(target, 0, internalFormat, width, height, 0, format, type, pixels); \ - glGenerateMipmapOES(GL_TEXTURE_2D); - -#endif //////////////////////////////////////////////////////////// diff --git a/examples/shader/Shader.cpp b/examples/shader/Shader.cpp index 3421df8c..95959206 100644 --- a/examples/shader/Shader.cpp +++ b/examples/shader/Shader.cpp @@ -3,8 +3,6 @@ // Headers //////////////////////////////////////////////////////////// #include "Effect.hpp" -#include -#include #include #include diff --git a/examples/window/CMakeLists.txt b/examples/window/CMakeLists.txt index 5f0fa7dc..7ec6b127 100644 --- a/examples/window/CMakeLists.txt +++ b/examples/window/CMakeLists.txt @@ -5,11 +5,9 @@ set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/window) set(SRC ${SRCROOT}/Window.cpp) # find OpenGL and GLU -if(NOT IOS) - find_package(OpenGL REQUIRED) - include_directories(${OPENGL_INCLUDE_DIR}) - set(ADDITIONAL_LIBRARIES ${OPENGL_LIBRARIES}) -endif() +find_package(OpenGL REQUIRED) +include_directories(${OPENGL_INCLUDE_DIR}) +set(ADDITIONAL_LIBRARIES ${OPENGL_LIBRARIES}) # define the window target sfml_add_example(window GUI_APP diff --git a/examples/window/Window.cpp b/examples/window/Window.cpp index 10c3ca2f..360703b4 100644 --- a/examples/window/Window.cpp +++ b/examples/window/Window.cpp @@ -3,16 +3,6 @@ //////////////////////////////////////////////////////////// #include #include -#include - - -// Some platform-specific stuff -#ifdef SFML_OPENGL_ES - - #define glClearDepth glClearDepthf - #define glFrustum glFrustumf - -#endif ////////////////////////////////////////////////////////////