summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2013-03-19 21:53:09 -0500
committerRyan Houdek <Sonicadvance1@gmail.com>2013-03-19 21:53:09 -0500
commitd11679a06e6a992216148fd2ce1730c9912c8564 (patch)
tree843eb3b17cf8fe6c72af7e32d5554ce35ce785d6 /Source/Android
parentedd9d0e0ef6898a0528ac6389e93e9fca6132ff6 (diff)
Android mega commit of trash.
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/.classpath8
-rw-r--r--Source/Android/.gitignore7
-rw-r--r--Source/Android/.project33
-rw-r--r--Source/Android/.settings/org.eclipse.jdt.core.prefs4
-rw-r--r--Source/Android/AndroidManifest.xml29
-rw-r--r--Source/Android/android.toolchain.cmake1125
-rw-r--r--Source/Android/assets/ButtonA.pngbin0 -> 5178 bytes
-rw-r--r--Source/Android/assets/ButtonB.pngbin0 -> 4971 bytes
-rw-r--r--Source/Android/build.xml92
-rw-r--r--Source/Android/custom_rules.xml16
-rw-r--r--Source/Android/jni/Android.mk189
-rw-r--r--Source/Android/jni/Application.mk4
-rw-r--r--Source/Android/project.properties14
-rw-r--r--Source/Android/res/drawable-hdpi/launcher.pngbin0 -> 14225 bytes
-rw-r--r--Source/Android/res/drawable-mdpi/launcher.pngbin0 -> 8634 bytes
-rw-r--r--Source/Android/res/drawable-xhdpi/launcher.pngbin0 -> 23020 bytes
-rw-r--r--Source/Android/res/drawable-xxhdpi/launcher.pngbin0 -> 82300 bytes
-rw-r--r--Source/Android/res/layout/main.xml26
-rw-r--r--Source/Android/res/values/strings.xml6
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/Button.java33
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/ButtonManager.java43
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java124
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/FileArrayAdapter.java53
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java61
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/NativeListView.java94
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/NativeRenderer.java168
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/Option.java38
27 files changed, 2167 insertions, 0 deletions
diff --git a/Source/Android/.classpath b/Source/Android/.classpath
new file mode 100644
index 0000000000..3f9691c5dd
--- /dev/null
+++ b/Source/Android/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="output" path="bin/classes"/>
+</classpath>
diff --git a/Source/Android/.gitignore b/Source/Android/.gitignore
new file mode 100644
index 0000000000..31bce7aa41
--- /dev/null
+++ b/Source/Android/.gitignore
@@ -0,0 +1,7 @@
+gen
+obj
+#ui_atlas.zim
+ui_atlas.zim.png
+#assets/ui_atlas.zim
+#jni/ui_atlas.cpp
+#jni/ui_atlas.h
diff --git a/Source/Android/.project b/Source/Android/.project
new file mode 100644
index 0000000000..a79d8a1840
--- /dev/null
+++ b/Source/Android/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>ppsspp</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/Source/Android/.settings/org.eclipse.jdt.core.prefs b/Source/Android/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..f77b31c2d2
--- /dev/null
+++ b/Source/Android/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/Source/Android/AndroidManifest.xml b/Source/Android/AndroidManifest.xml
new file mode 100644
index 0000000000..e22370dd16
--- /dev/null
+++ b/Source/Android/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.dolphinemu.dolphinemu"
+ android:versionCode="1"
+ android:versionName="0.1" >
+
+ <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
+
+ <uses-feature android:glEsVersion="0x00020000"></uses-feature>
+ <uses-feature android:name="android.hardware.screen.landscape" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+
+ <application
+ android:icon="@drawable/launcher"
+ android:label="@string/app_name">
+ <activity
+ android:name=".DolphinEmulator"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+ android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/Source/Android/android.toolchain.cmake b/Source/Android/android.toolchain.cmake
new file mode 100644
index 0000000000..69b402670d
--- /dev/null
+++ b/Source/Android/android.toolchain.cmake
@@ -0,0 +1,1125 @@
+# ------------------------------------------------------------------------------
+# Android CMake toolchain file, for use with the Android NDK r5-r8
+# Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
+# See home page: http://code.google.com/p/android-cmake/
+#
+# The file is mantained by the OpenCV project. And also can be found at
+# http://code.opencv.org/projects/opencv/repository/revisions/master/changes/android/android.toolchain.cmake
+#
+# Usage Linux:
+# $ export ANDROID_NDK=/absolute/path/to/the/android-ndk
+# $ mkdir build && cd build
+# $ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake ..
+# $ make -j8
+#
+# Usage Linux (using standalone toolchain):
+# $ export ANDROID_STANDALONE_TOOLCHAIN=/absolute/path/to/android-toolchain
+# $ mkdir build && cd build
+# $ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake ..
+# $ make -j8
+#
+# Usage Windows:
+# You need native port of make to build your project.
+# Android NDK r7 (or newer) already has make.exe on board.
+# For older NDK you have to install it separately.
+# For example, this one: http://gnuwin32.sourceforge.net/packages/make.htm
+#
+# $ SET ANDROID_NDK=C:\absolute\path\to\the\android-ndk
+# $ mkdir build && cd build
+# $ cmake.exe -G"MinGW Makefiles"
+# -DCMAKE_TOOLCHAIN_FILE=path\to\the\android.toolchain.cmake
+# -DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%\prebuilt\windows\bin\make.exe" ..
+# $ "%ANDROID_NDK%\prebuilt\windows\bin\make.exe"
+#
+#
+# Options (can be set as cmake parameters: -D<option_name>=<value>):
+# ANDROID_NDK=/opt/android-ndk - path to the NDK root.
+# Can be set as environment variable. Can be set only at first cmake run.
+#
+# ANDROID_STANDALONE_TOOLCHAIN=/opt/android-toolchain - path to the
+# standalone toolchain. This option is not used if full NDK is found
+# (ignored if ANDROID_NDK is set).
+# Can be set as environment variable. Can be set only at first cmake run.
+#
+# ANDROID_ABI=armeabi-v7a - specifies the target Application Binary
+# Interface (ABI). This option nearly matches to the APP_ABI variable
+# used by ndk-build tool from Android NDK.
+#
+# Possible targets are:
+# "armeabi" - matches to the NDK ABI with the same name.
+# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+# "armeabi-v7a" - matches to the NDK ABI with the same name.
+# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+# "armeabi-v7a with NEON" - same as armeabi-v7a, but
+# sets NEON as floating-point unit
+# "armeabi-v7a with VFPV3" - same as armeabi-v7a, but
+# sets VFPV3 as floating-point unit (has 32 registers instead of 16).
+# "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP.
+# "x86" - matches to the NDK ABI with the same name.
+# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+# "mips" - matches to the NDK ABI with the same name
+# (not testes on real devices)
+#
+# ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
+# Option is read-only when standalone toolchain used.
+#
+# ANDROID_FORCE_ARM_BUILD=OFF - set true to generate 32-bit ARM instructions
+# instead of Thumb-1. Is not available for "x86" (inapplicable) and
+# "armeabi-v6 with VFP" (forced) ABIs.
+#
+# ANDROID_NO_UNDEFINED=ON - set true to show all undefined symbols as linker
+# errors even if they are not used.
+#
+# ANDROID_SO_UNDEFINED=OFF - set true to allow undefined symbols in shared
+# libraries. Automatically turned on for NDK r5x and r6x due to GLESv2
+# problems.
+#
+# LIBRARY_OUTPUT_PATH_ROOT=${CMAKE_SOURCE_DIR} - where to output binary
+# files. See additional details below.
+#
+# ANDROID_SET_OBSOLETE_VARIABLES=ON - it set, then toolchain defines some
+# obsolete variables which were set by previous versions of this file for
+# backward compatibility.
+#
+#
+# What?:
+# android-cmake toolchain searches for NDK/toolchain in the following order:
+# ANDROID_NDK - cmake parameter
+# ANDROID_NDK - environment variable
+# ANDROID_STANDALONE_TOOLCHAIN - cmake parameter
+# ANDROID_STANDALONE_TOOLCHAIN - environment variable
+# ANDROID_NDK - default locations
+# ANDROID_STANDALONE_TOOLCHAIN - default locations
+#
+# Make sure to do the following in your scripts:
+# SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${my_cxx_flags}" )
+# SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${my_cxx_flags}" )
+# The flags will be prepopulated with critical flags, so don't loose them.
+# Also be aware that toolchain also sets configuration-specific compiler
+# flags and linker flags.
+#
+# ANDROID and BUILD_ANDROID will be set to true, you may test any of these
+# variables to make necessary Android-specific configuration changes.
+#
+# Also ARMEABI or ARMEABI_V7A or X86 will be set true, mutually exclusive.
+# NEON option will be set true if VFP is set to NEON.
+#
+# LIBRARY_OUTPUT_PATH_ROOT should be set in cache to determine where Android
+# libraries will be installed.
+# Default is ${CMAKE_SOURCE_DIR}, and the android libs will always be
+# under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}
+# (depending on the target ABI). This is convenient for Android packaging.
+#
+# Authors:
+# Ethan Rublee ethan.ruble@gmail.com
+# Andrey Kamaev andrey.kamaev@itseez.com
+#
+# Change Log:
+# - initial version December 2010
+# - modified April 2011
+# [+] added possibility to build with NDK (without standalone toolchain)
+# [+] support cross-compilation on Windows (native, no cygwin support)
+# [+] added compiler option to force "char" type to be signed
+# [+] added toolchain option to compile to 32-bit ARM instructions
+# [+] added toolchain option to disable SWIG search
+# [+] added platform "armeabi-v7a with VFPV3"
+# [~] ARM_TARGETS renamed to ARM_TARGET
+# [+] EXECUTABLE_OUTPUT_PATH is set by toolchain (required on Windows)
+# [~] Fixed bug with ANDROID_API_LEVEL variable
+# [~] turn off SWIG search if it is not found first time
+# - modified May 2011
+# [~] ANDROID_LEVEL is renamed to ANDROID_API_LEVEL
+# [+] ANDROID_API_LEVEL is detected by toolchain if not specified
+# [~] added guard to prevent changing of output directories on the first
+# cmake pass
+# [~] toolchain exits with error if ARM_TARGET is not recognized
+# - modified June 2011
+# [~] default NDK path is updated for version r5c
+# [+] variable CMAKE_SYSTEM_PROCESSOR is set based on ARM_TARGET
+# [~] toolchain install directory is added to linker paths
+# [-] removed SWIG-related stuff from toolchain
+# [+] added macro find_host_package, find_host_program to search
+# packages/programs on the host system
+# [~] fixed path to STL library
+# - modified July 2011
+# [~] fixed options caching
+# [~] search for all supported NDK versions
+# [~] allowed spaces in NDK path
+# - modified September 2011
+# [~] updated for NDK r6b
+# - modified November 2011
+# [*] rewritten for NDK r7
+# [+] x86 toolchain support (experimental)
+# [+] added "armeabi-v6 with VFP" ABI for ARMv6 processors.
+# [~] improved compiler and linker flags management
+# [+] support different build flags for Release and Debug configurations
+# [~] by default compiler flags the same as used by ndk-build (but only
+# where reasonable)
+# [~] ANDROID_NDK_TOOLCHAIN_ROOT is splitted to ANDROID_STANDALONE_TOOLCHAIN
+# and ANDROID_TOOLCHAIN_ROOT
+# [~] ARM_TARGET is renamed to ANDROID_ABI
+# [~] ARMEABI_NDK_NAME is renamed to ANDROID_NDK_ABI_NAME
+# [~] ANDROID_API_LEVEL is renamed to ANDROID_NATIVE_API_LEVEL
+# - modified January 2012
+# [+] added stlport_static support (experimental)
+# [+] added special check for cygwin
+# [+] filtered out hidden files (starting with .) while globbing inside NDK
+# [+] automatically applied GLESv2 linkage fix for NDK revisions 5-6
+# [+] added ANDROID_GET_ABI_RAWNAME to get NDK ABI names by CMake flags
+# - modified February 2012
+# [+] updated for NDK r7b
+# [~] fixed cmake try_compile() command
+# [~] Fix for missing install_name_tool on OS X
+# - modified March 2012
+# [~] fixed incorrect C compiler flags
+# [~] fixed CMAKE_SYSTEM_PROCESSOR change on ANDROID_ABI change
+# [+] improved toolchain loading speed
+# [+] added assembler language support (.S)
+# [+] allowed preset search paths and extra search suffixes
+# - modified April 2012
+# [+] updated for NDK r7c
+# [~] fixed most of problems with compiler/linker flags and caching
+# [+] added option ANDROID_FUNCTION_LEVEL_LINKING
+# - modified May 2012
+# [+] updated for NDK r8
+# [+] added mips architecture support
+# - modified August 2012
+# [+] updated for NDK r8b
+# [~] all intermediate files generated by toolchain are moved into CMakeFiles
+# [~] libstdc++ and libsupc are removed from explicit link libraries
+# ------------------------------------------------------------------------------
+
+cmake_minimum_required( VERSION 2.6.3 )
+
+if( DEFINED CMAKE_CROSSCOMPILING )
+ # subsequent toolchain loading is not really needed
+ return()
+endif()
+
+get_property(_CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
+if( _CMAKE_IN_TRY_COMPILE )
+ include( "${CMAKE_CURRENT_SOURCE_DIR}/../android.toolchain.config.cmake" OPTIONAL )
+endif()
+
+# this one is important
+set( CMAKE_SYSTEM_NAME Linux )
+# this one not so much
+set( CMAKE_SYSTEM_VERSION 1 )
+
+set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
+if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
+ if( CMAKE_HOST_WIN32 )
+ file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
+ set( ANDROID_NDK_SEARCH_PATHS "${ANDROID_NDK_SEARCH_PATHS}/android-ndk" "$ENV{SystemDrive}/NVPACK/android-ndk" )
+ else()
+ file( TO_CMAKE_PATH "$ENV{HOME}" ANDROID_NDK_SEARCH_PATHS )
+ set( ANDROID_NDK_SEARCH_PATHS /opt/android-ndk "${ANDROID_NDK_SEARCH_PATHS}/NVPACK/android-ndk" )
+ endif()
+endif()
+if(NOT DEFINED ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH)
+ set( ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH /opt/android-toolchain )
+endif()
+
+set( ANDROID_SUPPORTED_ABIS_arm "armeabi-v7a;armeabi;armeabi-v7a with NEON;armeabi-v7a with VFPV3;armeabi-v6 with VFP" )
+set( ANDROID_SUPPORTED_ABIS_x86 "x86" )
+set( ANDROID_SUPPORTED_ABIS_mipsel "mips" )
+
+set( ANDROID_DEFAULT_NDK_API_LEVEL 9 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 9 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 9 )
+
+
+macro( __LIST_FILTER listvar regex )
+ if( ${listvar} )
+ foreach( __val ${${listvar}} )
+ if( __val MATCHES "${regex}" )
+ list( REMOVE_ITEM ${listvar} "${__val}" )
+ endif()
+ endforeach()
+ endif()
+endmacro()
+
+macro( __INIT_VARIABLE var_name )
+ set( __test_path 0 )
+ foreach( __var ${ARGN} )
+ if( __var STREQUAL "PATH" )
+ set( __test_path 1 )
+ break()
+ endif()
+ endforeach()
+ if( __test_path AND NOT EXISTS "${${var_name}}" )
+ unset( ${var_name} CACHE )
+ endif()
+ if( "${${var_name}}" STREQUAL "" )
+ set( __values 0 )
+ foreach( __var ${ARGN} )
+ if( __var STREQUAL "VALUES" )
+ set( __values 1 )
+ elseif( NOT __var STREQUAL "PATH" )
+ set( __obsolete 0 )
+ if( __var MATCHES "^OBSOLETE_.*$" )
+ string( REPLACE "OBSOLETE_" "" __var "${__var}" )
+ set( __obsolete 1 )
+ endif()
+ if( __var MATCHES "^ENV_.*$" )
+ string( REPLACE "ENV_" "" __var "${__var}" )
+ set( __value "$ENV{${__var}}" )
+ elseif( DEFINED ${__var} )
+ set( __value "${${__var}}" )
+ else()
+ if( __values )
+ set( __value "${__var}" )
+ else()
+ set( __value "" )
+ endif()
+ endif()
+ if( NOT "${__value}" STREQUAL "" )
+ if( __test_path )
+ if( EXISTS "${__value}" )
+ set( ${var_name} "${__value}" )
+ if( __obsolete )
+ message( WARNING "Using value of obsolete variable ${__var} as initial value for ${var_name}. Please note, that ${__var} can be completely removed in future versions of the toolchain." )
+ endif()
+ break()
+ endif()
+ else()
+ set( ${var_name} "${__value}" )
+ if( __obsolete )
+ message( WARNING "Using value of obsolete variable ${__var} as initial value for ${var_name}. Please note, that ${__var} can be completely removed in future versions of the toolchain." )
+ endif()
+ break()
+ endif()
+ endif()
+ endif()
+ endforeach()
+ unset( __value )
+ unset( __values )
+ unset( __obsolete )
+ endif()
+ unset( __test_path )
+endmacro()
+
+macro( __DETECT_NATIVE_API_LEVEL _var _path )
+ SET( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*$" )
+ FILE( STRINGS ${_path} __apiFileContent REGEX "${__ndkApiLevelRegex}" )
+ if( NOT __apiFileContent )
+ message( SEND_ERROR "Could not get Android native API level. Probably you have specified invalid level value, or your copy of NDK/toolchain is broken." )
+ endif()
+ string( REGEX REPLACE "${__ndkApiLevelRegex}" "\\1" ${_var} "${__apiFileContent}" )
+ unset( __apiFileContent )
+ unset( __ndkApiLevelRegex )
+endmacro()
+
+macro( __DETECT_TOOLCHAIN_MACHINE_NAME _var _root )
+ file( GLOB __gccExePath "${_root}/bin/*-gcc${TOOL_OS_SUFFIX}" )
+ __LIST_FILTER( __gccExePath "bin/[.].*-gcc${TOOL_OS_SUFFIX}$" )
+ list( LENGTH __gccExePath __gccExePathsCount )
+ if( NOT __gccExePathsCount EQUAL 1 )
+ message( WARNING "Could not uniquely determine machine name for compiler from ${_root}." )
+ set( ${_var} "" )
+ else()
+ get_filename_component( __gccExeName "${__gccExePath}" NAME_WE )
+ string( REPLACE "-gcc" "" ${_var} "${__gccExeName}" )
+ endif()
+ unset( __gccExePath )
+ unset( __gccExePathsCount )
+ unset( __gccExeName )
+endmacro()
+
+macro( __COPY_IF_DIFFERENT _source _destination )
+ execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${_source}" "${_destination}" RESULT_VARIABLE __fileCopyProcess )
+ if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${_destination}")
+ message( SEND_ERROR "Failed copying of ${_source} to the ${_destination}" )
+ endif()
+ unset( __fileCopyProcess )
+endmacro()
+
+
+# stl version: by default gnustl_static will be used
+set( ANDROID_USE_STLPORT FALSE CACHE BOOL "Experimental: use stlport_static instead of gnustl_static")
+mark_as_advanced( ANDROID_USE_STLPORT )
+
+# fight against cygwin
+set( ANDROID_FORBID_SYGWIN TRUE CACHE BOOL "Prevent cmake from working under cygwin and using cygwin tools")
+mark_as_advanced( ANDROID_FORBID_SYGWIN )
+if( ANDROID_FORBID_SYGWIN )
+ if( CYGWIN )
+ message( FATAL_ERROR "Android NDK and android-cmake toolchain are not welcome Cygwin. It is unlikely that this cmake toolchain will work under cygwin. But if you want to try then you can set cmake variable ANDROID_FORBID_SYGWIN to FALSE and rerun cmake." )
+ endif()
+
+ if( CMAKE_HOST_WIN32 )
+ # remove cygwin from PATH
+ set( __new_path "$ENV{PATH}")
+ __LIST_FILTER( __new_path "cygwin" )
+ set(ENV{PATH} "${__new_path}")
+ unset(__new_path)
+ endif()
+endif()
+
+# detect current host platform
+set( TOOL_OS_SUFFIX "" )
+if( CMAKE_HOST_APPLE )
+ set( ANDROID_NDK_HOST_SYSTEM_NAME "darwin-x86" )
+elseif( CMAKE_HOST_WIN32 )
+ set( ANDROID_NDK_HOST_SYSTEM_NAME "windows" )
+ set( TOOL_OS_SUFFIX ".exe" )
+elseif( CMAKE_HOST_UNIX )
+ set( ANDROID_NDK_HOST_SYSTEM_NAME "linux-x86" )
+else()
+ message( FATAL_ERROR "Cross-compilation on your platform is not supported by this cmake toolchain" )
+endif()
+
+# see if we have path to Android NDK
+__INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK )
+if( NOT ANDROID_NDK )
+ # see if we have path to Android standalone toolchain
+ __INIT_VARIABLE( ANDROID_STANDALONE_TOOLCHAIN PATH ENV_ANDROID_STANDALONE_TOOLCHAIN OBSOLETE_ANDROID_NDK_TOOLCHAIN_ROOT OBSOLETE_ENV_ANDROID_NDK_TOOLCHAIN_ROOT )
+
+ if( NOT ANDROID_STANDALONE_TOOLCHAIN )
+ #try to find Android NDK in one of the the default locations
+ set( __ndkSearchPaths )
+ foreach( __ndkSearchPath ${ANDROID_NDK_SEARCH_PATHS} )
+ foreach( suffix ${ANDROID_SUPPORTED_NDK_VERSIONS} )
+ list( APPEND __ndkSearchPaths "${__ndkSearchPath}${suffix}" )
+ endforeach()
+ endforeach()
+ __INIT_VARIABLE( ANDROID_NDK PATH VALUES ${__ndkSearchPaths} )
+ unset( __ndkSearchPaths )
+
+ if( ANDROID_NDK )
+ message( STATUS "Using default path for Android NDK: ${ANDROID_NDK}" )
+ message( STATUS " If you prefer to use a different location, please define a cmake or environment variable: ANDROID_NDK" )
+ else()
+ #try to find Android standalone toolchain in one of the the default locations
+ __INIT_VARIABLE( ANDROID_STANDALONE_TOOLCHAIN PATH ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH )
+
+ if( ANDROID_STANDALONE_TOOLCHAIN )
+ message( STATUS "Using default path for standalone toolchain ${ANDROID_STANDALONE_TOOLCHAIN}" )
+ message( STATUS " If you prefer to use a different location, please define the variable: ANDROID_STANDALONE_TOOLCHAIN" )
+ endif( ANDROID_STANDALONE_TOOLCHAIN )
+ endif( ANDROID_NDK )
+ endif( NOT ANDROID_STANDALONE_TOOLCHAIN )
+endif( NOT ANDROID_NDK )
+
+# remember found paths
+if( ANDROID_NDK )
+ get_filename_component( ANDROID_NDK "${ANDROID_NDK}" ABSOLUTE )
+ # try to detect change
+ if( CMAKE_AR )
+ string( LENGTH "${ANDROID_NDK}" __length )
+ string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidNdkPreviousPath )
+ if( NOT __androidNdkPreviousPath STREQUAL ANDROID_NDK )
+ message( FATAL_ERROR "It is not possible to change path to the NDK on subsequent run." )
+ endif()
+ unset( __androidNdkPreviousPath )
+ unset( __length )
+ endif()
+ set( ANDROID_NDK "${ANDROID_NDK}" CACHE INTERNAL "Path of the Android NDK" )
+ set( BUILD_WITH_ANDROID_NDK True )
+elseif( ANDROID_STANDALONE_TOOLCHAIN )
+ get_filename_component( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" ABSOLUTE )
+ # try to detect change
+ if( CMAKE_AR )
+ string( LENGTH "${ANDROID_STANDALONE_TOOLCHAIN}" __length )
+ string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidStandaloneToolchainPreviousPath )
+ if( NOT __androidStandaloneToolchainPreviousPath STREQUAL ANDROID_STANDALONE_TOOLCHAIN )
+ message( FATAL_ERROR "It is not possible to change path to the Android standalone toolchain on subsequent run." )
+ endif()
+ unset( __androidStandaloneToolchainPreviousPath )
+ unset( __length )
+ endif()
+ set( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" CACHE INTERNAL "Path of the Android standalone toolchain" )
+ set( BUILD_WITH_STANDALONE_TOOLCHAIN True )
+else()
+ list(GET ANDROID_NDK_SEARCH_PATHS 0 ANDROID_NDK_SEARCH_PATH)
+ message( FATAL_ERROR "Could not find neither Android NDK nor Android standalone toolcahin.
+ You should either set an environment variable:
+ export ANDROID_NDK=~/my-android-ndk
+ or
+ export ANDROID_STANDALONE_TOOLCHAIN=~/my-android-toolchain
+ or put the toolchain or NDK in the default path:
+ sudo ln -s ~/my-android-ndk ${ANDROID_NDK_SEARCH_PATH}
+ sudo ln -s ~/my-android-toolchain ${ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH}" )
+endif()
+
+# get all the details about standalone toolchain
+if( BUILD_WITH_STANDALONE_TOOLCHAIN )
+ __DETECT_NATIVE_API_LEVEL( ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot/usr/include/android/api-level.h" )
+ set( ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
+ set( __availableToolchains "standalone" )
+ __DETECT_TOOLCHAIN_MACHINE_NAME( __availableToolchainMachines "${ANDROID_STANDALONE_TOOLCHAIN}" )
+ if( NOT __availableToolchainMachines )
+ message( FATAL_ERROR "Could not determine machine name of your toolchain. Probably your Android standalone toolchain is broken." )
+ endif()
+ if( __availableToolchainMachines MATCHES i686 )
+ set( __availableToolchainArchs "x86" )
+ elseif( __availableToolchainMachines MATCHES arm )
+ set( __availableToolchainArchs "arm" )
+ elseif( __availableToolchainMachines MATCHES mipsel )
+ set( __availableToolchainArchs "mipsel" )
+ endif()
+ if( ANDROID_COMPILER_VERSION )
+ # do not run gcc every time because it is relatevely expencive
+ set( __availableToolchainCompilerVersions "${ANDROID_COMPILER_VERSION}" )
+ else()
+ execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" --version
+ OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE )
+ string( REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" __availableToolchainCompilerVersions "${__availableToolchainCompilerVersions}" )
+ endif()
+endif()
+
+# get all the details about NDK
+if( BUILD_WITH_ANDROID_NDK )
+ file( GLOB ANDROID_SUPPORTED_NATIVE_API_LEVELS RELATIVE "${ANDROID_NDK}/platforms" "${ANDROID_NDK}/platforms/android-*" )
+ string( REPLACE "android-" "" ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_SUPPORTED_NATIVE_API_LEVELS}" )
+ file( GLOB __availableToolchains RELATIVE "${ANDROID_NDK}/toolchains" "${ANDROID_NDK}/toolchains/*" )
+ __LIST_FILTER( __availableToolchains "^[.]" )
+ set( __availableToolchainMachines "" )
+ set( __availableToolchainArchs "" )
+ set( __availableToolchainCompilerVersions "" )
+ foreach( __toolchain ${__availableToolchains} )
+ __DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK}/toolchains/${__toolchain}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
+ if( __machine )
+ string( REGEX MATCH "[0-9]+[.][0-9]+[.]*[0-9]*$" __version "${__toolchain}" )
+ string( REGEX MATCH "^[^-]+" __arch "${__toolchain}" )
+ list( APPEND __availableToolchainMachines "${__machine}" )
+ list( APPEND __availableToolchainArchs "${__arch}" )
+ list( APPEND __availableToolchainCompilerVersions "${__version}" )
+ else()
+ list( REMOVE_ITEM __availableToolchains "${__toolchain}" )
+ endif()
+ endforeach()
+ if( NOT __availableToolchains )
+ message( FATAL_ERROR "Could not any working toolchain in the NDK. Probably your Android NDK is broken." )
+ endif()
+endif()
+
+# build list of available ABIs
+if( NOT ANDROID_SUPPORTED_ABIS )
+ set( ANDROID_SUPPORTED_ABIS "" )
+ set( __uniqToolchainArchNames ${__availableToolchainArchs} )
+ list( REMOVE_DUPLICATES __uniqToolchainArchNames )
+ list( SORT __uniqToolchainArchNames )
+ foreach( __arch ${__uniqToolchainArchNames} )
+ list( APPEND ANDROID_SUPPORTED_ABIS ${ANDROID_SUPPORTED_ABIS_${__arch}} )
+ endforeach()
+ unset( __uniqToolchainArchNames )
+ if( NOT ANDROID_SUPPORTED_ABIS )
+ message( FATAL_ERROR "No one of known Android ABIs is supported by this cmake toolchain." )
+ endif()
+endif()
+
+# choose target ABI
+__INIT_VARIABLE( ANDROID_ABI OBSOLETE_ARM_TARGET OBSOLETE_ARM_TARGETS VALUES ${ANDROID_SUPPORTED_ABIS} )
+# verify that target ABI is supported
+list( FIND ANDROID_SUPPORTED_ABIS "${ANDROID_ABI}" __androidAbiIdx )
+if( __androidAbiIdx EQUAL -1 )
+ string( REPLACE ";" "\", \"", PRINTABLE_ANDROID_SUPPORTED_ABIS "${ANDROID_SUPPORTED_ABIS}" )
+ message( FATAL_ERROR "Specified ANDROID_ABI = \"${ANDROID_ABI}\" is not supported by this cmake toolchain or your NDK/toolchain.
+ Supported values are: \"${PRINTABLE_ANDROID_SUPPORTED_ABIS}\"
+ " )
+endif()
+unset( __androidAbiIdx )
+
+# remember target ABI
+set( ANDROID_ABI "${ANDROID_ABI}" CACHE STRING "The target ABI for Android. If arm, then armeabi-v7a is recommended for hardware floating point." FORCE )
+
+# set target ABI options
+if( ANDROID_ABI STREQUAL "x86" )
+ set( X86 true )
+ set( ANDROID_NDK_ABI_NAME "x86" )
+ set( ANDROID_ARCH_NAME "x86" )
+ set( ANDROID_ARCH_FULLNAME "x86" )
+ set( CMAKE_SYSTEM_PROCESSOR "i686" )
+elseif( ANDROID_ABI STREQUAL "mips" )
+ set( MIPS true )
+ set( ANDROID_NDK_ABI_NAME "mips" )
+ set( ANDROID_ARCH_NAME "mips" )
+ set( ANDROID_ARCH_FULLNAME "mipsel" )
+ set( CMAKE_SYSTEM_PROCESSOR "mips" )
+elseif( ANDROID_ABI STREQUAL "armeabi" )
+ set( ARMEABI true )
+ set( ANDROID_NDK_ABI_NAME "armeabi" )
+ set( ANDROID_ARCH_NAME "arm" )
+ set( ANDROID_ARCH_FULLNAME "arm" )
+ set( CMAKE_SYSTEM_PROCESSOR "armv5te" )
+elseif( ANDROID_ABI STREQUAL "armeabi-v6 with VFP" )
+ set( ARMEABI_V6 true )
+ set( ANDROID_NDK_ABI_NAME "armeabi" )
+ set( ANDROID_ARCH_NAME "arm" )
+ set( ANDROID_ARCH_FULLNAME "arm" )
+ set( CMAKE_SYSTEM_PROCESSOR "armv6" )
+ # need always fallback to older platform
+ set( ARMEABI true )
+elseif( ANDROID_ABI STREQUAL "armeabi-v7a")
+ set( ARMEABI_V7A true )
+ set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
+ set( ANDROID_ARCH_NAME "arm" )
+ set( ANDROID_ARCH_FULLNAME "arm" )
+ set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
+elseif( ANDROID_ABI STREQUAL "armeabi-v7a with VFPV3" )
+ set( ARMEABI_V7A true )
+ set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
+ set( ANDROID_ARCH_NAME "arm" )
+ set( ANDROID_ARCH_FULLNAME "arm" )
+ set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
+ set( VFPV3 true )
+elseif( ANDROID_ABI STREQUAL "armeabi-v7a with NEON" )
+ set( ARMEABI_V7A true )
+ set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
+ set( ANDROID_ARCH_NAME "arm" )
+ set( ANDROID_ARCH_FULLNAME "arm" )
+ set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
+ set( VFPV3 true )
+ set( NEON true )
+else()
+ message( SEND_ERROR "Unknown ANDROID_ABI=\"${ANDROID_ABI}\" is specified." )
+endif()
+
+if( CMAKE_BINARY_DIR AND EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" )
+ # really dirty hack
+ # it is not possible to change CMAKE_SYSTEM_PROCESSOR after the first run...
+ file( APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" "SET(CMAKE_SYSTEM_PROCESSOR \"${CMAKE_SYSTEM_PROCESSOR}\")\n" )
+endif()
+
+set( ANDROID_SUPPORTED_ABIS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME}} CACHE INTERNAL "ANDROID_ABI can be changed only to one of these ABIs. Changing to any other ABI requires to reset cmake cache." )
+if( CMAKE_VERSION VERSION_GREATER "2.8" )
+ list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME} )
+ set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME}} )
+endif()
+
+if( ANDROID_ARCH_NAME STREQUAL "arm" AND NOT ARMEABI_V6 )
+ __INIT_VARIABLE( ANDROID_FORCE_ARM_BUILD OBSOLETE_FORCE_ARM VALUES OFF )
+ set( ANDROID_FORCE_ARM_BUILD ${ANDROID_FORCE_ARM_BUILD} CACHE BOOL "Use 32-bit ARM instructions instead of Thumb-1" FORCE )
+ mark_as_advanced( ANDROID_FORCE_ARM_BUILD )
+else()
+ unset( ANDROID_FORCE_ARM_BUILD CACHE )
+endif()
+
+# choose toolchain
+if( ANDROID_TOOLCHAIN_NAME )
+ list( FIND __availableToolchains "${ANDROID_TOOLCHAIN_NAME}" __toolchainIdx )
+ if( __toolchainIdx EQUAL -1 )
+ message( FATAL_ERROR "Previously selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is missing. You need to remove CMakeCache.txt and rerun cmake manually to change the toolchain" )
+ endif()
+ list( GET __availableToolchainArchs ${__toolchainIdx} __toolchainArch )
+ if( NOT __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
+ message( SEND_ERROR "Previously selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is not able to compile binaries for the \"${ANDROID_ARCH_NAME}\" platform." )
+ endif()
+else()
+ set( __toolchainIdx -1 )
+ set( __applicableToolchains "" )
+ set( __toolchainMaxVersion "0.0.0" )
+ list( LENGTH __availableToolchains __availableToolchainsCount )
+ math( EXPR __availableToolchainsCount "${__availableToolchainsCount}-1" )
+ foreach( __idx RANGE ${__availableToolchainsCount} )
+ list( GET __availableToolchainArchs ${__idx} __toolchainArch )
+ if( __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
+ list( GET __availableToolchainCompilerVersions ${__idx} __toolchainVersion )
+ if( __toolchainVersion VERSION_GREATER __toolchainMaxVersion )
+ set( __toolchainMaxVersion "${__toolchainVersion}" )
+ set( __toolchainIdx ${__idx} )
+ endif()
+ endif()
+ endforeach()
+ unset( __availableToolchainsCount )
+ unset( __toolchainMaxVersion )
+ unset( __toolchainVersion )
+endif()
+unset( __toolchainArch )
+if( __toolchainIdx EQUAL -1 )
+ message( FATAL_ERROR "No one of available compiler toolchains is able to compile for ${ANDROID_ARCH_NAME} platform." )
+endif()
+list( GET __availableToolchains ${__toolchainIdx} ANDROID_TOOLCHAIN_NAME )
+list( GET __availableToolchainMachines ${__toolchainIdx} ANDROID_TOOLCHAIN_MACHINE_NAME )
+list( GET __availableToolchainCompilerVersions ${__toolchainIdx} ANDROID_COMPILER_VERSION )
+set( ANDROID_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" CACHE INTERNAL "Name of toolchain used" )
+set( ANDROID_COMPILER_VERSION "${ANDROID_COMPILER_VERSION}" CACHE INTERNAL "compiler version from selected toolchain" )
+unset( __toolchainIdx )
+unset( __availableToolchains )
+unset( __availableToolchainMachines )
+unset( __availableToolchainArchs )
+unset( __availableToolchainCompilerVersions )
+
+# choose native API level
+__INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL )
+string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
+# validate
+list( FIND ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_NATIVE_API_LEVEL}" __levelIdx )
+if( __levelIdx EQUAL -1 )
+ message( SEND_ERROR "Specified Android native API level (${ANDROID_NATIVE_API_LEVEL}) is not supported by your NDK/toolchain." )
+endif()
+unset( __levelIdx )
+if( BUILD_WITH_ANDROID_NDK )
+ __DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
+ if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
+ message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
+ endif()
+ unset( __realApiLevel )
+endif()
+set( ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android API level for native code" FORCE )
+if( CMAKE_VERSION VERSION_GREATER "2.8" )
+ list( SORT ANDROID_SUPPORTED_NATIVE_API_LEVELS )
+ set_property( CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
+endif()
+
+# setup paths
+if( BUILD_WITH_STANDALONE_TOOLCHAIN )
+ set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_STANDALONE_TOOLCHAIN}" )
+ set( ANDROID_SYSROOT "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot" )
+ set( __stlLibPath "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib" )
+endif()
+if( BUILD_WITH_ANDROID_NDK )
+ set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
+ set( ANDROID_SYSROOT "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}" )
+ if( ANDROID_USE_STLPORT )
+ set( __stlIncludePath "${ANDROID_NDK}/sources/cxx-stl/stlport/stlport" )
+ set( __stlLibPath "${ANDROID_NDK}/sources/cxx-stl/stlport/libs/${ANDROID_NDK_ABI_NAME}" )
+ else()
+ if( EXISTS "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}" )
+ set( __stlIncludePath "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/include" )
+ set( __stlLibPath "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/libs/${ANDROID_NDK_ABI_NAME}" )
+ else()
+ set( __stlIncludePath "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/include" )
+ set( __stlLibPath "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${ANDROID_NDK_ABI_NAME}" )
+ endif()
+ endif()
+endif()
+
+# specify the cross compiler
+set( CMAKE_C_COMPILER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_OS_SUFFIX}" CACHE PATH "gcc" )
+set( CMAKE_CXX_COMPILER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-g++${TOOL_OS_SUFFIX}" CACHE PATH "g++" )
+set( CMAKE_ASM_COMPILER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_OS_SUFFIX}" CACHE PATH "Assembler" )
+if( CMAKE_VERSION VERSION_LESS 2.8.5 )
+ set( CMAKE_ASM_COMPILER_ARG1 "-c" )
+endif()
+# there may be a way to make cmake deduce these TODO deduce the rest of the tools
+set( CMAKE_STRIP "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-strip${TOOL_OS_SUFFIX}" CACHE PATH "strip" )
+set( CMAKE_AR "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-ar${TOOL_OS_SUFFIX}" CACHE PATH "archive" )
+set( CMAKE_LINKER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-ld${TOOL_OS_SUFFIX}" CACHE PATH "linker" )
+set( CMAKE_NM "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-nm${TOOL_OS_SUFFIX}" CACHE PATH "nm" )
+set( CMAKE_OBJCOPY "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-objcopy${TOOL_OS_SUFFIX}" CACHE PATH "objcopy" )
+set( CMAKE_OBJDUMP "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-objdump${TOOL_OS_SUFFIX}" CACHE PATH "objdump" )
+set( CMAKE_RANLIB "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-ranlib${TOOL_OS_SUFFIX}" CACHE PATH "ranlib" )
+set( _CMAKE_TOOLCHAIN_PREFIX "${ANDROID_TOOLCHAIN_MACHINE_NAME}-" )
+if( APPLE )
+ find_program( CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool )
+ if( NOT CMAKE_INSTALL_NAME_TOOL )
+ message( FATAL_ERROR "Could not find install_name_tool, please check your installation." )
+ endif()
+ mark_as_advanced( CMAKE_INSTALL_NAME_TOOL )
+endif()
+
+# export directories
+set( ANDROID_SYSTEM_INCLUDE_DIRS "" )
+set( ANDROID_SYSTEM_LIB_DIRS "" )
+
+# setup output directories
+set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_SOURCE_DIR} CACHE PATH "root for library output, set this to change where android libs are installed to" )
+set( CMAKE_INSTALL_PREFIX "${ANDROID_TOOLCHAIN_ROOT}/user" CACHE STRING "path for installing" )
+
+if(NOT _CMAKE_IN_TRY_COMPILE)
+ if( EXISTS "${CMAKE_SOURCE_DIR}/jni/CMakeLists.txt" )
+ set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_ABI_NAME}" CACHE PATH "Output directory for applications" )
+ else()
+ set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
+ endif()
+ set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" )
+endif()
+
+# includes
+list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${ANDROID_SYSROOT}/usr/include" )
+if( __stlIncludePath AND EXISTS "${__stlIncludePath}" )
+ list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${__stlIncludePath}" )
+endif()
+
+# c++ bits includes
+if( __stlLibPath AND EXISTS "${__stlLibPath}/include" )
+ list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${__stlLibPath}/include" )
+endif()
+if( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}/thumb/bits" )
+ list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}/thumb" )
+elseif( EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}/bits" )
+ list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}" )
+elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/thumb/bits" )
+ list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/thumb" )
+elseif( EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/bits" )
+ list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}/${ANDROID_TOOLCHAIN_MACHINE_NAME}" )
+endif()
+
+# flags and definitions
+if(ANDROID_SYSROOT MATCHES "[ ;\"]")
+ set( ANDROID_CXX_FLAGS "--sysroot=\"${ANDROID_SYSROOT}\"" )
+ # quotes will break try_compile and compiler identification
+ message(WARNING "Your Android system root has non-alphanumeric symbols. It can break compiler features detection and the whole build.")
+else()
+ set( ANDROID_CXX_FLAGS "--sysroot=${ANDROID_SYSROOT}" )
+endif()
+
+remove_definitions( -DANDROID )
+add_definitions( -DANDROID )
+
+# Force set compilers because standard identification works badly for us
+include( CMakeForceCompiler )
+CMAKE_FORCE_C_COMPILER( "${CMAKE_C_COMPILER}" GNU )
+set( CMAKE_C_PLATFORM_ID Linux )
+set( CMAKE_C_SIZEOF_DATA_PTR 4 )
+set( CMAKE_C_HAS_ISYSROOT 1 )
+set( CMAKE_C_COMPILER_ABI ELF )
+CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU )
+set( CMAKE_CXX_PLATFORM_ID Linux )
+set( CMAKE_CXX_SIZEOF_DATA_PTR 4 )
+set( CMAKE_CXX_HAS_ISYSROOT 1 )
+set( CMAKE_CXX_COMPILER_ABI ELF )
+# force ASM compiler (required for CMake < 2.8.5)
+set( CMAKE_ASM_COMPILER_ID_RUN TRUE )
+set( CMAKE_ASM_COMPILER_ID GNU )
+set( CMAKE_ASM_COMPILER_WORKS TRUE )
+set( CMAKE_ASM_COMPILER_FORCED TRUE )
+set( CMAKE_COMPILER_IS_GNUASM 1)
+
+# NDK flags
+if( ARMEABI OR ARMEABI_V7A )
+ # NDK also defines -ffunction-sections -funwind-tables but they result in worse OpenCV performance
+ set( _CMAKE_CXX_FLAGS "-fPIC -Wno-psabi" )
+ set( _CMAKE_C_FLAGS "-fPIC -Wno-psabi" )
+ remove_definitions( -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ )
+ add_definitions( -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ )
+ # extra arm-specific flags
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fsigned-char" )
+elseif( X86 )
+ set( _CMAKE_CXX_FLAGS "-funwind-tables" )
+ set( _CMAKE_C_FLAGS "-funwind-tables" )
+elseif( MIPS )
+ set( _CMAKE_CXX_FLAGS "-fpic -Wno-psabi -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers" )
+ set( _CMAKE_CXX_FLAGS "-fpic -Wno-psabi -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers" )
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fsigned-char" )
+else()
+ set( _CMAKE_CXX_FLAGS "" )
+ set( _CMAKE_C_FLAGS "" )
+endif()
+
+if( ANDROID_USE_STLPORT )
+ set( _CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions" )
+ set( _CMAKE_C_FLAGS "${_CMAKE_C_FLAGS} -fno-exceptions" )
+else()
+ set( _CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS} -frtti -fexceptions" )
+ set( _CMAKE_C_FLAGS "${_CMAKE_C_FLAGS} -fexceptions" )
+endif()
+
+# release and debug flags
+if( ARMEABI OR ARMEABI_V7A )
+ if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
+ # It is recommended to use the -mthumb compiler flag to force the generation
+ # of 16-bit Thumb-1 instructions (the default being 32-bit ARM ones).
+ # O3 instead of O2/Os in release mode - like cmake sets for desktop gcc
+ set( _CMAKE_CXX_FLAGS_RELEASE "-mthumb -O3" )
+ set( _CMAKE_C_FLAGS_RELEASE "-mthumb -O3" )
+ set( _CMAKE_CXX_FLAGS_DEBUG "-marm -Os -finline-limit=64" )
+ set( _CMAKE_C_FLAGS_DEBUG "-marm -Os -finline-limit=64" )
+ else()
+ # always compile ARMEABI_V6 in arm mode; otherwise there is no difference from ARMEABI
+ # O3 instead of O2/Os in release mode - like cmake sets for desktop gcc
+ set( _CMAKE_CXX_FLAGS_RELEASE "-marm -O3 -fstrict-aliasing" )
+ set( _CMAKE_C_FLAGS_RELEASE "-marm -O3 -fstrict-aliasing" )
+ set( _CMAKE_CXX_FLAGS_DEBUG "-marm -O0 -finline-limit=300" )
+ set( _CMAKE_C_FLAGS_DEBUG "-marm -O0 -finline-limit=300" )
+ endif()
+elseif( X86 )
+ set( _CMAKE_CXX_FLAGS_RELEASE "-O3 -fstrict-aliasing" )
+ set( _CMAKE_C_FLAGS_RELEASE "-O3 -fstrict-aliasing" )
+ set( _CMAKE_CXX_FLAGS_DEBUG "-O0 -finline-limit=300" )
+ set( _CMAKE_C_FLAGS_DEBUG "-O0 -finline-limit=300" )
+elseif( MIPS )
+ set( _CMAKE_CXX_FLAGS_RELEASE "-O3 -funswitch-loops -finline-limit=300" )
+ set( _CMAKE_C_FLAGS_RELEASE "-O3 -funswitch-loops -finline-limit=300" )
+ set( _CMAKE_CXX_FLAGS_DEBUG "-O0 -g" )
+ set( _CMAKE_C_FLAGS_DEBUG "-O0 -g" )
+endif()
+set( _CMAKE_CXX_FLAGS_RELEASE "${_CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -DNDEBUG" )
+set( _CMAKE_C_FLAGS_RELEASE "${_CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -DNDEBUG" )
+set( _CMAKE_CXX_FLAGS_DEBUG "${_CMAKE_CXX_FLAGS_DEBUG} -fno-strict-aliasing -fno-omit-frame-pointer -DDEBUG -D_DEBUG" )
+set( _CMAKE_C_FLAGS_DEBUG "${_CMAKE_C_FLAGS_DEBUG} -fno-strict-aliasing -fno-omit-frame-pointer -DDEBUG -D_DEBUG" )
+
+# ABI-specific flags
+if( ARMEABI_V7A )
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv7-a -mfloat-abi=softfp" )
+ if( NEON )
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -mfpu=neon" )
+ elseif( VFPV3 )
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -mfpu=vfpv3" )
+ else()
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -mfpu=vfp" )
+ endif()
+elseif( ARMEABI_V6 )
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv6 -mfloat-abi=softfp -mfpu=vfp" )
+elseif( ARMEABI )
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv5te -mtune=xscale -msoft-float" )
+elseif( X86 )
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS}" )#sse?
+endif()
+
+# linker flags
+if( NOT DEFINED __ndklibspath )
+ set( __ndklibspath "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/ndklibs/${ANDROID_NDK_ABI_NAME}" )
+endif()
+list( APPEND ANDROID_SYSTEM_LIB_DIRS "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" )
+set( ANDROID_LINKER_FLAGS "" )
+
+# STL
+if( ANDROID_USE_STLPORT )
+ if( EXISTS "${__stlLibPath}/libstlport_static.a" )
+ set( CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> \"${__stlLibPath}/libstlport_static.a\"")
+ set( CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> \"${__stlLibPath}/libstlport_static.a\"")
+ endif()
+else( ANDROID_USE_STLPORT )
+ if( EXISTS "${__stlLibPath}/libgnustl_static.a" )
+ __COPY_IF_DIFFERENT( "${__stlLibPath}/libgnustl_static.a" "${__ndklibspath}/libstdc++.a" )
+ elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/thumb/libstdc++.a" )
+ __COPY_IF_DIFFERENT( "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/thumb/libstdc++.a" "${__ndklibspath}/libstdc++.a" )
+ elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/libstdc++.a" )
+ __COPY_IF_DIFFERENT( "${__stlLibPath}/${CMAKE_SYSTEM_PROCESSOR}/libstdc++.a" "${__ndklibspath}/libstdc++.a" )
+ elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${__stlLibPath}/thumb/libstdc++.a" )
+ __COPY_IF_DIFFERENT( "${__stlLibPath}/thumb/libstdc++.a" "${__ndklibspath}/libstdc++.a" )
+ elseif( EXISTS "${__stlLibPath}/libstdc++.a" )
+ __COPY_IF_DIFFERENT( "${__stlLibPath}/libstdc++.a" "${__ndklibspath}/libstdc++.a" )
+ endif()
+ if( EXISTS "${__stlLibPath}/libsupc++.a" )
+ __COPY_IF_DIFFERENT( "${__stlLibPath}/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
+ elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libsupc++.a" )
+ __COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
+ elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libsupc++.a" )
+ __COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
+ elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libsupc++.a" )
+ __COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
+ elseif( EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" )
+ __COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
+ endif()
+ list( APPEND ANDROID_SYSTEM_LIB_DIRS "${__ndklibspath}" )
+endif( ANDROID_USE_STLPORT )
+
+# cleanup for STL search
+unset( __stlIncludePath )
+unset( __stlLibPath )
+
+# other linker flags
+__INIT_VARIABLE( ANDROID_NO_UNDEFINED OBSOLETE_NO_UNDEFINED VALUES ON )
+set( ANDROID_NO_UNDEFINED ${ANDROID_NO_UNDEFINED} CACHE BOOL "Show all undefined symbols as linker errors" FORCE )
+mark_as_advanced( ANDROID_NO_UNDEFINED )
+if( ANDROID_NO_UNDEFINED )
+ set( ANDROID_LINKER_FLAGS "-Wl,--no-undefined ${ANDROID_LINKER_FLAGS}" )
+endif()
+
+if (ANDROID_NDK MATCHES "-r[56].?$")
+ # libGLESv2.so in NDK's prior to r7 refers to exteranal symbols. So this flag option is required for all projects using OpenGL from native.
+ __INIT_VARIABLE( ANDROID_SO_UNDEFINED VALUES ON )
+else()
+ __INIT_VARIABLE( ANDROID_SO_UNDEFINED VALUES OFF )
+endif()
+
+set( ANDROID_SO_UNDEFINED ${ANDROID_SO_UNDEFINED} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" FORCE )
+mark_as_advanced( ANDROID_SO_UNDEFINED )
+if( ANDROID_SO_UNDEFINED )
+ set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,-allow-shlib-undefined" )
+endif()
+
+__INIT_VARIABLE( ANDROID_FUNCTION_LEVEL_LINKING VALUES ON )
+set( ANDROID_FUNCTION_LEVEL_LINKING ON CACHE BOOL "Allows or disallows undefined symbols in shared libraries" FORCE )
+mark_as_advanced( ANDROID_FUNCTION_LEVEL_LINKING )
+if( ANDROID_FUNCTION_LEVEL_LINKING )
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fdata-sections -ffunction-sections" )
+ set( ANDROID_LINKER_FLAGS "-Wl,--gc-sections ${ANDROID_LINKER_FLAGS}" )
+endif()
+
+if( ARMEABI_V7A )
+ # this is *required* to use the following linker flags that routes around
+ # a CPU bug in some Cortex-A8 implementations:
+ set( ANDROID_LINKER_FLAGS "-Wl,--fix-cortex-a8 ${ANDROID_LINKER_FLAGS}" )
+endif()
+
+# cache flags
+set( CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags" )
+set( CMAKE_C_FLAGS "${_CMAKE_C_FLAGS}" CACHE STRING "c flags" )
+set( CMAKE_CXX_FLAGS_RELEASE "${_CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "c++ Release flags" )
+set( CMAKE_C_FLAGS_RELEASE "${_CMAKE_C_FLAGS_RELEASE}" CACHE STRING "c Release flags" )
+set( CMAKE_CXX_FLAGS_DEBUG "${_CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "c++ Debug flags" )
+set( CMAKE_C_FLAGS_DEBUG "${_CMAKE_C_FLAGS_DEBUG}" CACHE STRING "c Debug flags" )
+set( CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "linker flags" )
+set( CMAKE_MODULE_LINKER_FLAGS "" CACHE STRING "linker flags" )
+set( CMAKE_EXE_LINKER_FLAGS "-Wl,-z,nocopyreloc" CACHE STRING "linker flags" )
+
+include_directories( SYSTEM ${ANDROID_SYSTEM_INCLUDE_DIRS} )
+link_directories( ${ANDROID_SYSTEM_LIB_DIRS} )
+
+# finish flags
+set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS}" CACHE INTERNAL "Extra Android compiler flags")
+set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS}" CACHE INTERNAL "Extra Android linker flags")
+set( CMAKE_CXX_FLAGS "${ANDROID_CXX_FLAGS} ${CMAKE_CXX_FLAGS}" )
+set( CMAKE_C_FLAGS "${ANDROID_CXX_FLAGS} ${CMAKE_C_FLAGS}" )
+if( MIPS AND BUILD_WITH_ANDROID_NDK )
+ set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/mipself.xsc ${ANDROID_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}" )
+ set( CMAKE_MODULE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/mipself.xsc ${ANDROID_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}" )
+ set( CMAKE_EXE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/mipself.x ${ANDROID_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}" )
+else()
+ set( CMAKE_SHARED_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}" )
+ set( CMAKE_MODULE_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}" )
+ set( CMAKE_EXE_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}" )
+endif()
+
+# set these global flags for cmake client scripts to change behavior
+set( ANDROID True )
+set( BUILD_ANDROID True )
+
+# where is the target environment
+set( CMAKE_FIND_ROOT_PATH "${ANDROID_TOOLCHAIN_ROOT}/bin" "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}" "${ANDROID_SYSROOT}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}/share" )
+
+# only search for libraries and includes in the ndk toolchain
+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()
+
+
+macro( ANDROID_GET_ABI_RAWNAME TOOLCHAIN_FLAG VAR )
+ if( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI" )
+ set( ${VAR} "armeabi" )
+ elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI_V7A" )
+ set( ${VAR} "armeabi-v7a" )
+ elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86" )
+ set( ${VAR} "x86" )
+ else()
+ set( ${VAR} "unknown" )
+ endif()
+endmacro()
+
+
+# export toolchain settings for the try_compile() command
+if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" )
+ set( __toolchain_config "")
+ foreach( __var ANDROID_ABI ANDROID_FORCE_ARM_BUILD ANDROID_NATIVE_API_LEVEL ANDROID_NO_UNDEFINED ANDROID_SO_UNDEFINED ANDROID_SET_OBSOLETE_VARIABLES LIBRARY_OUTPUT_PATH_ROOT ANDROID_USE_STLPORT ANDROID_FORBID_SYGWIN ANDROID_NDK ANDROID_STANDALONE_TOOLCHAIN ANDROID_FUNCTION_LEVEL_LINKING __ndklibspath )
+ if( DEFINED ${__var} )
+ if( "${__var}" MATCHES " ")
+ set( __toolchain_config "${__toolchain_config}set( ${__var} \"${${__var}}\" CACHE INTERNAL \"\" )\n" )
+ else()
+ set( __toolchain_config "${__toolchain_config}set( ${__var} ${${__var}} CACHE INTERNAL \"\" )\n" )
+ endif()
+ endif()
+ endforeach()
+ file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/android.toolchain.config.cmake" "${__toolchain_config}" )
+ unset( __toolchain_config )
+ unset( __ndklibspath )
+endif()
+
+
+# set some obsolete variables for backward compatibility
+set( ANDROID_SET_OBSOLETE_VARIABLES ON CACHE BOOL "Define obsolete Andrid-specific cmake variables" )
+mark_as_advanced( ANDROID_SET_OBSOLETE_VARIABLES )
+if( ANDROID_SET_OBSOLETE_VARIABLES )
+ set( ANDROID_API_LEVEL ${ANDROID_NATIVE_API_LEVEL} )
+ set( ARM_TARGET "${ANDROID_ABI}" )
+ set( ARMEABI_NDK_NAME "${ANDROID_NDK_ABI_NAME}" )
+endif()
+
+
+# Variables controlling behavior or set by cmake toolchain:
+# ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips"
+# ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14 (depends on NDK version)
+# ANDROID_SET_OBSOLETE_VARIABLES : ON/OFF
+# ANDROID_USE_STLPORT : OFF/ON - EXPERIMENTAL!!!
+# ANDROID_FORBID_SYGWIN : ON/OFF
+# ANDROID_NO_UNDEFINED : ON/OFF
+# ANDROID_SO_UNDEFINED : OFF/ON (default depends on NDK version)
+# ANDROID_FUNCTION_LEVEL_LINKING : ON/OFF
+# Variables that takes effect only at first run:
+# ANDROID_FORCE_ARM_BUILD : ON/OFF
+# LIBRARY_OUTPUT_PATH_ROOT : <any valid path>
+# Can be set only at the first run:
+# ANDROID_NDK
+# ANDROID_STANDALONE_TOOLCHAIN
+# ANDROID_TOOLCHAIN_NAME : "arm-linux-androideabi-4.4.3" or "arm-linux-androideabi-4.6" or "mipsel-linux-android-4.4.3" or "mipsel-linux-android-4.6" or "x86-4.4.3" or "x86-4.6"
+# Obsolete:
+# ANDROID_API_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL
+# ARM_TARGET : superseded by ANDROID_ABI
+# ARM_TARGETS : superseded by ANDROID_ABI (can be set only)
+# ANDROID_NDK_TOOLCHAIN_ROOT : superseded by ANDROID_STANDALONE_TOOLCHAIN (can be set only)
+# ANDROID_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL (completely removed)
+#
+# Primary read-only variables:
+# ANDROID : always TRUE
+# ARMEABI : TRUE for arm v6 and older devices
+# ARMEABI_V6 : TRUE for arm v6
+# ARMEABI_V7A : TRUE for arm v7a
+# NEON : TRUE if NEON unit is enabled
+# VFPV3 : TRUE if VFP version 3 is enabled
+# X86 : TRUE if configured for x86
+# BUILD_ANDROID : always TRUE
+# BUILD_WITH_ANDROID_NDK : TRUE if NDK is used
+# BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
+# ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
+# ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a" or "x86" depending on ANDROID_ABI
+# ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
+# TOOL_OS_SUFFIX : "" or ".exe" depending on host platform
+# ANDROID_SYSROOT : path to the compiler sysroot
+# ANDROID_SYSTEM_INCLUDE_DIRS
+# ANDROID_SYSTEM_LIB_DIRS
+# Obsolete:
+# ARMEABI_NDK_NAME : superseded by ANDROID_NDK_ABI_NAME
+#
+# Secondary (less stable) read-only variables:
+# ANDROID_COMPILER_VERSION : GCC version used
+# ANDROID_CXX_FLAGS : C/C++ compiler flags required by Android platform
+# ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI
+# ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux"
+# ANDROID_TOOLCHAIN_ROOT : path to the top level of toolchain (standalone or placed inside NDK)
+# ANDROID_SUPPORTED_NATIVE_API_LEVELS : list of native API levels found inside NDK
+#
+# Defaults:
+# ANDROID_DEFAULT_NDK_API_LEVEL
+# ANDROID_DEFAULT_NDK_API_LEVEL_${ARCH}
+# ANDROID_NDK_SEARCH_PATHS
+# ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH
+# ANDROID_SUPPORTED_ABIS_${ARCH}
+# ANDROID_SUPPORTED_NDK_VERSIONS
diff --git a/Source/Android/assets/ButtonA.png b/Source/Android/assets/ButtonA.png
new file mode 100644
index 0000000000..7e685324ae
--- /dev/null
+++ b/Source/Android/assets/ButtonA.png
Binary files differ
diff --git a/Source/Android/assets/ButtonB.png b/Source/Android/assets/ButtonB.png
new file mode 100644
index 0000000000..21da4c20f1
--- /dev/null
+++ b/Source/Android/assets/ButtonB.png
Binary files differ
diff --git a/Source/Android/build.xml b/Source/Android/build.xml
new file mode 100644
index 0000000000..dc36e5c45a
--- /dev/null
+++ b/Source/Android/build.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="Dolphin Emulator" default="help">
+
+ <!-- The local.properties file is created and updated by the 'android' tool.
+ It contains the path to the SDK. It should *NOT* be checked into
+ Version Control Systems. -->
+ <property file="local.properties" />
+
+ <!-- The ant.properties file can be created by you. It is only edited by the
+ 'android' tool to add properties to it.
+ This is the place to change some Ant specific build properties.
+ Here are some properties you may want to change/update:
+
+ source.dir
+ The name of the source directory. Default is 'src'.
+ out.dir
+ The name of the output directory. Default is 'bin'.
+
+ For other overridable properties, look at the beginning of the rules
+ files in the SDK, at tools/ant/build.xml
+
+ Properties related to the SDK location or the project target should
+ be updated using the 'android' tool with the 'update' action.
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems.
+
+ -->
+ <property file="ant.properties" />
+
+ <!-- if sdk.dir was not set from one of the property file, then
+ get it from the ANDROID_HOME env var.
+ This must be done before we load project.properties since
+ the proguard config can use sdk.dir -->
+ <property environment="env" />
+ <condition property="sdk.dir" value="${env.ANDROID_HOME}">
+ <isset property="env.ANDROID_HOME" />
+ </condition>
+
+ <!-- The project.properties file is created and updated by the 'android'
+ tool, as well as ADT.
+
+ This contains project specific properties such as project target, and library
+ dependencies. Lower level build properties are stored in ant.properties
+ (or in .classpath for Eclipse projects).
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems. -->
+ <loadproperties srcFile="project.properties" />
+
+ <!-- quick check on sdk.dir -->
+ <fail
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
+ unless="sdk.dir"
+ />
+
+ <!--
+ Import per project custom build rules if present at the root of the project.
+ This is the place to put custom intermediary targets such as:
+ -pre-build
+ -pre-compile
+ -post-compile (This is typically used for code obfuscation.
+ Compiled code location: ${out.classes.absolute.dir}
+ If this is not done in place, override ${out.dex.input.absolute.dir})
+ -post-package
+ -post-build
+ -pre-clean
+ -->
+ <import file="custom_rules.xml" optional="true" />
+
+ <!-- Import the actual build file.
+
+ To customize existing targets, there are two options:
+ - Customize only one target:
+ - copy/paste the target into this file, *before* the
+ <import> task.
+ - customize it to your needs.
+ - Customize the whole content of build.xml
+ - copy/paste the content of the rules files (minus the top node)
+ into this file, replacing the <import> task.
+ - customize to your needs.
+
+ ***********************
+ ****** IMPORTANT ******
+ ***********************
+ In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+ in order to avoid having your file be overridden by tools such as "android update project"
+ -->
+ <!-- version-tag: 1 -->
+ <import file="${sdk.dir}/tools/ant/build.xml" />
+
+</project>
diff --git a/Source/Android/custom_rules.xml b/Source/Android/custom_rules.xml
new file mode 100644
index 0000000000..3c6d5b53ba
--- /dev/null
+++ b/Source/Android/custom_rules.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="Dolphin" default="help">
+ <property name="ndkbuildopt" value=""/>
+ <target name="-pre-build">
+ <exec executable="${ndk.dir}/ndk-build" failonerror="true">
+ <arg line="-j4 ${ndkbuildopt}"/>
+ <env key="NDK_MODULE_PATH" path="..:../native/ext"/>
+ </exec>
+ </target>
+ <target name="clean" depends="android_rules.clean">
+ <exec executable="${ndk.dir}/ndk-build" failonerror="true">
+ <arg value="clean"/>
+ <env key="NDK_MODULE_PATH" path="..:../native/ext"/>
+ </exec>
+ </target>
+</project>
diff --git a/Source/Android/jni/Android.mk b/Source/Android/jni/Android.mk
new file mode 100644
index 0000000000..68366e380c
--- /dev/null
+++ b/Source/Android/jni/Android.mk
@@ -0,0 +1,189 @@
+LOCAL_PATH := $(call my-dir)
+
+# BEGIN Native Audio Separate Library - copy paste this section to your Android.mk
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := native_audio
+LOCAL_CFLAGS := -O2 -fsigned-char -ffast-math -Wall -Wno-multichar -Wno-psabi -std=gnu++0x
+NATIVE := ../../native
+LOCAL_SRC_FILES := \
+ $(NATIVE)/android/native-audio-so.cpp
+LOCAL_LDLIBS := -lOpenSLES -llog
+
+include $(BUILD_SHARED_LIBRARY)
+
+# END Native Audio Separate Library - copy paste this section to your Android.mk
+
+include $(CLEAR_VARS)
+
+#TARGET_PLATFORM := android-8
+
+LOCAL_MODULE := ppsspp_jni
+
+NATIVE := ../../native
+SRC := ../..
+
+LOCAL_CFLAGS := -DUSE_PROFILER -DARM -DGL_GLEXT_PROTOTYPES -DUSING_GLES2 -O2 -fsigned-char -Wall -Wno-multichar -Wno-psabi -Wno-unused-variable -fno-strict-aliasing -ffast-math
+LOCAL_CXXFLAGS := -std=gnu++0x
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/../../Common \
+ $(LOCAL_PATH)/../.. \
+ $(LOCAL_PATH)/$(NATIVE)/base \
+ $(LOCAL_PATH)/$(NATIVE)/ext/libzip \
+ $(LOCAL_PATH)/$(NATIVE) \
+ $(LOCAL_PATH) \
+
+LOCAL_STATIC_LIBRARIES := native libzip
+LOCAL_LDLIBS := -lz -lGLESv2 -ldl -llog
+
+
+# $(SRC)/Core/EmuThread.cpp \
+
+LOCAL_SRC_FILES := \
+ NativeApp.cpp \
+ EmuScreen.cpp \
+ MenuScreens.cpp \
+ UIShader.cpp \
+ GamepadEmu.cpp \
+ ArmEmitterTest.cpp \
+ ui_atlas.cpp \
+ $(SRC)/native/android/app-android.cpp \
+ $(SRC)/ext/disarm.cpp \
+ $(SRC)/ext/libkirk/AES.c \
+ $(SRC)/ext/libkirk/SHA1.c \
+ $(SRC)/ext/libkirk/bn.c \
+ $(SRC)/ext/libkirk/ec.c \
+ $(SRC)/ext/libkirk/kirk_engine.c \
+ $(SRC)/ext/snappy/snappy-c.cpp \
+ $(SRC)/ext/snappy/snappy.cpp \
+ $(SRC)/Common/ArmEmitter.cpp \
+ $(SRC)/Common/ArmCPUDetect.cpp \
+ $(SRC)/Common/ArmThunk.cpp \
+ $(SRC)/Common/LogManager.cpp \
+ $(SRC)/Common/MemArena.cpp \
+ $(SRC)/Common/MemoryUtil.cpp \
+ $(SRC)/Common/MsgHandler.cpp \
+ $(SRC)/Common/IniFile.cpp \
+ $(SRC)/Common/FileUtil.cpp \
+ $(SRC)/Common/StringUtil.cpp \
+ $(SRC)/Common/Thread.cpp \
+ $(SRC)/Common/Timer.cpp \
+ $(SRC)/Common/Misc.cpp \
+ $(SRC)/Common/MathUtil.cpp \
+ $(SRC)/GPU/Math3D.cpp \
+ $(SRC)/GPU/GPUCommon.cpp \
+ $(SRC)/GPU/GPUState.cpp \
+ $(SRC)/GPU/GeDisasm.cpp \
+ $(SRC)/GPU/GLES/Framebuffer.cpp \
+ $(SRC)/GPU/GLES/DisplayListInterpreter.cpp \
+ $(SRC)/GPU/GLES/TextureCache.cpp \
+ $(SRC)/GPU/GLES/IndexGenerator.cpp \
+ $(SRC)/GPU/GLES/TransformPipeline.cpp \
+ $(SRC)/GPU/GLES/StateMapping.cpp \
+ $(SRC)/GPU/GLES/VertexDecoder.cpp \
+ $(SRC)/GPU/GLES/ShaderManager.cpp \
+ $(SRC)/GPU/GLES/VertexShaderGenerator.cpp \
+ $(SRC)/GPU/GLES/FragmentShaderGenerator.cpp \
+ $(SRC)/GPU/Null/NullGpu.cpp \
+ $(SRC)/Core/ELF/ElfReader.cpp \
+ $(SRC)/Core/ELF/PrxDecrypter.cpp \
+ $(SRC)/Core/ELF/ParamSFO.cpp \
+ $(SRC)/Core/HW/MemoryStick.cpp \
+ $(SRC)/Core/HW/MediaEngine.cpp \
+ $(SRC)/Core/HW/SasAudio.cpp \
+ $(SRC)/Core/Core.cpp \
+ $(SRC)/Core/Config.cpp \
+ $(SRC)/Core/CoreTiming.cpp \
+ $(SRC)/Core/CPU.cpp \
+ $(SRC)/Core/Host.cpp \
+ $(SRC)/Core/Loaders.cpp \
+ $(SRC)/Core/PSPLoaders.cpp \
+ $(SRC)/Core/MemMap.cpp \
+ $(SRC)/Core/MemMapFunctions.cpp \
+ $(SRC)/Core/SaveState.cpp \
+ $(SRC)/Core/System.cpp \
+ $(SRC)/Core/PSPMixer.cpp \
+ $(SRC)/Core/Debugger/Breakpoints.cpp \
+ $(SRC)/Core/Debugger/SymbolMap.cpp \
+ $(SRC)/Core/Dialog/PSPDialog.cpp \
+ $(SRC)/Core/Dialog/PSPMsgDialog.cpp \
+ $(SRC)/Core/Dialog/PSPOskDialog.cpp \
+ $(SRC)/Core/Dialog/PSPPlaceholderDialog.cpp \
+ $(SRC)/Core/Dialog/PSPSaveDialog.cpp \
+ $(SRC)/Core/Dialog/SavedataParam.cpp \
+ $(SRC)/Core/HLE/HLETables.cpp \
+ $(SRC)/Core/HLE/HLE.cpp \
+ $(SRC)/Core/HLE/sceAtrac.cpp \
+ $(SRC)/Core/HLE/__sceAudio.cpp \
+ $(SRC)/Core/HLE/sceAudio.cpp \
+ $(SRC)/Core/HLE/sceCtrl.cpp \
+ $(SRC)/Core/HLE/sceDisplay.cpp \
+ $(SRC)/Core/HLE/sceDmac.cpp \
+ $(SRC)/Core/HLE/sceGe.cpp \
+ $(SRC)/Core/HLE/sceFont.cpp \
+ $(SRC)/Core/HLE/sceHprm.cpp \
+ $(SRC)/Core/HLE/sceHttp.cpp \
+ $(SRC)/Core/HLE/sceImpose.cpp \
+ $(SRC)/Core/HLE/sceIo.cpp \
+ $(SRC)/Core/HLE/sceKernel.cpp \
+ $(SRC)/Core/HLE/sceKernelAlarm.cpp \
+ $(SRC)/Core/HLE/sceKernelEventFlag.cpp \
+ $(SRC)/Core/HLE/sceKernelInterrupt.cpp \
+ $(SRC)/Core/HLE/sceKernelMemory.cpp \
+ $(SRC)/Core/HLE/sceKernelModule.cpp \
+ $(SRC)/Core/HLE/sceKernelMutex.cpp \
+ $(SRC)/Core/HLE/sceKernelMbx.cpp \
+ $(SRC)/Core/HLE/sceKernelMsgPipe.cpp \
+ $(SRC)/Core/HLE/sceKernelSemaphore.cpp \
+ $(SRC)/Core/HLE/sceKernelThread.cpp \
+ $(SRC)/Core/HLE/sceKernelTime.cpp \
+ $(SRC)/Core/HLE/sceKernelVTimer.cpp \
+ $(SRC)/Core/HLE/sceMpeg.cpp \
+ $(SRC)/Core/HLE/sceNet.cpp \
+ $(SRC)/Core/HLE/sceOpenPSID.cpp \
+ $(SRC)/Core/HLE/sceParseHttp.cpp \
+ $(SRC)/Core/HLE/sceParseUri.cpp \
+ $(SRC)/Core/HLE/scePower.cpp \
+ $(SRC)/Core/HLE/sceRtc.cpp \
+ $(SRC)/Core/HLE/scePsmf.cpp \
+ $(SRC)/Core/HLE/sceSas.cpp \
+ $(SRC)/Core/HLE/sceSsl.cpp \
+ $(SRC)/Core/HLE/sceUmd.cpp \
+ $(SRC)/Core/HLE/sceUsb.cpp \
+ $(SRC)/Core/HLE/sceUtility.cpp \
+ $(SRC)/Core/HLE/sceVaudio.cpp \
+ $(SRC)/Core/FileSystems/BlockDevices.cpp \
+ $(SRC)/Core/FileSystems/ISOFileSystem.cpp \
+ $(SRC)/Core/FileSystems/MetaFileSystem.cpp \
+ $(SRC)/Core/FileSystems/DirectoryFileSystem.cpp \
+ $(SRC)/Core/MIPS/MIPS.cpp.arm \
+ $(SRC)/Core/MIPS/MIPSAnalyst.cpp \
+ $(SRC)/Core/MIPS/MIPSDis.cpp \
+ $(SRC)/Core/MIPS/MIPSDisVFPU.cpp \
+ $(SRC)/Core/MIPS/MIPSInt.cpp.arm \
+ $(SRC)/Core/MIPS/MIPSIntVFPU.cpp.arm \
+ $(SRC)/Core/MIPS/MIPSTables.cpp.arm \
+ $(SRC)/Core/MIPS/MIPSVFPUUtils.cpp \
+ $(SRC)/Core/MIPS/MIPSCodeUtils.cpp \
+ $(SRC)/Core/MIPS/MIPSDebugInterface.cpp \
+ $(SRC)/Core/MIPS/JitCommon/JitCommon.cpp \
+ $(SRC)/Core/MIPS/ARM/ArmJitCache.cpp \
+ $(SRC)/Core/MIPS/ARM/ArmCompALU.cpp \
+ $(SRC)/Core/MIPS/ARM/ArmCompBranch.cpp \
+ $(SRC)/Core/MIPS/ARM/ArmCompFPU.cpp \
+ $(SRC)/Core/MIPS/ARM/ArmCompLoadStore.cpp \
+ $(SRC)/Core/MIPS/ARM/ArmCompVFPU.cpp \
+ $(SRC)/Core/MIPS/ARM/ArmAsm.cpp \
+ $(SRC)/Core/MIPS/ARM/ArmJit.cpp \
+ $(SRC)/Core/MIPS/ARM/ArmRegCache.cpp \
+ $(SRC)/Core/MIPS/ARM/ArmRegCacheFPU.cpp \
+ $(SRC)/Core/Util/BlockAllocator.cpp \
+ $(SRC)/Core/Util/ppge_atlas.cpp \
+ $(SRC)/Core/Util/PPGeDraw.cpp
+
+
+include $(BUILD_SHARED_LIBRARY)
+
+$(call import-module,libzip)
+$(call import-module,native)
diff --git a/Source/Android/jni/Application.mk b/Source/Android/jni/Application.mk
new file mode 100644
index 0000000000..d18d3a46ff
--- /dev/null
+++ b/Source/Android/jni/Application.mk
@@ -0,0 +1,4 @@
+APP_STL := stlport_static
+APP_ABI := armeabi-v7a armeabi
+
+#APP_ABI := armeabi-v7a
diff --git a/Source/Android/project.properties b/Source/Android/project.properties
new file mode 100644
index 0000000000..a3ee5ab64f
--- /dev/null
+++ b/Source/Android/project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-17
diff --git a/Source/Android/res/drawable-hdpi/launcher.png b/Source/Android/res/drawable-hdpi/launcher.png
new file mode 100644
index 0000000000..da35bbad81
--- /dev/null
+++ b/Source/Android/res/drawable-hdpi/launcher.png
Binary files differ
diff --git a/Source/Android/res/drawable-mdpi/launcher.png b/Source/Android/res/drawable-mdpi/launcher.png
new file mode 100644
index 0000000000..03e5eea949
--- /dev/null
+++ b/Source/Android/res/drawable-mdpi/launcher.png
Binary files differ
diff --git a/Source/Android/res/drawable-xhdpi/launcher.png b/Source/Android/res/drawable-xhdpi/launcher.png
new file mode 100644
index 0000000000..28770da81f
--- /dev/null
+++ b/Source/Android/res/drawable-xhdpi/launcher.png
Binary files differ
diff --git a/Source/Android/res/drawable-xxhdpi/launcher.png b/Source/Android/res/drawable-xxhdpi/launcher.png
new file mode 100644
index 0000000000..7cb72b57bb
--- /dev/null
+++ b/Source/Android/res/drawable-xxhdpi/launcher.png
Binary files differ
diff --git a/Source/Android/res/layout/main.xml b/Source/Android/res/layout/main.xml
new file mode 100644
index 0000000000..6116f6c33d
--- /dev/null
+++ b/Source/Android/res/layout/main.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/TextView01"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="5dip"
+ android:layout_marginTop="5dip"
+ android:singleLine="true"
+ android:text="@+id/TextView01"
+ android:textStyle="bold" >
+ </TextView>
+
+ <TextView
+ android:id="@+id/TextView02"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="10dip"
+ android:text="@+id/TextView02" >
+ </TextView>
+
+</LinearLayout>
diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml
new file mode 100644
index 0000000000..2cfdcb6e7e
--- /dev/null
+++ b/Source/Android/res/values/strings.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="app_name">Dolphin Emulator</string>
+
+</resources>
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/Button.java b/Source/Android/src/org/dolphinemu/dolphinemu/Button.java
new file mode 100644
index 0000000000..629e572d83
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/Button.java
@@ -0,0 +1,33 @@
+package org.dolphinemu.dolphinemu;
+
+public class Button {
+ private String ButtonID;
+ private float _x;
+ private float _y;
+ private float _ex;
+ private float _ey;
+ public Button(String Button, float[] Coords)
+ {
+ ButtonID = Button;
+ _x = Coords[0];
+ _y = Coords[1];
+ _ex = Coords[4];
+ _ey = Coords[5];
+ }
+ public float X()
+ {
+ return _x;
+ }
+ public float Y()
+ {
+ return _y;
+ }
+ public float EX()
+ {
+ return _ex;
+ }
+ public float EY()
+ {
+ return _ey;
+ }
+}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/ButtonManager.java b/Source/Android/src/org/dolphinemu/dolphinemu/ButtonManager.java
new file mode 100644
index 0000000000..ee7a8f79d0
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/ButtonManager.java
@@ -0,0 +1,43 @@
+package org.dolphinemu.dolphinemu;
+
+public class ButtonManager {
+
+ private final int NUMBUTTONS = 15;
+
+ Button[] Buttons;
+ float[][] ButtonCoords =
+ { // X, Y, X, EY, EX, EY, EX, Y
+ {0.75f, -1.0f, 0.75f, -0.75f, 1.0f, -0.75f, 1.0f, -1.0f},
+ {0.50f, -1.0f, 0.50f, -0.75f, 0.75f, -0.75f, 0.75f, -1.0f},
+ };
+ public ButtonManager()
+ {
+ Buttons = new Button[NUMBUTTONS];
+
+ Buttons[0] = new Button("A", ButtonCoords[0]);
+ Buttons[1] = new Button("B", ButtonCoords[1]);
+
+ }
+ Button GetButton(int ID)
+ {
+ return Buttons[ID];
+ }
+ float[][] GetButtonCoords()
+ {
+ return ButtonCoords;
+ }
+ public int ButtonPressed(int action, float x, float y)
+ {
+ for (int a = 0; a < 2; ++a)
+ {
+ if (x >= Buttons[a].X() &&
+ x <= Buttons[a].EX() &&
+ -y >= Buttons[a].Y() &&
+ -y <= Buttons[a].EY())
+ {
+ return a;
+ }
+ }
+ return -1;
+ }
+}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
new file mode 100644
index 0000000000..f95195b53e
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
@@ -0,0 +1,124 @@
+package org.dolphinemu.dolphinemu;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.opengl.GLSurfaceView;
+import android.os.Bundle;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.WindowManager;
+
+public class DolphinEmulator<MainActivity> extends Activity {
+
+ static private NativeGLSurfaceView GLview = null;
+ static private NativeRenderer Renderer = null;
+ static private boolean Running = false;
+
+ private float screenWidth;
+ private float screenHeight;
+
+ public static native void SetKey(int Value, int Key);
+
+ static
+ {
+ try
+ {
+ System.loadLibrary("dolphin-emu-nogui");
+ }
+ catch (Exception ex)
+ {
+ Log.w("me", ex.toString());
+ }
+ }
+ @Override
+ public void onStop()
+ {
+ super.onStop();
+ if (Running)
+ Renderer.StopEmulation();
+ }
+ @Override
+ public void onPause()
+ {
+ super.onPause();
+ if (Running)
+ Renderer.PauseEmulation();
+ }
+ @Override
+ public void onResume()
+ {
+ super.onResume();
+ if (Running)
+ Renderer.UnPauseEmulation();
+ }
+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ if (savedInstanceState == null)
+ {
+ Intent ListIntent = new Intent(this, NativeListView.class);
+ startActivityForResult(ListIntent, 1);
+ }
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data)
+ {
+ super.onActivityResult(requestCode, resultCode, data);
+
+ if (resultCode == Activity.RESULT_OK)
+ {
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ WindowManager wm = (WindowManager) getApplicationContext().getSystemService(getApplicationContext().WINDOW_SERVICE); // the results will be higher than using the activity context object or the getWindowManager() shortcut
+ wm.getDefaultDisplay().getMetrics(displayMetrics);
+ screenWidth = displayMetrics.widthPixels;
+ screenHeight = displayMetrics.heightPixels;
+
+
+ String FileName = data.getStringExtra("Select");
+ Renderer = new NativeRenderer();
+ Renderer.setContext(getApplicationContext());
+
+ GLview = new NativeGLSurfaceView(this);
+ GLview.setEGLContextClientVersion(2);
+ GLview.setRenderer(Renderer);
+
+ GLview.SetFileName(FileName);
+ setContentView(GLview);
+ Running = true;
+ }
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event)
+ {
+ float X, Y;
+ int Action;
+ X = event.getX();
+ Y = event.getY();
+ Action = event.getActionMasked();
+
+ int Button = Renderer.ButtonPressed(Action, ((X / screenWidth) * 2.0f) - 1.0f, ((Y / screenHeight) * 2.0f) - 1.0f);
+
+ if (Button != -1)
+ SetKey(Action, Button);
+
+ return false;
+ }
+
+ public boolean overrideKeys()
+ {
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FileArrayAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/FileArrayAdapter.java
new file mode 100644
index 0000000000..b49149a36c
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/FileArrayAdapter.java
@@ -0,0 +1,53 @@
+package org.dolphinemu.dolphinemu;
+
+import java.util.List;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+
+public class FileArrayAdapter extends ArrayAdapter<Option>{
+
+ private Context c;
+ private int id;
+ private List<Option>items;
+
+ public FileArrayAdapter(Context context, int textViewResourceId,
+ List<Option> objects) {
+ super(context, textViewResourceId, objects);
+ c = context;
+ id = textViewResourceId;
+ items = objects;
+ }
+ public Option getItem(int i)
+ {
+ return items.get(i);
+ }
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View v = convertView;
+ if (v == null) {
+ LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ v = vi.inflate(id, null);
+ }
+ final Option o = items.get(position);
+ if (o != null) {
+ TextView t1 = (TextView) v.findViewById(R.id.TextView01);
+ TextView t2 = (TextView) v.findViewById(R.id.TextView02);
+
+ if(t1!=null)
+ t1.setText(o.getName());
+ if(t2!=null)
+ t2.setText(o.getData());
+
+ }
+ return v;
+ }
+
+
+
+}
+
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java
new file mode 100644
index 0000000000..0babd5b919
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java
@@ -0,0 +1,61 @@
+package org.dolphinemu.dolphinemu;
+
+import android.content.Context;
+import android.opengl.GLSurfaceView;
+import android.util.Log;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+
+public class NativeGLSurfaceView extends GLSurfaceView {
+ static private String FileName;
+ static private Thread myRun;
+ static private boolean Running = false;
+ static private boolean Created = false;
+
+ public static native void main(String File, Surface surf);
+
+ static
+ {
+ try
+ {
+ System.loadLibrary("dolphin-emu-nogui");
+ }
+ catch (Exception ex)
+ {
+ Log.w("me", ex.toString());
+ }
+ }
+
+
+ public NativeGLSurfaceView(Context context) {
+ super(context);
+ if (!Created)
+ {
+ myRun = new Thread()
+ {
+ @Override
+ public void run() {
+ main(FileName, getHolder().getSurface());
+ }
+ };
+ Created = true;
+ }
+ }
+
+ public void surfaceCreated(SurfaceHolder holder)
+ {
+ super.surfaceCreated(holder);
+ if (!Running)
+ {
+ myRun.start();
+ Running = true;
+ }
+ }
+
+ public void SetFileName(String file)
+ {
+ FileName = file;
+ }
+
+
+}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeListView.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeListView.java
new file mode 100644
index 0000000000..0b30cda639
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeListView.java
@@ -0,0 +1,94 @@
+package org.dolphinemu.dolphinemu;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import android.app.Activity;
+import android.app.ListActivity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Environment;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.Toast;
+
+public class NativeListView extends ListActivity {
+ private FileArrayAdapter adapter;
+ static private File currentDir = null;
+
+ private void Fill(File f)
+ {
+ File[]dirs = f.listFiles();
+ this.setTitle("Current Dir: " + f.getName());
+ List<Option>dir = new ArrayList<Option>();
+ List<Option>fls = new ArrayList<Option>();
+
+ try
+ {
+ for(File ff: dirs)
+ {
+ if (ff.getName().charAt(0) != '.')
+ if(ff.isDirectory())
+ dir.add(new Option(ff.getName(),"Folder",ff.getAbsolutePath()));
+ else
+ if (ff.getName().toLowerCase().indexOf(".gcm") >= 0 ||
+ ff.getName().toLowerCase().indexOf(".iso") >= 0 ||
+ ff.getName().toLowerCase().indexOf(".wbfs") >= 0 ||
+ ff.getName().toLowerCase().indexOf(".gcz") >= 0 ||
+ ff.getName().toLowerCase().indexOf(".dol") >= 0 ||
+ ff.getName().toLowerCase().indexOf(".elf") >= 0)
+ fls.add(new Option(ff.getName(),"File Size: "+ff.length(),ff.getAbsolutePath()));
+ }
+ }
+ catch(Exception e)
+ {
+ }
+
+ Collections.sort(dir);
+ Collections.sort(fls);
+ dir.addAll(fls);
+
+ if(!f.getName().equalsIgnoreCase("sdcard"))
+ dir.add(0,new Option("..","Parent Directory",f.getParent()));
+ adapter = new FileArrayAdapter(this,R.layout.main,dir);
+ this.setListAdapter(adapter);
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ // TODO Auto-generated method stub
+ super.onListItemClick(l, v, position, id);
+ Option o = adapter.getItem(position);
+ if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){
+ currentDir = new File(o.getPath());
+ Fill(currentDir);
+ }
+ else
+ {
+ onFileClick(o.getPath());
+ }
+ }
+
+ private void onFileClick(String o)
+ {
+ Toast.makeText(this, "File Clicked: " + o, Toast.LENGTH_SHORT).show();
+
+ Intent intent = new Intent();
+ intent.putExtra("Select", o);
+ setResult(Activity.RESULT_OK, intent);
+
+ this.finish();
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ if(currentDir == null)
+ currentDir = new File(Environment.getExternalStorageDirectory().getPath());
+ Fill(currentDir);
+ }
+}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeRenderer.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeRenderer.java
new file mode 100644
index 0000000000..f802cd2b55
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeRenderer.java
@@ -0,0 +1,168 @@
+package org.dolphinemu.dolphinemu;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Matrix;
+import android.opengl.GLES20;
+import android.opengl.GLSurfaceView;
+import android.opengl.GLUtils;
+import android.util.Log;
+
+public class NativeRenderer implements GLSurfaceView.Renderer {
+ // Button Manager
+ private static ButtonManager Buttons;
+
+ private static boolean Running = false;
+
+ // Context
+ private static Context _gContext;
+
+ // Native
+ public static native void DrawME();
+ public static native void DrawButton(int GLTex, int ID);
+ public static native void SetButtonCoords(float[] Coords);
+ public static native void PrepareME();
+ public static native void UnPauseEmulation();
+ public static native void PauseEmulation();
+ public static native void StopEmulation();
+
+ // Texture loading
+ private static int buttonA = -1;
+ private static int buttonB = -1;
+
+ // Get a new texture id:
+ private static int newTextureID(GL10 gl)
+ {
+ int[] temp = new int[1];
+ gl.glGenTextures(1, temp, 0);
+ return temp[0];
+ }
+
+ // Will load a texture out of a drawable resource file, and return an OpenGL texture ID:
+ private int loadTexture(GL10 gl, String resource)
+ {
+ // In which ID will we be storing this texture?
+ int id = newTextureID(gl);
+
+ // Load up, and flip the texture:
+ InputStream File = null;
+ try {
+ File = _gContext.getAssets().open(resource);
+ }
+ catch (IOException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return 0;
+ }
+
+ Bitmap bmp = BitmapFactory.decodeStream(File);
+
+ gl.glBindTexture(GL10.GL_TEXTURE_2D, id);
+
+ // Set all of our texture parameters:
+ gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR_MIPMAP_LINEAR);
+ gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR_MIPMAP_LINEAR);
+ gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
+ gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);
+
+ // Generate, and load up all of the mipmaps:
+ for(int level=0, height = bmp.getHeight(), width = bmp.getWidth(); true; level++)
+ {
+ // Push the bitmap onto the GPU:
+ GLUtils.texImage2D(GL10.GL_TEXTURE_2D, level, bmp, 0);
+
+ // We need to stop when the texture is 1x1:
+ if(height==1 && width==1) break;
+
+ // Resize, and let's go again:
+ width >>= 1; height >>= 1;
+ if(width<1) width = 1;
+ if(height<1) height = 1;
+
+ Bitmap bmp2 = Bitmap.createScaledBitmap(bmp, width, height, true);
+ bmp.recycle();
+ bmp = bmp2;
+ }
+ bmp.recycle();
+
+ return id;
+ }
+
+ static
+ {
+ try
+ {
+ System.loadLibrary("dolphin-emu-nogui");
+ }
+ catch (Exception ex)
+ {
+ Log.w("me", ex.toString());
+ }
+ if (!Running)
+ Buttons = new ButtonManager();
+ }
+
+ public void onSurfaceChanged(GL10 gl, int width, int height)
+ {
+ gl.glViewport(0, 0, width, height);
+ }
+
+ public void onSurfaceCreated(GL10 gl, EGLConfig config)
+ {
+ if (!Running)
+ {
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ gl.glEnable(GL10.GL_BLEND);
+ gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
+
+ buttonA = loadTexture(gl, "ButtonA.png");
+ buttonB = loadTexture(gl, "ButtonB.png");
+ SetButtonCoords(Flatten(Buttons.GetButtonCoords()));
+ PrepareME();
+ Running = true;
+ }
+ }
+ public static float[] Flatten(float[][] data) {
+
+ float[] list = new float[data.length * data[0].length];
+
+ for(int y = 0; y < data.length; ++y)
+ for (int x = 0; x < data[y].length; ++x)
+ list[y * data[0].length + x] = data[y][x];
+ return list;
+ }
+ public void onDrawFrame(GL10 gl)
+ {
+ if (Running)
+ {
+ gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
+ DrawME();
+
+ // -1 is left
+ // -1 is bottom
+
+ DrawButton(buttonA, 0);
+ DrawButton(buttonB, 1);
+ }
+ }
+ public void setContext(Context ctx)
+ {
+ _gContext = ctx;
+ }
+ public int ButtonPressed(int action, float x, float y)
+ {
+ return Buttons.ButtonPressed(action, x, y);
+ }
+}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/Option.java b/Source/Android/src/org/dolphinemu/dolphinemu/Option.java
new file mode 100644
index 0000000000..dba6dfd534
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/Option.java
@@ -0,0 +1,38 @@
+package org.dolphinemu.dolphinemu;
+
+public class Option implements Comparable<Option>{
+ private String name;
+ private String data;
+ private String path;
+
+ public Option(String n,String d,String p)
+ {
+ name = n;
+ data = d;
+ path = p;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getData()
+ {
+ return data;
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public int compareTo(Option o)
+ {
+ if(this.name != null)
+ return this.name.toLowerCase().compareTo(o.getName().toLowerCase());
+ else
+ throw new IllegalArgumentException();
+ }
+}
+