You've already forked TrickyStore
mirror of
https://github.com/5ec1cff/TrickyStore.git
synced 2025-09-06 06:37:07 +00:00
Switch to lsplugin cmaker
Reduce binary size by configuring right flags with it. Signed-off-by: GarfieldHan <2652609017@qq.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import java.security.MessageDigest
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.agp.app)
|
||||
alias(libs.plugins.lsplugin.cmaker)
|
||||
}
|
||||
|
||||
val moduleId: String by rootProject.extra
|
||||
@@ -16,9 +17,9 @@ val abiList: List<String> by rootProject.extra
|
||||
val androidMinSdkVersion: Int by rootProject.extra
|
||||
|
||||
val releaseFlags = arrayOf(
|
||||
"-Oz", "-flto",
|
||||
"-O3", "-flto",
|
||||
"-Wno-unused", "-Wno-unused-parameter",
|
||||
"-Wl,--exclude-libs,ALL", "-Wl,--gc-sections",
|
||||
"-Wl,--exclude-libs,ALL", "-Wl,-icf=all,--lto-O3", "-Wl,-s,-x,--gc-sections"
|
||||
)
|
||||
|
||||
android {
|
||||
@@ -26,15 +27,6 @@ android {
|
||||
ndk {
|
||||
abiFilters.addAll(abiList)
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags("-std=c++23")
|
||||
arguments(
|
||||
"-DANDROID_STL=none",
|
||||
"-DMODULE_NAME=$moduleId"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
@@ -47,13 +39,25 @@ android {
|
||||
path("src/main/cpp/CMakeLists.txt")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmaker {
|
||||
default {
|
||||
val cmakeArgs = arrayOf(
|
||||
"-DANDROID_STL=none",
|
||||
"-DMODULE_NAME=$moduleId",
|
||||
)
|
||||
arguments += cmakeArgs
|
||||
abiFilters("arm64-v8a", "x86_64")
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
externalNativeBuild.cmake {
|
||||
cFlags += releaseFlags
|
||||
when (it.name) {
|
||||
"release" -> {
|
||||
cppFlags += releaseFlags
|
||||
cFlags += releaseFlags
|
||||
}
|
||||
}
|
||||
cppFlags += "--std=c++23"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user