From d68c36c0e846d20a0b0edfb41ac929202b3742d6 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Sat, 18 Nov 2023 12:50:26 +0000 Subject: [PATCH] Update to NDK r26 (closes #936) --- product/runtime/CMakeLists.txt | 2 ++ product/runtime/build.gradle | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/product/runtime/CMakeLists.txt b/product/runtime/CMakeLists.txt index b83cac2578..9a3d53631a 100644 --- a/product/runtime/CMakeLists.txt +++ b/product/runtime/CMakeLists.txt @@ -7,6 +7,8 @@ add_compile_options(-DNDEBUG) # This warning appears on Python 3.8 only (https://github.com/python/cpython/pull/14193). add_compile_options(-Wno-deprecated-declarations) +# The Android Gradle plugin may strip libraries before building them into an app, but +# we don't want to require the app developer to have the NDK installed. set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -s") include_directories( diff --git a/product/runtime/build.gradle b/product/runtime/build.gradle index dc0cf3cb2b..a3e828ea8b 100644 --- a/product/runtime/build.gradle +++ b/product/runtime/build.gradle @@ -219,10 +219,18 @@ def proxyTask = tasks.register("generateStaticProxy", Exec) { } sourceSets.test.java.srcDir(proxyTask) +// CMakeLists.txt may contain configuration-specific settings, so make sure we only use +// one of the known configurations. +String cmakeBuildType = findProperty("cmakeBuildType") ?: "Debug" +def KNOWN_BUILD_TYPES = ["Debug", "Release"] +if (!(cmakeBuildType in KNOWN_BUILD_TYPES)) { + throw new GradleException( + "Unknown build type '$cmakeBuildType'; valid values are $KNOWN_BUILD_TYPES") +} + (["host"] + Common.ABIS).each { abi -> def pyLibSuffix = ".so" def cmakeBuildSubdir = "$buildDir/cmake/$abi" - def cmakeBuildType = findProperty("cmakeBuildType") ?: "Debug" def cmake = tasks.register("cmake-$abi", Exec) { group = "build" dependsOn("cythonPython", "cythonJava") @@ -264,7 +272,7 @@ sourceSets.test.java.srcDir(proxyTask) // This must be one of the NDK versions which are pre-installed on the // GitHub Actions runner. Ideally it would also match the version in // target/build-common.sh, but the latter is more difficult to change. - def ndkDir = sdkPath("ndk/23.2.8568313") + def ndkDir = sdkPath("ndk/26.1.10909125") def prefixDir = "$projectDir/../../target/prefix/$abi" args "-DCMAKE_TOOLCHAIN_FILE=$ndkDir/build/cmake/android.toolchain.cmake", "-DANDROID_ABI=$abi", "-DANDROID_STL=system",