2
0

build.gradle 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. apply plugin: 'com.android.library'
  2. apply plugin: 'de.undercouch.download'
  3. android {
  4. ndkVersion "$ndk_version"
  5. defaultConfig {
  6. minSdkVersion 21
  7. compileSdk 34
  8. targetSdkVersion 34
  9. externalNativeBuild {
  10. cmake {
  11. arguments "-DANDROID_STL=c++_shared",
  12. "-DENABLE_CURL=1", "-DENABLE_SOUND=1",
  13. "-DENABLE_GETTEXT=1",
  14. "-DBUILD_UNITTESTS=0", "-DENABLE_UPDATE_CHECKER=0"
  15. }
  16. }
  17. }
  18. externalNativeBuild {
  19. cmake {
  20. path file("../../CMakeLists.txt")
  21. }
  22. }
  23. // supported architectures
  24. splits {
  25. abi {
  26. enable true
  27. reset()
  28. include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
  29. }
  30. }
  31. buildTypes {
  32. release {
  33. ndk {
  34. debugSymbolLevel 'FULL'
  35. }
  36. }
  37. }
  38. namespace 'net.minetest'
  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. }