summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Miodrag Milanović <mmicko@gmail.com>2018-12-12 01:38:28 +0100
committer ajrhacker <ajrhacker@users.noreply.github.com>2018-12-11 19:38:27 -0500
commita45221458dfba557ae32c0073750a06deea3f45e (patch)
tree0c7edda0a7fc0ca38021374801f0e5b2e074a180
parentff08c8cd4eb7004bac71652421b4aea987f5c468 (diff)
Android compile fix (#4395)
* Fix compile for Android, set API to 24 * Update Android Studio project to API 24 * Fixed project file to latest Android Studio * fix build with gradle alone
-rw-r--r--3rdparty/SDL2/src/audio/android/opensl_io.c1
-rw-r--r--android-project/app/build.gradle8
-rw-r--r--android-project/app/src/main/AndroidManifest.xml3
-rw-r--r--android-project/build.gradle4
-rw-r--r--android-project/gradle/wrapper/gradle-wrapper.properties4
-rwxr-xr-x[-rw-r--r--]android-project/gradlew0
-rw-r--r--android-project/settings.gradle2
-rw-r--r--makefile32
-rw-r--r--scripts/toolchain.lua60
-rw-r--r--src/osd/modules/file/posixptty.cpp4
-rw-r--r--src/osd/modules/sound/sdl_sound.cpp8
11 files changed, 30 insertions, 96 deletions
diff --git a/3rdparty/SDL2/src/audio/android/opensl_io.c b/3rdparty/SDL2/src/audio/android/opensl_io.c
index 5e295706b57..aec6994d55d 100644
--- a/3rdparty/SDL2/src/audio/android/opensl_io.c
+++ b/3rdparty/SDL2/src/audio/android/opensl_io.c
@@ -28,6 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <limits.h>
+#include <string.h>
#include "opensl_io.h"
#define CONV16BIT 32768
#define CONVMYFLT (1./32768.)
diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle
index 35377908b88..3e632b38b67 100644
--- a/android-project/app/build.gradle
+++ b/android-project/app/build.gradle
@@ -1,14 +1,12 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ compileSdkVersion 24
+ buildToolsVersion '28.0.3'
defaultConfig {
applicationId "org.mamedev.mame"
- minSdkVersion 21
- targetSdkVersion 21
-
+ minSdkVersion 24
ndk {
moduleName 'main'
}
diff --git a/android-project/app/src/main/AndroidManifest.xml b/android-project/app/src/main/AndroidManifest.xml
index b811380f2bd..88d23efaeb1 100644
--- a/android-project/app/src/main/AndroidManifest.xml
+++ b/android-project/app/src/main/AndroidManifest.xml
@@ -8,9 +8,6 @@
android:versionName="0.204"
android:installLocation="auto">
- <!-- Android 5.0 -->
- <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21" />
-
<!-- OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" />
diff --git a/android-project/build.gradle b/android-project/build.gradle
index 88d246d44a6..2b29ba25212 100644
--- a/android-project/build.gradle
+++ b/android-project/build.gradle
@@ -1,15 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
+ google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.2.3'
+ classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
+ google()
jcenter()
}
}
diff --git a/android-project/gradle/wrapper/gradle-wrapper.properties b/android-project/gradle/wrapper/gradle-wrapper.properties
index 0c71e760dc9..894e429e50f 100644
--- a/android-project/gradle/wrapper/gradle-wrapper.properties
+++ b/android-project/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue Dec 11 19:45:09 CET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
diff --git a/android-project/gradlew b/android-project/gradlew
index 91a7e269e19..91a7e269e19 100644..100755
--- a/android-project/gradlew
+++ b/android-project/gradlew
diff --git a/android-project/settings.gradle b/android-project/settings.gradle
index e66d0475ed0..08391ada8ab 100644
--- a/android-project/settings.gradle
+++ b/android-project/settings.gradle
@@ -1,3 +1,3 @@
-gradle.ext.sdkVersion = 21
+gradle.ext.sdkVersion = 24
include ':app'
diff --git a/makefile b/makefile
index 20dcf539872..11b5a3a27b1 100644
--- a/makefile
+++ b/makefile
@@ -907,7 +907,7 @@ endif
ifeq (posix,$(SHELLTYPE))
MKDIR = $(SILENT) mkdir -p "$(1)"
- COPY = $(SILENT) cp -fR "$(1)" "$(2)"
+ COPY = $(SILENT) cp -fR "$(1)"/* "$(2)"
else
MKDIR = $(SILENT) mkdir "$(subst /,\\,$(1))" 2> nul || exit 0
COPY = $(SILENT) copy /Y "$(subst /,\\,$(1))" "$(subst /,\\,$(2))" > nul || exit 0
@@ -1211,36 +1211,6 @@ android-arm64: android-ndk generate $(PROJECTDIR_SDL)/$(MAKETYPE)-android-arm64/
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/$(MAKETYPE)-android-arm64 config=$(CONFIG)
#-------------------------------------------------
-# android-mips
-#-------------------------------------------------
-
-$(PROJECTDIR_SDL)/$(MAKETYPE)-android-mips/Makefile: makefile $(SCRIPTS) $(GENIE)
-ifndef ANDROID_NDK_MIPS
- $(error ANDROID_NDK_MIPS is not set)
-endif
- $(SILENT) $(GENIE) $(PARAMS) --gcc=android-mips --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=mips --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 --NOASM=1 $(MAKETYPE)
-
-.PHONY: android-mips
-android-mips: android-ndk generate $(PROJECTDIR_SDL)/$(MAKETYPE)-android-mips/Makefile
- $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/$(MAKETYPE)-android-mips config=$(CONFIG) precompile
- $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/$(MAKETYPE)-android-mips config=$(CONFIG)
-
-#-------------------------------------------------
-# android-mips64
-#-------------------------------------------------
-
-$(PROJECTDIR_SDL)/$(MAKETYPE)-android-mips64/Makefile: makefile $(SCRIPTS) $(GENIE)
-ifndef ANDROID_NDK_MIPS64
- $(error ANDROID_NDK_MIPS64 is not set)
-endif
- $(SILENT) $(GENIE) $(PARAMS) --gcc=android-mips64 --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=mips64 --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 --NOASM=1 $(MAKETYPE)
-
-.PHONY: android-mips64
-android-mips64: android-ndk generate $(PROJECTDIR_SDL)/$(MAKETYPE)-android-mips64/Makefile
- $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/$(MAKETYPE)-android-mips64 config=$(CONFIG) precompile
- $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/$(MAKETYPE)-android-mips64 config=$(CONFIG)
-
-#-------------------------------------------------
# android-x86
#-------------------------------------------------
diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua
index e1052dc4500..e596c06bfb0 100644
--- a/scripts/toolchain.lua
+++ b/scripts/toolchain.lua
@@ -94,11 +94,11 @@ function toolchain(_buildDir, _subDir)
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION)
- local androidPlatform = "android-21"
+ local androidPlatform = "android-24"
if _OPTIONS["with-android"] then
androidPlatform = "android-" .. _OPTIONS["with-android"]
elseif _OPTIONS["PLATFORM"]:find("64", -2) then
- androidPlatform = "android-21"
+ androidPlatform = "android-24"
end
local iosPlatform = ""
@@ -847,6 +847,7 @@ function toolchain(_buildDir, _subDir)
MAME_DIR .. "3rdparty/bgfx/3rdparty/khronos",
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libcxx/include",
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
+ "$(ANDROID_NDK_ROOT)/sysroot/usr/include",
"$(ANDROID_NDK_ROOT)/sources/android/support/include",
"$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
}
@@ -864,10 +865,12 @@ function toolchain(_buildDir, _subDir)
"log",
"c++_static",
"c++abi",
- "android_support",
"stdc++",
"gcc",
}
+ buildoptions_c {
+ "-Wno-strict-prototypes",
+ }
buildoptions {
"-fpic",
"-ffunction-sections",
@@ -880,6 +883,8 @@ function toolchain(_buildDir, _subDir)
"-Wno-cast-align",
"-Wno-unknown-attributes",
"-Wno-macro-redefined",
+ "-DASIO_HAS_STD_STRING_VIEW",
+ "-Wno-unused-function",
}
linkoptions {
"-no-canonical-prefixes",
@@ -893,11 +898,10 @@ function toolchain(_buildDir, _subDir)
configuration { "android-arm" }
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
- "$(ANDROID_NDK_ARM)/lib/gcc/arm-linux-androideabi/4.9.x/armv7-a",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib",
}
includedirs {
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/include",
+ "$(ANDROID_NDK_ROOT)/sysroot/usr/include/arm-linux-androideabi",
}
buildoptions {
"-gcc-toolchain $(ANDROID_NDK_ARM)",
@@ -926,7 +930,7 @@ function toolchain(_buildDir, _subDir)
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm64/usr/lib64",
}
includedirs {
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm64/usr/include",
+ "$(ANDROID_NDK_ROOT)/sysroot/usr/include/aarch64-linux-android",
}
buildoptions {
"-gcc-toolchain $(ANDROID_NDK_ARM64)",
@@ -940,53 +944,13 @@ function toolchain(_buildDir, _subDir)
"-target aarch64-none-linux-android",
}
- configuration { "android-mips" }
- libdirs {
- "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips",
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/",
- }
- includedirs {
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/include",
- }
- buildoptions {
- "-gcc-toolchain $(ANDROID_NDK_MIPS)",
- "-target mipsel-none-linux-android",
- }
- linkoptions {
- "-gcc-toolchain $(ANDROID_NDK_MIPS)",
- "-target mipsel-none-linux-android",
- "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips",
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtbegin_so.o",
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtend_so.o",
- }
-
- configuration { "android-mips64" }
- libdirs {
- "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips64",
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips64/usr/lib64/",
- }
- includedirs {
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips64/usr/include",
- }
- buildoptions {
- "-gcc-toolchain $(ANDROID_NDK_MIPS64)",
- "-target mips64el-none-linux-android",
- }
- linkoptions {
- "-gcc-toolchain $(ANDROID_NDK_MIPS64)",
- "-target mips64el-none-linux-android",
- "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips64",
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips64/usr/lib64/crtbegin_so.o",
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips64/usr/lib64/crtend_so.o",
- }
-
configuration { "android-x86" }
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib",
}
includedirs {
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/include",
+ "$(ANDROID_NDK_ROOT)/sysroot/usr/include/i686-linux-android",
}
buildoptions {
"-gcc-toolchain $(ANDROID_NDK_X86)",
@@ -1008,7 +972,7 @@ function toolchain(_buildDir, _subDir)
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86_64/usr/lib64",
}
includedirs {
- "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86_64/usr/include",
+ "$(ANDROID_NDK_ROOT)/sysroot/usr/include/x86_64-linux-android",
}
buildoptions {
"-gcc-toolchain $(ANDROID_NDK_X64)",
diff --git a/src/osd/modules/file/posixptty.cpp b/src/osd/modules/file/posixptty.cpp
index 3eab9e45d0c..51c655a5d1e 100644
--- a/src/osd/modules/file/posixptty.cpp
+++ b/src/osd/modules/file/posixptty.cpp
@@ -22,9 +22,11 @@
#if defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#include <termios.h>
#include <libutil.h>
-#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__ANDROID__)
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
#include <termios.h>
#include <util.h>
+#elif defined(__APPLE__)
+#include <termios.h>
#elif defined(__linux__) || defined(EMSCRIPTEN)
#include <pty.h>
#elif defined(__HAIKU__)
diff --git a/src/osd/modules/sound/sdl_sound.cpp b/src/osd/modules/sound/sdl_sound.cpp
index f6dadca0026..b59f0cf9ea2 100644
--- a/src/osd/modules/sound/sdl_sound.cpp
+++ b/src/osd/modules/sound/sdl_sound.cpp
@@ -304,7 +304,7 @@ void sound_sdl::update_audio_stream(bool is_throttled, const int16_t *buffer, in
if (stream_buffer->free_size() < bytes_this_frame) {
if (LOG_SOUND)
- fprintf(sound_log, "Overflow: DS=%lu FS=%lu BTF=%lu\n", data_size, free_size, bytes_this_frame);
+ fprintf(sound_log, "Overflow: DS=%zu FS=%zu BTF=%zu\n", data_size, free_size, bytes_this_frame);
buffer_overflows++;
return;
}
@@ -314,7 +314,7 @@ void sound_sdl::update_audio_stream(bool is_throttled, const int16_t *buffer, in
size_t nfree_size = stream_buffer->free_size();
size_t ndata_size = stream_buffer->data_size();
if (LOG_SOUND)
- fprintf(sound_log, "Appended data: DS=%lu(%lu) FS=%lu(%lu) BTF=%lu\n", data_size, ndata_size, free_size, nfree_size, bytes_this_frame);
+ fprintf(sound_log, "Appended data: DS=%zu(%zu) FS=%zu(%zu) BTF=%zu\n", data_size, ndata_size, free_size, nfree_size, bytes_this_frame);
}
@@ -350,7 +350,7 @@ static void sdl_callback(void *userdata, Uint8 *stream, int len)
{
thiz->buffer_underflows++;
if (LOG_SOUND)
- fprintf(sound_log, "Underflow at sdl_callback: DS=%lu FS=%lu Len=%d\n", data_size, free_size, len);
+ fprintf(sound_log, "Underflow at sdl_callback: DS=%zu FS=%zu Len=%d\n", data_size, free_size, len);
// Maybe read whatever is left in the stream_buffer anyway?
memset(stream, 0, len);
@@ -364,7 +364,7 @@ static void sdl_callback(void *userdata, Uint8 *stream, int len)
thiz->attenuate((int16_t *)stream, len);
if (LOG_SOUND)
- fprintf(sound_log, "callback: xfer DS=%lu FS=%lu Len=%d\n", data_size, free_size, len);
+ fprintf(sound_log, "callback: xfer DS=%zu FS=%zu Len=%d\n", data_size, free_size, len);
}