diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index 444d283e6..2e4405d99 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -89,6 +89,11 @@ macro(sfml_add_library target) INSTALL_NAME_DIR "@executable_path/../Frameworks") endif() + # enable automatic reference counting on iOS + if (IOS) + set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES) + endif() + # link the target to its external dependencies if(THIS_EXTERNAL_LIBS) target_link_libraries(${target} ${THIS_EXTERNAL_LIBS}) @@ -143,6 +148,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() + # add the install rule install(TARGETS ${target} RUNTIME DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples) diff --git a/src/SFML/Window/iOS/EaglContext.mm b/src/SFML/Window/iOS/EaglContext.mm index 791a67961..1deaee3b5 100644 --- a/src/SFML/Window/iOS/EaglContext.mm +++ b/src/SFML/Window/iOS/EaglContext.mm @@ -30,7 +30,9 @@ #include #include #include +#include #include +#include namespace sf @@ -98,9 +100,6 @@ EaglContext::~EaglContext() // Restore the previous context [EAGLContext setCurrentContext:previousContext]; - - // Release the context - [m_context release]; } } @@ -125,7 +124,7 @@ void EaglContext::recreateRenderBuffers(SFView* glView) glGenRenderbuffersOES(1, &m_colorbuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_colorbuffer); if (glView) - [m_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:glView.layer]; + [m_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)glView.layer]; glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, m_colorbuffer); // Create a depth buffer if requested diff --git a/src/SFML/Window/iOS/WindowImplUIKit.mm b/src/SFML/Window/iOS/WindowImplUIKit.mm index 975c461a7..a25ea88e5 100644 --- a/src/SFML/Window/iOS/WindowImplUIKit.mm +++ b/src/SFML/Window/iOS/WindowImplUIKit.mm @@ -98,7 +98,7 @@ void WindowImplUIKit::processEvents() //////////////////////////////////////////////////////////// WindowHandle WindowImplUIKit::getSystemHandle() const { - return m_window; + return (__bridge WindowHandle)m_window; }