-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gradle/NNSApi: Import ML API including NNStreamer
This patch imports Java implementations of ML API. This subproject also imports native libraries such as NNStreamer, NNStreamer Edge, and GStreamer to bring the ML API into the Android space Signed-off-by: Wook Song <[email protected]>
- Loading branch information
Showing
6 changed files
with
73 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
plugins { | ||
alias(libs.plugins.xyz.simple.git) apply false | ||
alias(libs.plugins.androidApplication) apply false | ||
alias(libs.plugins.androidLibrary) apply false | ||
alias(libs.plugins.jetbrainsKotlinAndroid) apply false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,4 +105,4 @@ tasks { | |
tasks.named("build") { | ||
dependsOn("copyFromTar") | ||
dependsOn("checkoutGitSubmodules") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,96 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
|
||
import kotlin.io.path.Path | ||
import kotlin.io.path.createDirectories | ||
|
||
plugins { | ||
alias(libs.plugins.androidLibrary) | ||
id(libs.plugins.androidLibrary.get().pluginId) | ||
} | ||
|
||
val externalDirPath by rootProject.extra { rootDir.path + "/" + properties["dir.externals"] } | ||
|
||
android { | ||
val pathExternals = findProperty("externalDirPath").toString() | ||
val relativePathExternals = projectDir.toPath().relativize(Path(pathExternals)) | ||
val externalDirPath by rootProject.extra { | ||
project.rootDir.toPath().resolve(properties["dir.externals"].toString()) | ||
} | ||
val relativePathExternals = projectDir.toPath().relativize(externalDirPath) | ||
|
||
namespace = "org.nnsuite.nnstreamer" | ||
compileSdk = libs.versions.android.compile.sdk.get().toInt() | ||
ndkVersion = "25.2.9519653" | ||
|
||
defaultConfig { | ||
minSdk = 21 | ||
minSdk = 33 // The maximum API level supported by the NDK v25.2.9519653 | ||
externalNativeBuild { | ||
ndkBuild { | ||
abiFilters("armeabi-v7a", "arm64-v8a", "x86", "x86_64") | ||
arguments( | ||
"NDK_PROJECT_PATH=./", | ||
"NDK_APPLICATION_MK=Application.mk", | ||
arguments("NDK_PROJECT_PATH=./", | ||
"NDK_APPLICATION_MK=$externalDirPath/ml-api/java/android/nnstreamer/src/main/jni/Application.mk", | ||
"GSTREAMER_JAVA_SRC_DIR=src/main/java", | ||
"GSTREAMER_ROOT_ANDROID=$relativePathExternals/gst-1.0-android-universal", | ||
"NNSTREAMER_ROOT=$relativePathExternals/nnstreamer", | ||
"ML_API_ROOT=$relativePathExternals/ml-api" | ||
"GSTREAMER_ROOT_ANDROID=$externalDirPath/gst-1.0-android-universal", | ||
"NNSTREAMER_ROOT=$externalDirPath/nnstreamer", | ||
"NNSTREAMER_EDGE_ROOT=$externalDirPath/nnstreamer-edge", | ||
"ML_API_ROOT=$externalDirPath/ml-api" | ||
) | ||
targets("nnstreamer_api") | ||
targets("nnstreamer-native") | ||
} | ||
} | ||
} | ||
buildTypes { | ||
debug { | ||
enableUnitTestCoverage=true | ||
} | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") | ||
} | ||
} | ||
externalNativeBuild { | ||
ndkBuild { | ||
path=file("./Android.mk") | ||
path=file("$relativePathExternals/ml-api/java/android/nnstreamer/src/main/jni/Android.mk") | ||
} | ||
} | ||
|
||
productFlavors { | ||
} | ||
|
||
// To do not show build warning messages | ||
packaging { | ||
jniLibs.keepDebugSymbols.add("*/arm64-v8a/*_skel.so") | ||
} | ||
|
||
val genNnsSrc = tasks.register("genNnsSrc", Copy::class) { | ||
val srcDirPath = externalDirPath.resolve("ml-api/java/android/nnstreamer/src/main/java/org/nnsuite/nnstreamer") | ||
val outDirPath = project.projectDir.toPath().resolve("src/main/java/org/nnsuite/nnstreamer").apply { | ||
createDirectories() | ||
} | ||
|
||
group = BasePlugin.BUILD_GROUP | ||
description = "Generates NNStreamer Java sources" | ||
|
||
from(srcDirPath) { | ||
include("*.java") | ||
} | ||
|
||
filter { line: String -> | ||
line.replace("@BUILD_ANDROID@", "") | ||
} | ||
|
||
into(outDirPath) | ||
|
||
filteringCharset = "UTF-8" | ||
outputs.upToDateWhen { false } | ||
} | ||
|
||
sourceSets { | ||
getByName("main") { | ||
java { | ||
srcDirs(genNnsSrc) | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
named("preBuild") { | ||
dependsOn("genNnsSrc") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters