From 226d344f565ea6140e7c6a583bc300a64454af58 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 25 Mar 2025 16:01:59 +0100 Subject: [PATCH] whisper.android.java : update build with ggml source changes (#2942) * whisper.android.java : update build with ggml source changes This commit updates the whisper.android.java build to include the new ggml source files and directories. The gradle build configuration is also updated to include the aliyun maven repository. --- .../app/src/main/jni/whisper/CMakeLists.txt | 12 ++++++++++-- examples/whisper.android.java/build.gradle | 3 ++- examples/whisper.android.java/gradlew | 0 3 files changed, 12 insertions(+), 3 deletions(-) mode change 100644 => 100755 examples/whisper.android.java/gradlew diff --git a/examples/whisper.android.java/app/src/main/jni/whisper/CMakeLists.txt b/examples/whisper.android.java/app/src/main/jni/whisper/CMakeLists.txt index 91007252..1ea30917 100644 --- a/examples/whisper.android.java/app/src/main/jni/whisper/CMakeLists.txt +++ b/examples/whisper.android.java/app/src/main/jni/whisper/CMakeLists.txt @@ -2,15 +2,21 @@ cmake_minimum_required(VERSION 3.10) project(whisper.cpp) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(WHISPER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../../../../../../) set(SOURCE_FILES ${WHISPER_LIB_DIR}/ggml/src/ggml.c - ${WHISPER_LIB_DIR}/ggml/src/ggml-aarch64.c + ${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/ggml-cpu.c + ${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/ggml-cpu-aarch64.cpp + ${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/ggml-cpu-traits.cpp + ${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/ggml-cpu-quants.c + ${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/ggml-cpu.cpp ${WHISPER_LIB_DIR}/ggml/src/ggml-alloc.c ${WHISPER_LIB_DIR}/ggml/src/ggml-backend.cpp + ${WHISPER_LIB_DIR}/ggml/src/ggml-backend-reg.cpp ${WHISPER_LIB_DIR}/ggml/src/ggml-quants.c + ${WHISPER_LIB_DIR}/ggml/src/ggml-threading.cpp ${WHISPER_LIB_DIR}/src/whisper.cpp ${CMAKE_SOURCE_DIR}/jni.c ) @@ -25,6 +31,7 @@ function(build_library target_name) ) target_link_libraries(${target_name} ${LOG_LIB} android) + target_compile_definitions(${target_name} PUBLIC GGML_USE_CPU) if (${target_name} STREQUAL "whisper_v8fp16_va") target_compile_options(${target_name} PRIVATE -march=armv8.2-a+fp16) @@ -57,3 +64,4 @@ include_directories(${WHISPER_LIB_DIR}/src) include_directories(${WHISPER_LIB_DIR}/include) include_directories(${WHISPER_LIB_DIR}/ggml/include) include_directories(${WHISPER_LIB_DIR}/ggml/src) +include_directories(${WHISPER_LIB_DIR}/ggml/src/ggml-cpu) diff --git a/examples/whisper.android.java/build.gradle b/examples/whisper.android.java/build.gradle index 450441ac..cc32112c 100644 --- a/examples/whisper.android.java/build.gradle +++ b/examples/whisper.android.java/build.gradle @@ -16,9 +16,10 @@ allprojects { repositories { google() jcenter() + maven { url "https://maven.aliyun.com/repository/gradle-plugin" } } } task clean(type: Delete) { delete rootProject.buildDir -} \ No newline at end of file +} diff --git a/examples/whisper.android.java/gradlew b/examples/whisper.android.java/gradlew old mode 100644 new mode 100755