Skip to content

Commit

Permalink
Gradle/Android: Add an option to enable supporting llamacpp
Browse files Browse the repository at this point in the history
This patch adds an option to supporting llamacpp

Signed-off-by: Yelin Jeong <[email protected]>
  • Loading branch information
niley7464 authored and jaeyun-jung committed Dec 19, 2024
1 parent 1d3537e commit 74de764
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ dir.nnstreamerEdge=nnstreamer-edge
dir.mlApi=ml-api
# To use llama2.c uncomment the line below
# dir.llama2c=llama2.c
# To use llamacpp uncomment the line below
# dir.llamacpp=llamacpp
kotlin.code.style=official
android.useAndroidX=true
android.enableJetifier=true
Expand Down
19 changes: 19 additions & 0 deletions nnstreamer-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,25 @@ android {
arguments("LLAMA2C_DIR=$rootPath")
}
}

if (project.hasProperty("dir.llamacpp")) {
val llamacppDir = properties["dir.llamacpp"].toString()

llamacppDir.also { dir ->
val rootPath = externalDirPath.resolve(dir)
val enableLlamacpp = rootPath.isDirectory()

arguments("ENABLE_LLAMACPP=$enableLlamacpp")
if (!enableLlamacpp) {
val msg =
"The property, 'dir.llamacpp', is specified in 'gradle.properties', " +
"but failed to resolve it to $rootPath. llamacpp support will be disabled."
project.logger.lifecycle("WARNING: $msg")
return@also
}
arguments("LLAMACPP_DIR=$rootPath")
}
}
}
}
}
Expand Down

0 comments on commit 74de764

Please sign in to comment.