Adapted the examples for iOS (WIP)

This commit is contained in:
Laurent Gomila 2013-08-26 09:17:53 +02:00 committed by Jonathan De Wachter
parent cefb4fcee0
commit 4e8e1629d1
6 changed files with 49 additions and 11 deletions

View File

@ -268,6 +268,8 @@ macro(sfml_add_example target)
if(THIS_GUI_APP AND SFML_OS_WINDOWS) if(THIS_GUI_APP AND SFML_OS_WINDOWS)
add_executable(${target} WIN32 ${THIS_SOURCES}) add_executable(${target} WIN32 ${THIS_SOURCES})
target_link_libraries(${target} sfml-main) target_link_libraries(${target} sfml-main)
elseif(IOS)
add_executable(${target} MACOSX_BUNDLE ${THIS_SOURCES})
else() else()
add_executable(${target} ${THIS_SOURCES}) add_executable(${target} ${THIS_SOURCES})
endif() endif()
@ -299,7 +301,8 @@ macro(sfml_add_example target)
# add the install rule # add the install rule
install(TARGETS ${target} install(TARGETS ${target}
RUNTIME DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples) RUNTIME DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples
BUNDLE DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples)
# install the example's source code # install the example's source code
install(FILES ${THIS_SOURCES} install(FILES ${THIS_SOURCES}

View File

@ -2,12 +2,16 @@
# add the examples subdirectories # add the examples subdirectories
add_subdirectory(ftp) add_subdirectory(ftp)
add_subdirectory(opengl) add_subdirectory(opengl)
add_subdirectory(pong) if(NOT IOS)
add_subdirectory(pong)
endif()
add_subdirectory(shader) add_subdirectory(shader)
add_subdirectory(sockets) add_subdirectory(sockets)
add_subdirectory(sound) if(NOT IOS)
add_subdirectory(sound_capture) add_subdirectory(sound)
add_subdirectory(voip) add_subdirectory(sound_capture)
add_subdirectory(voip)
endif()
add_subdirectory(window) add_subdirectory(window)
if(SFML_OS_WINDOWS) if(SFML_OS_WINDOWS)
add_subdirectory(win32) add_subdirectory(win32)

View File

@ -5,10 +5,15 @@ set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/opengl)
set(SRC ${SRCROOT}/OpenGL.cpp) set(SRC ${SRCROOT}/OpenGL.cpp)
# find OpenGL and GLU # find OpenGL and GLU
find_package(OpenGL REQUIRED) if(NOT IOS)
include_directories(${OPENGL_INCLUDE_DIR}) find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
set(ADDITIONAL_LIBRARIES ${OPENGL_LIBRARIES})
else()
set(ADDITIONAL_LIBRARIES -framework OpenGLES)
endif()
# define the opengl target # define the opengl target
sfml_add_example(opengl GUI_APP sfml_add_example(opengl GUI_APP
SOURCES ${SRC} SOURCES ${SRC}
DEPENDS sfml-graphics sfml-window sfml-system ${OPENGL_LIBRARIES}) DEPENDS sfml-graphics sfml-window sfml-system ${ADDITIONAL_LIBRARIES})

View File

@ -6,6 +6,18 @@
#include <SFML/OpenGL.hpp> #include <SFML/OpenGL.hpp>
// 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
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// Entry point of application /// Entry point of application
/// ///

View File

@ -5,10 +5,15 @@ set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/window)
set(SRC ${SRCROOT}/Window.cpp) set(SRC ${SRCROOT}/Window.cpp)
# find OpenGL and GLU # find OpenGL and GLU
find_package(OpenGL REQUIRED) if(NOT IOS)
include_directories(${OPENGL_INCLUDE_DIR}) find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
set(ADDITIONAL_LIBRARIES ${OPENGL_LIBRARIES})
else()
set(ADDITIONAL_LIBRARIES -framework OpenGLES)
endif()
# define the window target # define the window target
sfml_add_example(window GUI_APP sfml_add_example(window GUI_APP
SOURCES ${SRC} SOURCES ${SRC}
DEPENDS sfml-window sfml-system ${OPENGL_LIBRARIES}) DEPENDS sfml-window sfml-system ${ADDITIONAL_LIBRARIES})

View File

@ -5,6 +5,15 @@
#include <SFML/OpenGL.hpp> #include <SFML/OpenGL.hpp>
// Some platform-specific stuff
#ifdef SFML_OPENGL_ES
#define glClearDepth glClearDepthf
#define glFrustum glFrustumf
#endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// Entry point of application /// Entry point of application
/// ///