Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle/Android: Add an option to enable supporting llamacpp #129

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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