[Build] Use first-party premake-androidndk (#1878)

This commit is contained in:
Triang3l 2021-10-30 00:01:27 +03:00
parent 2962a266b5
commit 7e6cf349e2
11 changed files with 52 additions and 35 deletions

6
.gitmodules vendored
View File

@ -64,9 +64,6 @@
[submodule "third_party/premake-cmake"]
path = third_party/premake-cmake
url = https://github.com/Enhex/premake-cmake.git
[submodule "third_party/premake-androidmk"]
path = third_party/premake-androidmk
url = https://github.com/Triang3l/premake-androidmk.git
[submodule "third_party/date"]
path = third_party/date
url = https://github.com/HowardHinnant/date.git
@ -76,3 +73,6 @@
[submodule "third_party/FFmpeg"]
path = third_party/FFmpeg
url = https://github.com/xenia-project/FFmpeg.git
[submodule "third_party/premake-androidndk"]
path = third_party/premake-androidndk
url = https://github.com/Triang3l/premake-androidndk.git

View File

@ -4,23 +4,29 @@ plugins {
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
ndkVersion '22.0.6917172 rc1'
buildToolsVersion '30.0.2'
ndkVersion '23.0.7599858'
defaultConfig {
applicationId "jp.xenia.emulator"
applicationId 'jp.xenia.emulator'
// 24 (7.0) - Vulkan.
minSdkVersion 24
targetSdkVersion 30
versionCode 1
versionName "Prototype"
versionName 'Prototype'
externalNativeBuild {
ndkBuild {
arguments "NDK_APPLICATION_MK:=../../../build/xenia_Application.mk"
arguments 'NDK_APPLICATION_MK:=../../../build/xenia.Application.mk',
'PREMAKE_ANDROIDNDK_PLATFORMS:=Android-ARM64',
'PREMAKE_ANDROIDNDK_PLATFORMS+=Android-x86_64',
// Work around "Bad file descriptor" on Windows on NDK r22+.
'--output-sync=none'
}
}
ndk {
abiFilters 'arm64-v8a'
abiFilters 'arm64-v8a', 'x86_64'
jobs Runtime.runtime.availableProcessors()
stl 'c++_static'
}
}
@ -28,40 +34,40 @@ android {
release {
externalNativeBuild {
ndkBuild {
arguments "PM5_CONFIG:=release_android"
arguments 'PREMAKE_ANDROIDNDK_CONFIGURATIONS:=Release'
}
}
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
applicationIdSuffix ".debug"
applicationIdSuffix '.debug'
debuggable true
externalNativeBuild {
ndkBuild {
arguments "PM5_CONFIG:=debug_android"
arguments 'PREMAKE_ANDROIDNDK_CONFIGURATIONS:=Debug'
}
}
}
checked {
applicationIdSuffix ".checked"
applicationIdSuffix '.checked'
debuggable true
externalNativeBuild {
ndkBuild {
arguments "PM5_CONFIG:=checked_android"
arguments 'PREMAKE_ANDROIDNDK_CONFIGURATIONS:=Checked'
}
}
}
}
flavorDimensions "distribution"
flavorDimensions 'distribution'
productFlavors {
github {
dimension "distribution"
applicationIdSuffix ".github"
dimension 'distribution'
applicationIdSuffix '.github'
}
googlePlay {
dimension "distribution"
dimension 'distribution'
// TODO(Triang3l): Provide a signing config for core contributors only.
}
}
@ -73,7 +79,7 @@ android {
externalNativeBuild {
ndkBuild {
path file('../../../build/xenia_Android.mk')
path file('../../../build/xenia.wks.Android.mk')
}
}
}

View File

@ -2,10 +2,10 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
classpath 'com.android.tools.build:gradle:7.0.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@ -15,7 +15,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

View File

@ -1,9 +1,7 @@
include("tools/build")
require("third_party/premake-export-compile-commands/export-compile-commands")
require("third_party/premake-androidndk/androidndk")
require("third_party/premake-cmake/cmake")
-- gmake required for androidmk.
require("gmake")
require("third_party/premake-androidmk/androidmk")
location(build_root)
targetdir(build_bin)
@ -138,11 +136,15 @@ filter({"platforms:Linux", "language:C++", "toolset:clang", "files:*.cc or *.cpp
"-stdlib=libstdc++",
})
filter("platforms:Android")
filter("platforms:Android-*")
system("android")
systemversion("24")
cppstl("c++")
staticruntime("On")
links({
"android",
"dl",
"log",
})
filter("platforms:Windows")
@ -204,9 +206,12 @@ workspace("xenia")
uuid("931ef4b0-6170-4f7a-aaf2-0fece7632747")
startproject("xenia-app")
if os.istarget("android") then
-- Not setting architecture as that's handled by ndk-build itself.
platforms({"Android"})
ndkstl("c++_static")
platforms({"Android-ARM64", "Android-x86_64"})
filter("platforms:Android-ARM64")
architecture("ARM64")
filter("platforms:Android-x86_64")
architecture("x86_64")
filter({})
else
architecture("x86_64")
if os.istarget("linux") then

View File

@ -14,3 +14,7 @@ project("xenia-ui")
local_platform_files()
removefiles({"*_demo.cc"})
removefiles({"windowed_app_main_*.cc"})
filter("platforms:Android-*")
-- Exports JNI functions.
wholelib("On")

2
third_party/FFmpeg vendored

@ -1 +1 @@
Subproject commit e07c38c67578352e3f3e769cdac91650ea9575a9
Subproject commit 15ece0882e8d5875051ff5b73c5a8326f7cee9f5

@ -1 +0,0 @@
Subproject commit 01a84c7eee20980ea51961c956fb26caa6907298

1
third_party/premake-androidndk vendored Submodule

@ -0,0 +1 @@
Subproject commit e6132d3f7877f9ad361c634db35b708c41075e3a

View File

@ -7,7 +7,9 @@ build_tools = "tools/build"
build_scripts = build_tools .. "/scripts"
build_tools_src = build_tools .. "/src"
if os.istarget("windows") then
if os.istarget("android") then
platform_suffix = "android"
elseif os.istarget("windows") then
platform_suffix = "win"
else
platform_suffix = "posix"

View File

@ -25,7 +25,7 @@ local function match_platform_files(base_path, base_match)
base_path.."/"..base_match.."_win.h",
base_path.."/"..base_match.."_win.cc",
})
filter("platforms:Linux or Android")
filter("platforms:Linux or Android-*")
files({
base_path.."/"..base_match.."_posix.h",
base_path.."/"..base_match.."_posix.cc",
@ -41,7 +41,7 @@ local function match_platform_files(base_path, base_match)
base_path.."/"..base_match.."_gtk.h",
base_path.."/"..base_match.."_gtk.cc",
})
filter("platforms:Android")
filter("platforms:Android-*")
files({
base_path.."/"..base_match.."_android.h",
base_path.."/"..base_match.."_android.cc",

View File

@ -514,7 +514,7 @@ def run_platform_premake(target_os_override=None, cc='clang', devenv=None):
vs_version = os.environ['VSVERSION']
devenv = 'vs' + vs_version
elif target_os == 'android':
devenv = 'androidmk'
devenv = 'androidndk'
else:
devenv = 'gmake2'
if target_os != 'linux':