Merge remote-tracking branch 'upstream/master' into swe_pr/get_rows

This commit is contained in:
Swetha B S 2025-06-19 23:39:31 -07:00
commit c7f988fac7
7 changed files with 22 additions and 59 deletions

View File

@ -3,13 +3,13 @@ plugins {
} }
android { android {
compileSdkVersion 30 compileSdkVersion 31
buildToolsVersion '30.0.3' buildToolsVersion '30.0.3'
defaultConfig { defaultConfig {
applicationId "com.litongjava.whisper.android.java" applicationId "com.litongjava.whisper.android.java"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 31
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
@ -55,4 +55,4 @@ dependencies {
implementation 'com.litongjava:android-view-inject:1.0' implementation 'com.litongjava:android-view-inject:1.0'
implementation 'com.litongjava:jfinal-aop:1.0.1' implementation 'com.litongjava:jfinal-aop:1.0.1'
implementation 'com.litongjava:litongjava-android-utils:1.0.0' implementation 'com.litongjava:litongjava-android-utils:1.0.0'
} }

View File

@ -10,7 +10,7 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.Whisperandroidjava"> android:theme="@style/Theme.Whisperandroidjava">
<activity android:name=".MainActivity"> <activity android:name=".MainActivity" android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -19,4 +19,4 @@
</activity> </activity>
</application> </application>
</manifest> </manifest>

View File

@ -72,4 +72,4 @@ public class WhisperLib {
public static native String benchMemcpy(int nthread); public static native String benchMemcpy(int nthread);
public static native String benchGgmlMulMat(int nthread); public static native String benchGgmlMulMat(int nthread);
} }

View File

@ -6,28 +6,14 @@ set(CMAKE_CXX_STANDARD 17)
set(WHISPER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../../../../../../) set(WHISPER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../../../../../../)
set(SOURCE_FILES set(SOURCE_FILES
${WHISPER_LIB_DIR}/ggml/src/ggml.c
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/ggml-cpu.c
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/traits.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/arch/arm/quants.c
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/arch/arm/repack.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/quants.c
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/ggml-cpu.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/unary-ops.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/binary-ops.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/vec.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/ops.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 ${WHISPER_LIB_DIR}/src/whisper.cpp
${CMAKE_SOURCE_DIR}/jni.c ${CMAKE_SOURCE_DIR}/jni.c
) )
find_library(LOG_LIB log) find_library(LOG_LIB log)
include(FetchContent)
function(build_library target_name) function(build_library target_name)
add_library( add_library(
${target_name} ${target_name}
@ -35,7 +21,10 @@ function(build_library target_name)
${SOURCE_FILES} ${SOURCE_FILES}
) )
target_link_libraries(${target_name} ${LOG_LIB} android) FetchContent_Declare(ggml SOURCE_DIR ${WHISPER_LIB_DIR}/ggml)
FetchContent_MakeAvailable(ggml)
target_link_libraries(${target_name} ${LOG_LIB} android ggml)
target_compile_definitions(${target_name} PUBLIC GGML_USE_CPU) target_compile_definitions(${target_name} PUBLIC GGML_USE_CPU)
if (${target_name} STREQUAL "whisper_v8fp16_va") if (${target_name} STREQUAL "whisper_v8fp16_va")

View File

@ -2,10 +2,10 @@
buildscript { buildscript {
repositories { repositories {
google() google()
jcenter() mavenCentral()
} }
dependencies { dependencies {
classpath "com.android.tools.build:gradle:4.1.3" classpath "com.android.tools.build:gradle:7.4.0"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
@ -15,7 +15,7 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
google() google()
jcenter() mavenCentral()
maven { url "https://maven.aliyun.com/repository/gradle-plugin" } maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
} }
} }

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

View File

@ -14,34 +14,10 @@ set(
${CMAKE_SOURCE_DIR}/jni.c ${CMAKE_SOURCE_DIR}/jni.c
) )
# TODO: this needs to be updated to work with the new ggml CMakeLists
if (NOT GGML_HOME)
set(
SOURCE_FILES
${SOURCE_FILES}
${WHISPER_LIB_DIR}/ggml/src/ggml.c
${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}/ggml/src/ggml-cpu/ggml-cpu.c
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/ggml-cpu.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/hbm.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/traits.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/unary-ops.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/binary-ops.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/vec.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/ops.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/arch/arm/quants.c
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/arch/arm/repack.cpp
${WHISPER_LIB_DIR}/ggml/src/ggml-cpu/quants.c
)
endif()
find_library(LOG_LIB log) find_library(LOG_LIB log)
include(FetchContent)
function(build_library target_name) function(build_library target_name)
add_library( add_library(
${target_name} ${target_name}
@ -70,15 +46,13 @@ function(build_library target_name)
endif () endif ()
if (GGML_HOME) if (GGML_HOME)
include(FetchContent)
FetchContent_Declare(ggml SOURCE_DIR ${GGML_HOME}) FetchContent_Declare(ggml SOURCE_DIR ${GGML_HOME})
FetchContent_MakeAvailable(ggml)
target_compile_options(ggml PRIVATE ${GGML_COMPILE_OPTIONS})
target_link_libraries(${target_name} ${LOG_LIB} android ggml)
else() else()
target_link_libraries(${target_name} ${LOG_LIB} android) FetchContent_Declare(ggml SOURCE_DIR ${WHISPER_LIB_DIR}/ggml)
endif() endif()
FetchContent_MakeAvailable(ggml)
target_compile_options(ggml PRIVATE ${GGML_COMPILE_OPTIONS})
target_link_libraries(${target_name} ${LOG_LIB} android ggml)
endfunction() endfunction()