Initial Commit
parent
1558ec5a16
commit
662f582e9d
|
@ -3,12 +3,14 @@ cmake_minimum_required (VERSION 3.5)
|
|||
project(whisper.cpp VERSION 1.5.4)
|
||||
set(SOVERSION 1)
|
||||
|
||||
set(WHISPER_BASE_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
# Add path to modules
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
||||
list(APPEND CMAKE_MODULE_PATH "${WHISPER_BASE_DIR}/cmake/")
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
if(PROJECT_IS_TOP_LEVEL AND CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
set(WHISPER_STANDALONE ON)
|
||||
include(GitVars)
|
||||
include(BuildTypes)
|
||||
|
@ -17,11 +19,13 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|||
if (EXISTS "${CMAKE_SOURCE_DIR}/bindings/ios/Makefile-tmpl")
|
||||
configure_file(${CMAKE_SOURCE_DIR}/bindings/ios/Makefile-tmpl ${CMAKE_SOURCE_DIR}/bindings/ios/Makefile @ONLY)
|
||||
endif()
|
||||
configure_file(${CMAKE_SOURCE_DIR}/bindings/javascript/package-tmpl.json ${CMAKE_SOURCE_DIR}/bindings/javascript/package.json @ONLY)
|
||||
configure_file(${WHISPER_BASE_DIR}/bindings/javascript/package-tmpl.json ${CMAKE_SOURCE_DIR}/bindings/javascript/package.json @ONLY)
|
||||
else()
|
||||
set(WHISPER_STANDALONE OFF)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
||||
|
||||
|
@ -249,7 +253,7 @@ if (WHISPER_CUBLAS)
|
|||
|
||||
enable_language(CUDA)
|
||||
|
||||
set(GGML_SOURCES_CUDA ggml-cuda.cu ggml-cuda.h)
|
||||
set(GGML_SOURCES_CUDA ${WHISPER_BASE_DIR}/ggml-cuda.cu ${WHISPER_BASE_DIR}/ggml-cuda.h)
|
||||
|
||||
add_compile_definitions(GGML_USE_CUBLAS)
|
||||
|
||||
|
@ -527,21 +531,21 @@ endif()
|
|||
set(TARGET whisper)
|
||||
|
||||
add_library(${TARGET}
|
||||
ggml.h
|
||||
ggml.c
|
||||
ggml-alloc.h
|
||||
ggml-alloc.c
|
||||
ggml-backend.h
|
||||
ggml-backend.c
|
||||
ggml-quants.h
|
||||
ggml-quants.c
|
||||
${WHISPER_BASE_DIR}/ggml.h
|
||||
${WHISPER_BASE_DIR}/ggml.c
|
||||
${WHISPER_BASE_DIR}/ggml-alloc.h
|
||||
${WHISPER_BASE_DIR}/ggml-alloc.c
|
||||
${WHISPER_BASE_DIR}/ggml-backend.h
|
||||
${WHISPER_BASE_DIR}/ggml-backend.c
|
||||
${WHISPER_BASE_DIR}/ggml-quants.h
|
||||
${WHISPER_BASE_DIR}/ggml-quants.c
|
||||
${GGML_SOURCES_METAL}
|
||||
${GGML_SOURCES_CUDA}
|
||||
${GGML_SOURCES_OPENCL}
|
||||
${GGML_SOURCES_SYCL}
|
||||
${GGML_HEADERS_SYCL}
|
||||
whisper.h
|
||||
whisper.cpp
|
||||
${WHISPER_BASE_DIR}/whisper.h
|
||||
${WHISPER_BASE_DIR}/whisper.cpp
|
||||
)
|
||||
|
||||
# Set the version numbers
|
||||
|
@ -591,7 +595,7 @@ if (BUILD_SHARED_LIBS)
|
|||
if (WHISPER_METAL)
|
||||
# TODO: I think this should make ggml-metal.m "see" the ggml-metal.metal file from the "bin" directory
|
||||
# but for some reason it does not work here like it does in llama.cpp
|
||||
set_target_properties(${TARGET} PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/ggml-metal.metal")
|
||||
set_target_properties(${TARGET} PROPERTIES RESOURCE "${WHISPER_BASE_DIR}/ggml-metal.metal")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -631,7 +635,7 @@ install(TARGETS ${TARGET}
|
|||
# bindings
|
||||
#
|
||||
|
||||
add_subdirectory(bindings)
|
||||
add_subdirectory(${WHISPER_BASE_DIR}/bindings)
|
||||
|
||||
#
|
||||
# programs, examples and tests
|
||||
|
@ -639,9 +643,9 @@ add_subdirectory(bindings)
|
|||
|
||||
if (WHISPER_BUILD_TESTS AND NOT CMAKE_JS_VERSION)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(${WHISPER_BASE_DIR}/tests)
|
||||
endif ()
|
||||
|
||||
if (WHISPER_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
add_subdirectory(${WHISPER_BASE_DIR}/examples)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue