ci: Support Android x86_64 and optimize build caching. (#7045)

* android: Support x86_64 devices.

* ci: Improve ccache hits and stats.

* ci: Compress Android artifacts.

* ci: Re-enable PCH and set ccache sloppiness appropriately.
This commit is contained in:
Steveice10 2023-10-08 23:56:01 -07:00 committed by GitHub
parent f5b8888686
commit 6244f9e3fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 131 additions and 43 deletions

View file

@ -2,20 +2,24 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
import android.databinding.tool.ext.capitalizeUS
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("de.undercouch.download") version "5.5.0"
}
import android.databinding.tool.ext.capitalizeUS
import de.undercouch.gradle.tasks.download.Download
/**
* Use the number of seconds/10 since Jan 1 2016 as the versionCode.
* This lets us upload a new build at most every 10 seconds for the
* next 680 years.
*/
val autoVersion = (((System.currentTimeMillis() / 1000) - 1451606400) / 10).toInt()
val abiFilter = listOf("arm64-v8a"/*, "x86", "x86_64"*/)
val abiFilter = listOf("arm64-v8a", "x86_64")
val downloadedJniLibsPath = "${buildDir}/downloadedJniLibs"
@Suppress("UnstableApiUsage")
android {
@ -131,6 +135,13 @@ android {
path = file("../../../CMakeLists.txt")
}
}
sourceSets {
named("main") {
// Set up path for downloaded native libraries
jniLibs.srcDir(downloadedJniLibsPath)
}
}
}
dependencies {
@ -158,6 +169,30 @@ dependencies {
implementation("com.android.billingclient:billing:2.0.3")
}
// Download Vulkan Validation Layers from the KhronosGroup GitHub.
val downloadVulkanValidationLayers = tasks.register<Download>("downloadVulkanValidationLayers") {
src("https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download/sdk-1.3.261.1/android-binaries-sdk-1.3.261.1-android.zip")
dest(file("${buildDir}/tmp/Vulkan-ValidationLayers.zip"))
onlyIfModified(true)
}
// Extract Vulkan Validation Layers into the downloaded native libraries directory.
val unzipVulkanValidationLayers = tasks.register<Copy>("unzipVulkanValidationLayers") {
dependsOn(downloadVulkanValidationLayers)
from(zipTree(downloadVulkanValidationLayers.get().dest)) {
// Exclude the top level directory in the zip as it violates the expected jniLibs directory structure.
eachFile {
relativePath = RelativePath(true, *relativePath.segments.drop(1).toTypedArray())
}
includeEmptyDirs = false
}
into(downloadedJniLibsPath)
}
tasks.named("preBuild") {
dependsOn(unzipVulkanValidationLayers)
}
fun getGitVersion(): String {
var versionName = "0.0"

View file

@ -34,7 +34,11 @@ add_library(citra-android SHARED
ndk_motion.h
)
target_link_libraries(citra-android PRIVATE audio_core citra_common citra_core input_common network adrenotools)
target_link_libraries(citra-android PRIVATE audio_core citra_common citra_core input_common network)
target_link_libraries(citra-android PRIVATE android camera2ndk EGL glad inih jnigraphics log mediandk yuv)
if ("arm64" IN_LIST ARCHITECTURE)
target_link_libraries(citra-android PRIVATE adrenotools)
endif()
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} citra-android)

View file

@ -10,8 +10,12 @@
#include <android/native_window_jni.h>
#include "audio_core/dsp_interface.h"
#include "common/aarch64/cpu_detect.h"
#include "common/arch.h"
#if CITRA_ARCH(arm64)
#include "common/aarch64/cpu_detect.h"
#elif CITRA_ARCH(x86_64)
#include "common/x64/cpu_detect.h"
#endif
#include "common/common_paths.h"
#include "common/dynamic_library/dynamic_library.h"
#include "common/file_util.h"