mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-19 10:43:33 +00:00
fix: update Android build config and dependencies
Update NDK/CMake versions, switch default build variant, re-enable x86_64 support, add ConstraintLayout dependency, and enable LTCG optimization. Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -86,30 +86,21 @@ endif()
|
|||||||
option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL})
|
option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL})
|
||||||
|
|
||||||
if (ANDROID AND CITRON_DOWNLOAD_ANDROID_VVL)
|
if (ANDROID AND CITRON_DOWNLOAD_ANDROID_VVL)
|
||||||
set(vvl_version "vulkan-sdk-1.4.321.0")
|
set(vvl_version "sdk-1.3.261.1")
|
||||||
set(vvl_zip_file "${CMAKE_BINARY_DIR}/externals/vvl-android.zip")
|
set(vvl_zip_file "${CMAKE_BINARY_DIR}/externals/vvl-android.zip")
|
||||||
set(vvl_lib_path "${CMAKE_CURRENT_SOURCE_DIR}/src/android/app/src/main/jniLibs/arm64-v8a/")
|
|
||||||
set(vvl_lib_file "${vvl_lib_path}/libVkLayer_khronos_validation.so")
|
|
||||||
|
|
||||||
# Only download and extract if the final library file doesn't exist
|
|
||||||
if (NOT EXISTS "${vvl_lib_file}")
|
|
||||||
if (NOT EXISTS "${vvl_zip_file}")
|
if (NOT EXISTS "${vvl_zip_file}")
|
||||||
# Download validation layer release to externals directory
|
# Download and extract validation layer release to externals directory
|
||||||
set(vvl_base_url "https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download")
|
set(vvl_base_url "https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download")
|
||||||
file(DOWNLOAD "${vvl_base_url}/${vvl_version}/android-binaries-${vvl_version}.zip"
|
file(DOWNLOAD "${vvl_base_url}/${vvl_version}/android-binaries-${vvl_version}-android.zip"
|
||||||
"${vvl_zip_file}" SHOW_PROGRESS)
|
"${vvl_zip_file}" SHOW_PROGRESS)
|
||||||
endif()
|
|
||||||
|
|
||||||
# Extract if not already extracted
|
|
||||||
if (NOT EXISTS "${CMAKE_BINARY_DIR}/externals/android-binaries-${vvl_version}")
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${vvl_zip_file}"
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${vvl_zip_file}"
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Copy the arm64 binary to src/android/app/main/jniLibs
|
# Copy the arm64 binary to src/android/app/main/jniLibs
|
||||||
|
set(vvl_lib_path "${CMAKE_CURRENT_SOURCE_DIR}/src/android/app/src/main/jniLibs/arm64-v8a/")
|
||||||
file(COPY "${CMAKE_BINARY_DIR}/externals/android-binaries-${vvl_version}/arm64-v8a/libVkLayer_khronos_validation.so"
|
file(COPY "${CMAKE_BINARY_DIR}/externals/android-binaries-${vvl_version}/arm64-v8a/libVkLayer_khronos_validation.so"
|
||||||
DESTINATION "${vvl_lib_path}")
|
DESTINATION "${vvl_lib_path}")
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
@@ -292,6 +283,9 @@ if (MSVC)
|
|||||||
|
|
||||||
# boost still makes use of deprecated result_of.
|
# boost still makes use of deprecated result_of.
|
||||||
add_definitions(-D_HAS_DEPRECATED_RESULT_OF)
|
add_definitions(-D_HAS_DEPRECATED_RESULT_OF)
|
||||||
|
|
||||||
|
# Enable Link Time Code Generation for better optimization
|
||||||
|
add_link_options(/LTCG)
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: 2023 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
@@ -28,7 +28,7 @@ android {
|
|||||||
namespace = "org.citron.citron_emu"
|
namespace = "org.citron.citron_emu"
|
||||||
|
|
||||||
compileSdkVersion = "android-35"
|
compileSdkVersion = "android-35"
|
||||||
ndkVersion = "27.2.12479018" // "26.1.10909125"
|
ndkVersion = "26.1.10909125"
|
||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding = true
|
viewBinding = true
|
||||||
@@ -104,13 +104,10 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resValue("string", "app_name_suffixed", "citron")
|
resValue("string", "app_name_suffixed", "citron")
|
||||||
isDefault = true
|
|
||||||
isShrinkResources = true
|
|
||||||
isMinifyEnabled = true
|
isMinifyEnabled = true
|
||||||
isJniDebuggable = false
|
|
||||||
isDebuggable = false
|
isDebuggable = false
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android.txt"),
|
||||||
"proguard-rules.pro"
|
"proguard-rules.pro"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -118,12 +115,13 @@ android {
|
|||||||
// builds a release build that doesn't need signing
|
// builds a release build that doesn't need signing
|
||||||
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
|
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
|
||||||
register("relWithDebInfo") {
|
register("relWithDebInfo") {
|
||||||
|
isDefault = true
|
||||||
resValue("string", "app_name_suffixed", "citron Debug Release")
|
resValue("string", "app_name_suffixed", "citron Debug Release")
|
||||||
signingConfig = signingConfigs.getByName("default")
|
signingConfig = signingConfigs.getByName("default")
|
||||||
isMinifyEnabled = true
|
isMinifyEnabled = true
|
||||||
isDebuggable = true
|
isDebuggable = true
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android.txt"),
|
||||||
"proguard-rules.pro"
|
"proguard-rules.pro"
|
||||||
)
|
)
|
||||||
versionNameSuffix = "-relWithDebInfo"
|
versionNameSuffix = "-relWithDebInfo"
|
||||||
@@ -160,7 +158,7 @@ android {
|
|||||||
|
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
version = "3.31.8"
|
version = "3.22.1"
|
||||||
path = file("../../../CMakeLists.txt")
|
path = file("../../../CMakeLists.txt")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,10 +177,10 @@ android {
|
|||||||
"-DCITRON_ENABLE_LTO=ON",
|
"-DCITRON_ENABLE_LTO=ON",
|
||||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
|
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
|
||||||
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5",
|
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5",
|
||||||
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
|
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
||||||
)
|
)
|
||||||
|
|
||||||
abiFilters("arm64-v8a") // , "x86_64")
|
abiFilters("arm64-v8a", "x86_64")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,6 +238,7 @@ dependencies {
|
|||||||
implementation("io.coil-kt:coil:2.2.2")
|
implementation("io.coil-kt:coil:2.2.2")
|
||||||
implementation("androidx.core:core-splashscreen:1.0.1")
|
implementation("androidx.core:core-splashscreen:1.0.1")
|
||||||
implementation("androidx.window:window:1.2.0-beta03")
|
implementation("androidx.window:window:1.2.0-beta03")
|
||||||
|
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||||
implementation("androidx.navigation:navigation-fragment-ktx:2.7.4")
|
implementation("androidx.navigation:navigation-fragment-ktx:2.7.4")
|
||||||
implementation("androidx.navigation:navigation-ui-ktx:2.7.4")
|
implementation("androidx.navigation:navigation-ui-ktx:2.7.4")
|
||||||
|
|||||||
Reference in New Issue
Block a user