diff --git a/CMakeLists.txt b/CMakeLists.txt index 348802e5..08c3a4eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,6 +143,9 @@ if(SFML_OS_ANDROID) add_definitions("-DSTL_LIBRARY=${ANDROID_STL}") endif() + # let the user switch ABIs + set(ANDROID_ABI "armeabi-v7a" CACHE STRING "Look at the NDK docs for currently supported ABIs") + # this is a workaround to compile sfml-activity without the stl library as a dependency # we save the original compilation command line to restore it later in Macro.cmake set(CMAKE_CXX_CREATE_SHARED_LIBRARY_WITH_STL ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index f9063367..1bcf308a 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -231,26 +231,50 @@ macro(sfml_add_example target) endmacro() # macro to find packages on the host OS -# this is the same as in the toolchain file, which is here for Nsight Tegra VS -# since it won't use the Android toolchain file -if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") - macro(find_host_package) - set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) - if(CMAKE_HOST_WIN32) - set(WIN32 1) - set(UNIX) - elseif(CMAKE_HOST_APPLE) - set(APPLE 1) - set(UNIX) +# We do not use the custom toolchain anymore, so we need to define +# the macro here +if(SFML_OS_ANDROID) + # macro to find packages on the host OS + macro( find_host_package ) + set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) + set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER ) + set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER ) + if( CMAKE_HOST_WIN32 ) + SET( WIN32 1 ) + SET( UNIX ) + elseif( CMAKE_HOST_APPLE ) + SET( APPLE 1 ) + SET( UNIX ) endif() - find_package(${ARGN}) - set(WIN32) - set(APPLE) - set(UNIX 1) - set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + find_package( ${ARGN} ) + SET( WIN32 ) + SET( APPLE ) + SET( UNIX 1 ) + set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY ) + set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) + set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) + endmacro() + + + # macro to find programs on the host OS + macro( find_host_program ) + set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) + set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER ) + set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER ) + if( CMAKE_HOST_WIN32 ) + SET( WIN32 1 ) + SET( UNIX ) + elseif( CMAKE_HOST_APPLE ) + SET( APPLE 1 ) + SET( UNIX ) + endif() + find_program( ${ARGN} ) + SET( WIN32 ) + SET( APPLE ) + SET( UNIX 1 ) + set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY ) + set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) + set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) endmacro() endif() + diff --git a/cmake/toolchains/android.toolchain.cmake b/cmake/toolchains/android.toolchain.cmake index ad5a8327..56e70cba 100644 --- a/cmake/toolchains/android.toolchain.cmake +++ b/cmake/toolchains/android.toolchain.cmake @@ -1555,51 +1555,6 @@ set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY ) set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) - -# macro to find packages on the host OS -macro( find_host_package ) - set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) - set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER ) - set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER ) - if( CMAKE_HOST_WIN32 ) - SET( WIN32 1 ) - SET( UNIX ) - elseif( CMAKE_HOST_APPLE ) - SET( APPLE 1 ) - SET( UNIX ) - endif() - find_package( ${ARGN} ) - SET( WIN32 ) - SET( APPLE ) - SET( UNIX 1 ) - set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY ) - set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) - set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) -endmacro() - - -# macro to find programs on the host OS -macro( find_host_program ) - set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) - set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER ) - set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER ) - if( CMAKE_HOST_WIN32 ) - SET( WIN32 1 ) - SET( UNIX ) - elseif( CMAKE_HOST_APPLE ) - SET( APPLE 1 ) - SET( UNIX ) - endif() - find_program( ${ARGN} ) - SET( WIN32 ) - SET( APPLE ) - SET( UNIX 1 ) - set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY ) - set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) - set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) -endmacro() - - # export toolchain settings for the try_compile() command if( NOT _CMAKE_IN_TRY_COMPILE ) set( __toolchain_config "") diff --git a/include/SFML/OpenGL.hpp b/include/SFML/OpenGL.hpp index 408f0dd5..f5105a6c 100644 --- a/include/SFML/OpenGL.hpp +++ b/include/SFML/OpenGL.hpp @@ -69,6 +69,9 @@ #include // We're not using OpenGL ES 2+ yet, but we can use the sRGB extension + // We need to import gl2platform.h, would normally be included by gl2.h + // which was included by gl2ext.h in older NDK versions + #include #include #endif diff --git a/src/SFML/Main/SFMLActivity.cpp b/src/SFML/Main/SFMLActivity.cpp index 07602fb2..e55a0492 100644 --- a/src/SFML/Main/SFMLActivity.cpp +++ b/src/SFML/Main/SFMLActivity.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #define LOGE(...) ((void)__android_log_print(ANDROID_LOG_INFO, "sfml-activity", __VA_ARGS__)) diff --git a/src/SFML/System/Android/Activity.cpp b/src/SFML/System/Android/Activity.cpp index 214b4a12..5d140265 100644 --- a/src/SFML/System/Android/Activity.cpp +++ b/src/SFML/System/Android/Activity.cpp @@ -43,7 +43,7 @@ std::streambuf::int_type LogcatStream::overflow (std::streambuf::int_type c) if (c == "\n"[0]) { m_message.push_back(c); - LOGE(m_message.c_str()); + LOGE("%s", m_message.c_str()); m_message.clear(); } diff --git a/src/SFML/Window/EglContext.cpp b/src/SFML/Window/EglContext.cpp index 03c41979..91d02f93 100644 --- a/src/SFML/Window/EglContext.cpp +++ b/src/SFML/Window/EglContext.cpp @@ -243,10 +243,10 @@ EGLConfig EglContext::getBestConfig(EGLDisplay display, unsigned int bitsPerPixe { // Set our video settings constraint const EGLint attributes[] = { - EGL_BUFFER_SIZE, bitsPerPixel, - EGL_DEPTH_SIZE, settings.depthBits, - EGL_STENCIL_SIZE, settings.stencilBits, - EGL_SAMPLE_BUFFERS, settings.antialiasingLevel, + EGL_BUFFER_SIZE, static_cast(bitsPerPixel), + EGL_DEPTH_SIZE, static_cast(settings.depthBits), + EGL_STENCIL_SIZE, static_cast(settings.stencilBits), + EGL_SAMPLE_BUFFERS, static_cast(settings.antialiasingLevel), EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, EGL_NONE