Skip to content

Commit

Permalink
Use gradle properties
Browse files Browse the repository at this point in the history
  • Loading branch information
luciferous committed Jan 29, 2024
1 parent a2867fa commit 90c22fa
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,14 @@ jobs:
steps:
- name: Clone
uses: actions/checkout@v3
with:
path: whisper

- name: Clone
uses: actions/checkout@v3
with:
repository: ggerganov/ggml
path: ggml

- name: Install Java
uses: actions/setup-java@v3
Expand All @@ -428,9 +436,15 @@ jobs:

- name: Build
run: |
cd examples/whisper.android
cd whisper/examples/whisper.android
./gradlew assembleRelease --no-daemon
- name: Build with external ggml
run: |
export PATH_TO_GGML=$PWD/ggml
cd whisper/examples/whisper.android
./gradlew assembleRelease --no-daemon -PGGML_HOME=$PATH_TO_GGML
android_java:
runs-on: ubuntu-latest

Expand Down
28 changes: 17 additions & 11 deletions examples/whisper.android/lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,24 @@ android {
}
externalNativeBuild {
cmake {
// When set, builds whisper.android against the version located at GGML_HOME
// instead of the version bundled with whisper.cpp.
//
// arguments "-DGGML_HOME=${rootDir.absolutePath}/../../../ggml",
// When set, builds whisper.android against the version located
// at GGML_HOME instead of the copy bundled with whisper.cpp.
if (
project.hasProperty('GGML_HOME') &&
project.findProperty('GGML_CLBLAST') == 'ON'
) {
// Turning on CLBlast requires GGML_HOME
arguments "-DGGML_HOME=${project.property('GGML_HOME')}",
"-DGGML_CLBLAST=ON",
"-DOPENCL_LIB=${project.property('OPENCL_LIB')}",
"-DCLBLAST_HOME=${project.property('CLBLAST_HOME')}",
"-DOPENCL_ROOT=${project.property('OPENCL_ROOT')}",
"-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH",
"-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH"
} else if (project.hasProperty('GGML_HOME')) {
arguments "-DGGML_HOME=${project.property('GGML_HOME')}"
}

// Turn on CLBlast on supported architectures (requires GGML_HOME):
// "-DGGML_CLBLAST=ON"
// "-DOPENCL_LIB=${rootDir.absolutePath}/lib/src/main/jniLibs/arm64-v8a/libOpenCL.so",
// "-DCLBLAST_HOME=${rootDir.absolutePath}/../../../CLBlast",
// "-DOPENCL_ROOT=${rootDir.absolutePath}/../../../OpenCL-Headers",
// "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH",
// "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH"
}
}
}
Expand Down

0 comments on commit 90c22fa

Please sign in to comment.