Android: Removed custom toolchain file

This commit drops the previous custom CMake toolchain file for Android
in favor of CMake's new built-in toolchain for this (CMake >3.7.2).

This makes building SFML for Android a lot simpler and more straight
forward, working almost as smooth as other platforms.

To configure your build directory, all you have to do is defining just a
few variables the first time you invoke CMake.

**Required Variables**

* `CMAKE_SYSTEM_NAME` must be `Android`, so CMake knows we actually want
  to cross-compile.
* `CMAKE_ANDROID_NDK` must point to the NDK's installation directory,
  e.g. `/usr/android/ndk` or `c:/android/ndk`.

**Recommended Variables**
* `CMAKE_ANDROID_STL_TYPE` defines the STL implementation to be used.
  You should use `c++_shared`, although others might work.

**Optional Variables**
* `CMAKE_SYSTEM_VERSION` can be set to pick a specific SDK version other
  than the latest.
* `CMAKE_ANDROID_ARCH_ABI` defines the target architecture and ABI, for
  example `armeabi` or `armeabi-v7a`.

Based on your system, you might want to enforce a specific generator to
prevent issues, e.g. using `MinGW Makefiles`.
This commit is contained in:
Mario Liebisch 2018-01-25 15:06:30 +01:00 committed by Lukas Dürrenberger
parent 0da25a0b87
commit 806813e937
8 changed files with 23 additions and 93 deletions

View file

@ -66,7 +66,7 @@ elseif(SFML_OS_ANDROID)
endif()
# find external libraries
if(SFML_OS_ANDROID OR SFML_OS_IOS)
if(SFML_OS_IOS)
if(NOT SFML_OS_IOS)
find_host_package(OpenAL REQUIRED)
endif()

View file

@ -36,7 +36,7 @@ elseif(SFML_OS_IOS)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-ios/")
elseif(SFML_OS_ANDROID)
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers")
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-android/${ANDROID_ABI}")
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-android/${CMAKE_ANDROID_ARCH_ABI}")
endif()
# add the SFML sources path

View file

@ -116,7 +116,7 @@ if(SFML_OPENGL_ES AND SFML_OS_LINUX)
find_package(GLES REQUIRED)
include_directories(${EGL_INCLUDE_DIR} ${GLES_INCLUDE_DIR})
endif()
if(SFML_OS_ANDROID OR SFML_OS_IOS)
if(SFML_OS_IOS)
find_host_package(Freetype REQUIRED)
else()
find_package(Freetype REQUIRED)

View file

@ -30,6 +30,7 @@
#include <stdlib.h>
#include <string.h>
#include <jni.h>
#include <string>
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_INFO, "sfml-activity", __VA_ARGS__))