Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / ml / build.gradle.kts
build.gradle.kts33 lines · 1.2 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-library") |
| 3 | } |
| 4 | |
| 5 | androidComponents { |
| 6 | onVariants { variant -> |
| 7 | variant.sources.jniLibs?.addStaticSourceDirectory( |
| 8 | layout.buildDirectory.dir("rustJniLibs").get().asFile.absolutePath |
| 9 | ) |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | // The Vulkan compute ML runtime: `library/ml/src/main/rust`, on ash. |
| 14 | // |
| 15 | // No `externalNativeBuild` and no `ndkVersion`: there is no C++ or CMake in this repo |
| 16 | // (CMake was deliberately removed — see maps/build.gradle.kts:29-31), so cargo does the |
| 17 | // cross-compile and the NDK is only reached for its clang wrappers and glslc. |
| 18 | // |
| 19 | // Shaders are GLSL compute compiled to SPIR-V by the `compileShaders` task (build-logic |
| 20 | // GlslcCompile); `*.glsl` are #include-only and not compiled on their own. |
| 21 | // `-PemulatorAbi=x86_64` additionally cross-compiles for the emulator's ABI so the gate can be |
| 22 | // exercised on an x86_64 host. Off unless asked for, so no default or release build is affected. |
| 23 | rustNativeLib( |
| 24 | "modelrunner", |
| 25 | "ml", |
| 26 | extraAbis = if (providers.gradleProperty("emulatorAbi").orNull == ABI_X86_64) { |
| 27 | listOf(ABI_X86_64) |
| 28 | } else { |
| 29 | emptyList() |
| 30 | }, |
| 31 | shaders = listOf("*.comp"), |
| 32 | glslcArgs = listOf("--target-env=vulkan1.1", "-O"), |
| 33 | ) |