1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Update NDK and Maven config

(cherry picked from commit 3c645995ca)
This commit is contained in:
Kyle Szklenski
2025-07-10 09:18:37 -04:00
committed by lawnjelly
parent 0d1f294c58
commit da3795b199
11 changed files with 47 additions and 25 deletions

View File

@@ -1,5 +1,8 @@
#!/usr/bin/env python
import platform
import sys
Import("env")
android_files = [
@@ -39,18 +42,34 @@ lib = env_android.add_shared_library("#bin/libgodot", [android_objects], SHLIBSU
env.Depends(lib, thirdparty_obj)
lib_arch_dir = ""
triple_target_dir = ""
if env["android_arch"] == "armv7":
lib_arch_dir = "armeabi-v7a"
triple_target_dir = "arm-linux-androideabi"
elif env["android_arch"] == "arm64v8":
lib_arch_dir = "arm64-v8a"
triple_target_dir = "aarch64-linux-android"
elif env["android_arch"] == "x86":
lib_arch_dir = "x86"
triple_target_dir = "i686-linux-android"
elif env["android_arch"] == "x86_64":
lib_arch_dir = "x86_64"
triple_target_dir = "x86_64-linux-android"
else:
print("WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin")
if lib_arch_dir != "":
host_subpath = ""
if sys.platform.startswith("linux"):
host_subpath = "linux-x86_64"
elif sys.platform.startswith("darwin"):
host_subpath = "darwin-x86_64"
elif sys.platform.startswith("win"):
if platform.machine().endswith("64"):
host_subpath = "windows-x86_64"
else:
host_subpath = "windows"
if lib_arch_dir != "" and host_subpath != "":
if env["target"] == "release":
lib_type_dir = "release"
elif env["target"] == "release_debug":
@@ -71,7 +90,5 @@ if lib_arch_dir != "":
out_dir + "/libgodot_android.so", "#bin/libgodot" + env["SHLIBSUFFIX"], Move("$TARGET", "$SOURCE")
)
stl_lib_path = (
str(env["ANDROID_NDK_ROOT"]) + "/sources/cxx-stl/llvm-libc++/libs/" + lib_arch_dir + "/libc++_shared.so"
)
stl_lib_path = f"{env['ANDROID_NDK_ROOT']}/toolchains/llvm/prebuilt/{host_subpath}/sysroot/usr/lib/{triple_target_dir}/libc++_shared.so"
env_android.Command(out_dir + "/libc++_shared.so", stl_lib_path, Copy("$TARGET", "$SOURCE"))

View File

@@ -21,7 +21,7 @@ def get_opts():
return [
("ANDROID_SDK_ROOT", "Path to the Android SDK", get_env_android_sdk_root()),
("ndk_platform", 'Target platform (android-<api>, e.g. "android-19")', "android-19"),
("ndk_platform", 'Target platform (android-<api>, e.g. "android-24")', "android-24"),
EnumVariable("android_arch", "Target architecture", "armv7", ("armv7", "arm64v8", "x86", "x86_64")),
BoolVariable("android_neon", "Enable NEON support (armv7 only)", True),
BoolVariable("store_release", "Editor build for Google Play Store (for official builds only)", False),
@@ -43,7 +43,7 @@ def get_android_ndk_root(env):
# This is kept in sync with the value in 'platform/android/java/app/config.gradle'.
def get_ndk_version():
return "23.2.8568313"
return "28.1.13356709"
def get_flags():
@@ -90,15 +90,6 @@ def configure(env):
neon_text = " (with NEON)"
print("Building for Android (" + env["android_arch"] + ")" + neon_text)
if get_min_sdk_version(env["ndk_platform"]) < 21:
if env["android_arch"] == "x86_64" or env["android_arch"] == "arm64v8":
print(
"WARNING: android_arch="
+ env["android_arch"]
+ " is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21"
)
env["ndk_platform"] = "android-21"
if env["android_arch"] == "armv7":
target_triple = "armv7a-linux-androideabi"
if env["android_neon"]:
@@ -185,9 +176,7 @@ def configure(env):
CCFLAGS="-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing".split()
)
env.Append(CPPDEFINES=["NO_STATVFS", "GLES_ENABLED"])
if get_min_sdk_version(env["ndk_platform"]) >= 24:
env.Append(CPPDEFINES=[("_FILE_OFFSET_BITS", 64)])
env.Append(CPPDEFINES=[("_FILE_OFFSET_BITS", 64)])
env["neon_enabled"] = False
if env["android_arch"] == "x86":

View File

@@ -226,7 +226,7 @@ static const int EXPORT_FORMAT_AAB = 1;
static const char *APK_ASSETS_DIRECTORY = "res://android/build/assets";
static const char *AAB_ASSETS_DIRECTORY = "res://android/build/assetPackInstallTime/src/main/assets";
static const int DEFAULT_MIN_SDK_VERSION = 21; // Should match the value in 'platform/android/java/app/config.gradle#minSdk'
static const int DEFAULT_MIN_SDK_VERSION = 24; // Should match the value in 'platform/android/java/app/config.gradle#minSdk'
static const int DEFAULT_TARGET_SDK_VERSION = 35; // Should match the value in 'platform/android/java/app/config.gradle#targetSdk'
#ifndef ANDROID_ENABLED
@@ -3388,7 +3388,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
}
// Let's zip-align (must be done before signing)
static const int PAGE_SIZE_KB = 16 * 1024;
static const int ZIP_ALIGNMENT = 4;
// If we're not signing the apk, then the next step should be the last.
@@ -3440,6 +3440,12 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
// Uncompressed file => Align
long new_offset = file_offset + bias;
padding = (ZIP_ALIGNMENT - (new_offset % ZIP_ALIGNMENT)) % ZIP_ALIGNMENT;
const char *ext = strrchr(fname, '.');
if (ext && strcmp(ext, ".so") == 0) {
padding = (PAGE_SIZE_KB - (new_offset % PAGE_SIZE_KB)) % PAGE_SIZE_KB;
} else {
padding = (ZIP_ALIGNMENT - (new_offset % ZIP_ALIGNMENT)) % ZIP_ALIGNMENT;
}
}
memset(extra + info.size_file_extra, 0, padding);

View File

@@ -10,6 +10,7 @@ buildscript {
mavenCentral()
gradlePluginPortal()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://central.sonatype.com/repository/maven-snapshots/"}
//CHUNK_BUILDSCRIPT_REPOSITORIES_BEGIN
//CHUNK_BUILDSCRIPT_REPOSITORIES_END
}
@@ -34,6 +35,7 @@ allprojects {
mavenCentral()
gradlePluginPortal()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://central.sonatype.com/repository/maven-snapshots/"}
//CHUNK_ALLPROJECTS_REPOSITORIES_BEGIN
//CHUNK_ALLPROJECTS_REPOSITORIES_END

View File

@@ -1,14 +1,14 @@
ext.versions = [
androidGradlePlugin: '8.6.1',
compileSdk : 35,
minSdk : 21, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_MIN_SDK_VERSION'
minSdk : 24, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_MIN_SDK_VERSION'
targetSdk : 35, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_TARGET_SDK_VERSION'
buildTools : '35.0.0',
kotlinVersion : '2.1.20',
fragmentVersion : '1.8.6',
nexusPublishVersion: '1.3.0',
javaVersion : JavaVersion.VERSION_17,
ndkVersion : '23.2.8568313' // Also update 'platform/android/detect.py#get_ndk_version' when this is updated.
ndkVersion : '28.1.13356709' // Also update 'platform/android/detect.py#get_ndk_version' when this is updated.
]

View File

@@ -11,6 +11,7 @@ pluginManagement {
mavenCentral()
gradlePluginPortal()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://central.sonatype.com/repository/maven-snapshots/"}
}
}

View File

@@ -18,6 +18,7 @@ allprojects {
mavenCentral()
gradlePluginPortal()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://central.sonatype.com/repository/maven-snapshots/"}
}
}

View File

@@ -1,5 +1,5 @@
# Non functional cmake build file used to provide Android Studio editor support to the project.
cmake_minimum_required(VERSION 3.6)
cmake_minimum_required(VERSION 3.10)
project(godot)
set(CMAKE_CXX_STANDARD 14)

View File

@@ -43,6 +43,11 @@ afterEvaluate {
name = 'Rémi Verschelde'
email = 'rverschelde@gmail.com'
}
developer {
id = 'godotengine'
name = 'Godot Engine contributors'
email = 'contact@godotengine.org'
}
// Add all other devs here...
}

View File

@@ -31,8 +31,8 @@ nexusPublishing {
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}

View File

@@ -14,6 +14,7 @@ pluginManagement {
mavenCentral()
gradlePluginPortal()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://central.sonatype.com/repository/maven-snapshots/"}
}
}