build.gradle 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. apply plugin: 'com.android.library'
  2. apply plugin: 'de.undercouch.download'
  3. android {
  4. compileSdkVersion 33
  5. buildToolsVersion '33.0.2'
  6. ndkVersion "$ndk_version"
  7. defaultConfig {
  8. minSdkVersion 21
  9. targetSdkVersion 33
  10. externalNativeBuild {
  11. cmake {
  12. arguments "-DANDROID_STL=c++_shared",
  13. "-DENABLE_CURL=1", "-DENABLE_SOUND=1",
  14. "-DENABLE_GETTEXT=1",
  15. "-DBUILD_UNITTESTS=0", "-DENABLE_UPDATE_CHECKER=0"
  16. }
  17. }
  18. }
  19. externalNativeBuild {
  20. cmake {
  21. path file("../../CMakeLists.txt")
  22. }
  23. }
  24. // supported architectures
  25. splits {
  26. abi {
  27. enable true
  28. reset()
  29. include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
  30. }
  31. }
  32. buildTypes {
  33. release {
  34. ndk {
  35. debugSymbolLevel 'FULL'
  36. }
  37. }
  38. }
  39. }
  40. // get precompiled deps
  41. def depsDir = new File(buildDir.parent, 'deps')
  42. if (new File(depsDir, 'armeabi-v7a').exists()) {
  43. task getDeps {
  44. doLast { logger.lifecycle('Using existing deps from {}', depsDir) }
  45. }
  46. } else {
  47. task downloadDeps(type: Download) {
  48. def depsZip = new File(buildDir, 'deps.zip')
  49. src 'https://github.com/minetest/minetest_android_deps/releases/download/latest/deps-lite.zip'
  50. dest depsZip
  51. overwrite false
  52. task getDeps(dependsOn: downloadDeps, type: Copy) {
  53. depsDir.mkdir()
  54. from zipTree(depsZip)
  55. into depsDir
  56. doFirst { logger.lifecycle('Extracting to {}', depsDir) }
  57. }
  58. }
  59. }
  60. preBuild.dependsOn getDeps
  61. clean {
  62. delete new File(buildDir.parent, 'deps')
  63. }