mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-12 12:08:00 +01:00
android: migrate from ant to gradle
This commit is contained in:
parent
45d36870ad
commit
54a305b3ec
22 changed files with 287 additions and 273 deletions
|
@ -1,19 +0,0 @@
|
|||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked in Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
||||
java.source=1.6
|
||||
java.target=1.6
|
18
android/app/build.gradle.in
Normal file
18
android/app/build.gradle.in
Normal file
|
@ -0,0 +1,18 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
defaultConfig {
|
||||
applicationId "${LIBSUPERDERPY_APPID}"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion ${ANDROID_TARGET_VERSION}
|
||||
versionCode ${LIBSUPERDERPY_RELEASE}
|
||||
versionName "${LIBSUPERDERPY_VERSION}"
|
||||
}
|
||||
sourceSets { main { jniLibs.srcDirs = ['libs'] } }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//implementation fileTree(dir: 'libs', include: ['*.jar', '*.so'])
|
||||
implementation "org.liballeg.android:allegro:1.0@aar"
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="${LIBSUPERDERPY_RELEASE}"
|
||||
android:versionName="${LIBSUPERDERPY_VERSION}"
|
||||
android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="${ANDROID_TARGET_VERSION}" />
|
||||
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="${ANDROID_TARGET_VERSION}" />
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" android:resizeable="true" />
|
||||
<application android:label="@string/app_name" android:debuggable="${LIBSUPERDERPY_ANDROID_DEBUGGABLE}" android:icon="@mipmap/${LIBSUPERDERPY_GAMENAME}">
|
|
@ -0,0 +1,66 @@
|
|||
package net.dosowisko.libsuperderpy;
|
||||
|
||||
import org.liballeg.android.AllegroActivity;
|
||||
import android.util.Log;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
public class Activity extends AllegroActivity {
|
||||
|
||||
static void loadLibrary(String name) {
|
||||
try {
|
||||
// try loading the debug library first.
|
||||
Log.d("loadLibrary", name + "-debug");
|
||||
System.loadLibrary(name + "-debug");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
try {
|
||||
// If it fails load the release library.
|
||||
Log.d("loadLibrary", name);
|
||||
System.loadLibrary(name);
|
||||
} catch (UnsatisfiedLinkError e2) {
|
||||
// We still continue as failing to load an addon may
|
||||
// not be a fatal error - for example if the TTF was
|
||||
// not built we can still run an example which does not
|
||||
// need that addon.
|
||||
Log.d("loadLibrary", name + " FAILED");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Load Allegro and other shared libraries in the lib directory of the apk
|
||||
* bundle. You must load libraries which are required by later libraries
|
||||
* first.
|
||||
*/
|
||||
static {
|
||||
loadLibrary("allegro");
|
||||
loadLibrary("allegro_primitives");
|
||||
loadLibrary("allegro_image");
|
||||
loadLibrary("allegro_font");
|
||||
loadLibrary("allegro_ttf");
|
||||
loadLibrary("allegro_audio");
|
||||
loadLibrary("allegro_acodec");
|
||||
loadLibrary("allegro_color");
|
||||
loadLibrary("allegro_memfile");
|
||||
loadLibrary("allegro_physfs");
|
||||
loadLibrary("allegro_video");
|
||||
loadLibrary("libsuperderpy");
|
||||
loadLibrary("libsuperderpy-${LIBSUPERDERPY_GAMENAME}");
|
||||
}
|
||||
|
||||
/* By default, AllegroActivity.onCreate will cause Allegro to load the
|
||||
* shared object `libapp.so'. You can specify another library name by
|
||||
* overriding the constructor.
|
||||
*/
|
||||
public Activity() {
|
||||
super("libgame.so");
|
||||
}
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (android.os.Build.VERSION.SDK_INT >= 19) {
|
||||
this.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
}
|
||||
}
|
||||
}
|
17
android/build.gradle
Normal file
17
android/build.gradle
Normal file
|
@ -0,0 +1,17 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:3.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
flatDir { dirs 'libs' }
|
||||
}
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="@LIBSUPERDERPY_GAMENAME@" 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" />
|
||||
|
||||
<!-- This file is generated by CMake. -->
|
||||
<property file="localgen.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>
|
|
@ -1,19 +0,0 @@
|
|||
<project>
|
||||
<!-- Overriding jar.libs.dir is broken from some SDK version onwards
|
||||
and seems like it won't be fixed:
|
||||
https://code.google.com/p/android/issues/detail?id=33194
|
||||
|
||||
This workaround is from:
|
||||
http://stackoverflow.com/questions/11637852
|
||||
-->
|
||||
<property file="localgen.properties" />
|
||||
<target name="-pre-compile">
|
||||
<path id="project.all.jars.path">
|
||||
<path path="${toString:project.all.jars.path}"/>
|
||||
<fileset dir="${jar.libs.dir}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</path>
|
||||
</target>
|
||||
</project>
|
||||
<!-- vim: set ft=ant et: -->
|
BIN
android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
#Thu Aug 24 20:59:32 EDT 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
160
android/gradlew
vendored
Executable file
160
android/gradlew
vendored
Executable file
|
@ -0,0 +1,160 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
|
@ -1,3 +0,0 @@
|
|||
include $(call my-dir)/localgen.mk
|
||||
APP_PLATFORM := android-16
|
||||
APP_ABI := $(TARGET_ARCH_ABI)
|
|
@ -1,12 +0,0 @@
|
|||
# Absolute paths to Allegro source and build directories.
|
||||
CMAKE_SOURCE_DIR := ${CMAKE_SOURCE_DIR}
|
||||
CMAKE_BINARY_DIR := ${CMAKE_BINARY_DIR}
|
||||
|
||||
# Relative path to prebuilt Allegro libraries from LOCAL_PATH.
|
||||
RELATIVE_LIB_DIR := ${RELATIVE_LIB_DIR}
|
||||
|
||||
# Library type suffix on Allegro libraries, e.g. "-debug".
|
||||
# XXX changing this requires manual editing of the System.loadLibrary calls
|
||||
LIB_TYPE_SUFFIX := ${LIB_TYPE_SUFFIX}
|
||||
|
||||
TARGET_ARCH_ABI := ${ARM_TARGETS}
|
1
android/local.properties.in
Normal file
1
android/local.properties.in
Normal file
|
@ -0,0 +1 @@
|
|||
sdk.dir=${ANDROID_HOME}
|
|
@ -1 +0,0 @@
|
|||
jar.libs.dir=${LIBRARY_OUTPUT_PATH}
|
|
@ -1,20 +0,0 @@
|
|||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
|
@ -1,11 +0,0 @@
|
|||
# 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 use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=@ANDROID_TARGET@
|
1
android/settings.gradle
Normal file
1
android/settings.gradle
Normal file
|
@ -0,0 +1 @@
|
|||
include ":app"
|
|
@ -1,42 +0,0 @@
|
|||
package net.dosowisko.libsuperderpy;
|
||||
|
||||
import org.liballeg.android.AllegroActivity;
|
||||
import android.view.View;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class Activity extends AllegroActivity {
|
||||
|
||||
/* Load Allegro and other shared libraries in the lib directory of the apk
|
||||
* bundle. You must load libraries which are required by later libraries
|
||||
* first.
|
||||
*/
|
||||
static {
|
||||
System.loadLibrary("allegro${ALLEGRO_DEBUG_SUFFIX}");
|
||||
System.loadLibrary("allegro_primitives${ALLEGRO_DEBUG_SUFFIX}");
|
||||
System.loadLibrary("allegro_image${ALLEGRO_DEBUG_SUFFIX}");
|
||||
System.loadLibrary("allegro_color${ALLEGRO_DEBUG_SUFFIX}");
|
||||
System.loadLibrary("allegro_font${ALLEGRO_DEBUG_SUFFIX}");
|
||||
System.loadLibrary("allegro_ttf${ALLEGRO_DEBUG_SUFFIX}");
|
||||
System.loadLibrary("allegro_audio${ALLEGRO_DEBUG_SUFFIX}");
|
||||
System.loadLibrary("allegro_acodec${ALLEGRO_DEBUG_SUFFIX}");
|
||||
System.loadLibrary("allegro_video${ALLEGRO_DEBUG_SUFFIX}");
|
||||
}
|
||||
|
||||
/* By default, AllegroActivity.onCreate will cause Allegro to load the
|
||||
* shared object `libapp.so'. You can specify another library name by
|
||||
* overriding the constructor.
|
||||
*/
|
||||
public Activity() {
|
||||
super("libgame.so");
|
||||
}
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
if (android.os.Build.VERSION.SDK_INT >= 19) {
|
||||
this.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,8 @@
|
|||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
set(ANDROID_HOME "$ENV{ANDROID_HOME}" CACHE PATH "Path to Android SDK" )
|
||||
|
||||
#set path for android toolchain -- look
|
||||
|
||||
set(ANDROID_ALLEGRO_ROOT "$ENV{ANDROID_ALLEGRO_ROOT}" CACHE PATH "Path to Allegro 5 (>=5.2.2) build directory for Android" )
|
||||
|
@ -20,9 +22,6 @@ if(NOT EXISTS ${ANDROID_NDK_TOOLCHAIN_ROOT})
|
|||
message( STATUS "If you prefer to use a different location, please set the ANDROID_NDK_TOOLCHAIN_ROOT cmake variable.")
|
||||
endif()
|
||||
|
||||
#set(ANDROID_NDK_TOOLCHAIN_ROOT ${ANDROID_NDK_TOOLCHAIN_ROOT} CACHE PATH
|
||||
# "root of the android ndk standalone toolchain" FORCE)
|
||||
|
||||
if(NOT EXISTS ${ANDROID_NDK_TOOLCHAIN_ROOT})
|
||||
message(FATAL_ERROR
|
||||
"${ANDROID_NDK_TOOLCHAIN_ROOT} does not exist!
|
||||
|
@ -95,7 +94,7 @@ set(CMAKE_RANLIB
|
|||
|
||||
set_property(CACHE ARM_TARGETS PROPERTY STRINGS ${PossibleArmTargets} )
|
||||
|
||||
set(LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR}/android CACHE PATH
|
||||
set(LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR}/android/app CACHE PATH
|
||||
"root for library output, set this to change where
|
||||
android libs are installed to")
|
||||
|
||||
|
@ -148,21 +147,6 @@ endif()
|
|||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
|
||||
|
||||
find_program(ANDROID_TOOL android NAMES android android.bat CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
find_program(NDK_BUILD ndk-build CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
find_program(ANT ant CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
set(ANT_COMMAND "${ANT}" -noinput -nouserlib -noclasspath -quiet)
|
||||
|
||||
if(NOT ANDROID_TOOL)
|
||||
message(FATAL_ERROR "android tool not found")
|
||||
endif()
|
||||
if(NOT NDK_BUILD)
|
||||
message(FATAL_ERROR "ndk-build not found")
|
||||
endif()
|
||||
if(NOT ANT)
|
||||
message(FATAL_ERROR "ant not found")
|
||||
endif()
|
||||
|
||||
#set these global flags for cmake client scripts to change behavior
|
||||
set(ANDROID True)
|
||||
set(BUILD_ANDROID True)
|
||||
|
|
|
@ -316,7 +316,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED)
|
|||
|
||||
if (ANDROID OR EMSCRIPTEN)
|
||||
if (ANDROID)
|
||||
set(ASSET_PIPELINE_DATADIR "${CMAKE_BINARY_DIR}/android/assets/data")
|
||||
set(ASSET_PIPELINE_DATADIR "${CMAKE_BINARY_DIR}/android/app/src/main/assets/data")
|
||||
set(ASSET_PIPELINE_DEPEND "")
|
||||
else (EMSCRIPTEN)
|
||||
set(ASSET_PIPELINE_DATADIR "${CMAKE_INSTALL_PREFIX}/share/${LIBSUPERDERPY_GAMENAME}/data")
|
||||
|
@ -352,7 +352,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED)
|
|||
DEPENDS ${EXECUTABLE} ${LIBSUPERDERPY_GAMENAME}_flac_to_opus ${LIBSUPERDERPY_GAMENAME}_img_to_webp
|
||||
BYPRODUCTS ${APK_PATH}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/android"
|
||||
COMMAND ${ANT_COMMAND} debug
|
||||
COMMAND ./gradlew assembleDebug
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
|
@ -406,18 +406,6 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED)
|
|||
set(ANDROID_TARGET "android-26" CACHE STRING "What Android target to compile for.")
|
||||
STRING(REGEX REPLACE "^android-" "" ANDROID_TARGET_VERSION ${ANDROID_TARGET})
|
||||
|
||||
# The android tool on Windows is a batch file wrapper, which cannot be
|
||||
# started by MSYS shell directly. We invoke it via cmd.exe instead.
|
||||
# We don't use the full path to avoid problems with spaces,
|
||||
# and hope that android.bat is somewhere on the PATH.
|
||||
if(ANDROID_TOOL MATCHES "[.]bat$")
|
||||
set(ANDROID_UPDATE_COMMAND
|
||||
cmd.exe /c "android.bat update project -p . -t ${ANDROID_TARGET}")
|
||||
else()
|
||||
set(ANDROID_UPDATE_COMMAND
|
||||
"${ANDROID_TOOL}" update project -p . -t ${ANDROID_TARGET})
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/android")
|
||||
file(COPY "${LIBSUPERDERPY_DIR}/android" DESTINATION "${CMAKE_BINARY_DIR}")
|
||||
|
||||
|
@ -438,34 +426,29 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED)
|
|||
set(LIBSUPERDERPY_ANDROID_DEBUGGABLE "true")
|
||||
endif(NOT DEFINED LIBSUPERDERPY_ANDROID_DEBUGGABLE)
|
||||
|
||||
configure_android_file("AndroidManifest.xml")
|
||||
configure_android_file("localgen.properties")
|
||||
configure_android_file("build.xml" @ONLY)
|
||||
configure_android_file("project.properties" @ONLY)
|
||||
configure_android_file("res/values/strings.xml")
|
||||
configure_android_file("jni/localgen.mk")
|
||||
configure_android_file("app/src/main/AndroidManifest.xml")
|
||||
configure_android_file("local.properties")
|
||||
configure_android_file("app/build.gradle")
|
||||
configure_android_file("app/src/main/res/values/strings.xml")
|
||||
if (ALLEGRO5_LIBRARIES MATCHES "^.*-debug.*$")
|
||||
set(ALLEGRO_DEBUG_SUFFIX "-debug")
|
||||
endif()
|
||||
configure_file("${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/Activity.java.in" "${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/Activity.java")
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/Activity.java.in")
|
||||
configure_android_file("app/src/main/java/net/dosowisko/libsuperderpy/Activity.java")
|
||||
|
||||
file(COPY ${ALLEGRO5_LIBS} DESTINATION ${LIBRARY_OUTPUT_PATH})
|
||||
file(COPY "${ANDROID_ALLEGRO_ROOT}/lib/Allegro5.jar" DESTINATION ${LIBRARY_OUTPUT_PATH})
|
||||
configure_file("${ANDROID_ALLEGRO_ROOT}/lib/allegro-release.aar" ${CMAKE_BINARY_DIR}/android/app/libs/allegro.aar COPYONLY)
|
||||
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data" DESTINATION "${CMAKE_BINARY_DIR}/android/assets/" PATTERN "stuff" EXCLUDE
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data" DESTINATION "${CMAKE_BINARY_DIR}/android/app/src/main/assets/" PATTERN "stuff" EXCLUDE
|
||||
PATTERN ".git" EXCLUDE
|
||||
PATTERN ".gitignore" EXCLUDE
|
||||
PATTERN ".directory" EXCLUDE
|
||||
PATTERN "CMakeLists.txt" EXCLUDE)
|
||||
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data/icons/48/${LIBSUPERDERPY_GAMENAME}.png" DESTINATION "${CMAKE_BINARY_DIR}/android/res/mipmap-mdpi/")
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data/icons/72/${LIBSUPERDERPY_GAMENAME}.png" DESTINATION "${CMAKE_BINARY_DIR}/android/res/mipmap-hdpi/")
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data/icons/96/${LIBSUPERDERPY_GAMENAME}.png" DESTINATION "${CMAKE_BINARY_DIR}/android/res/mipmap-xhdpi/")
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data/icons/144/${LIBSUPERDERPY_GAMENAME}.png" DESTINATION "${CMAKE_BINARY_DIR}/android/res/mipmap-xxhdpi/")
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data/icons/192/${LIBSUPERDERPY_GAMENAME}.png" DESTINATION "${CMAKE_BINARY_DIR}/android/res/mipmap-xxxhdpi/")
|
||||
|
||||
execute_process(COMMAND ${ANDROID_UPDATE_COMMAND} WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/android")
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data/icons/48/${LIBSUPERDERPY_GAMENAME}.png" DESTINATION "${CMAKE_BINARY_DIR}/android/app/src/main/res/mipmap-mdpi/")
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data/icons/72/${LIBSUPERDERPY_GAMENAME}.png" DESTINATION "${CMAKE_BINARY_DIR}/android/app/src/main/res/mipmap-hdpi/")
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data/icons/96/${LIBSUPERDERPY_GAMENAME}.png" DESTINATION "${CMAKE_BINARY_DIR}/android/app/src/main/res/mipmap-xhdpi/")
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data/icons/144/${LIBSUPERDERPY_GAMENAME}.png" DESTINATION "${CMAKE_BINARY_DIR}/android/app/src/main/res/mipmap-xxhdpi/")
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/data/icons/192/${LIBSUPERDERPY_GAMENAME}.png" DESTINATION "${CMAKE_BINARY_DIR}/android/app/src/main/res/mipmap-xxxhdpi/")
|
||||
|
||||
endif(ANDROID)
|
||||
|
||||
|
|
Loading…
Reference in a new issue