2023-08-10 19:05:20 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16...3.26)
|
|
|
|
|
|
|
|
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)
|
|
|
|
|
|
|
|
project(${_name} VERSION ${_version})
|
|
|
|
|
2023-08-13 20:53:25 +00:00
|
|
|
option(ENABLE_FRONTEND_API "Use obs-frontend-api for UI functionality" ON)
|
|
|
|
option(ENABLE_QT "Use Qt functionality" ON)
|
2024-05-10 21:37:09 +00:00
|
|
|
option(ENABLE_TESTS "Enable tests" OFF)
|
2023-08-10 19:05:20 +00:00
|
|
|
|
|
|
|
include(compilerconfig)
|
|
|
|
include(defaults)
|
|
|
|
include(helpers)
|
|
|
|
|
|
|
|
add_library(${CMAKE_PROJECT_NAME} MODULE)
|
|
|
|
|
|
|
|
find_package(libobs REQUIRED)
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE OBS::libobs)
|
|
|
|
|
|
|
|
if(ENABLE_FRONTEND_API)
|
|
|
|
find_package(obs-frontend-api REQUIRED)
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE OBS::obs-frontend-api)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_QT)
|
|
|
|
find_qt(COMPONENTS Widgets Core)
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Qt::Core Qt::Widgets)
|
|
|
|
target_compile_options(
|
|
|
|
${CMAKE_PROJECT_NAME} PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang>:-Wno-quoted-include-in-framework-header
|
|
|
|
-Wno-comma>)
|
|
|
|
set_target_properties(
|
|
|
|
${CMAKE_PROJECT_NAME}
|
|
|
|
PROPERTIES AUTOMOC ON
|
|
|
|
AUTOUIC ON
|
|
|
|
AUTORCC ON)
|
|
|
|
endif()
|
|
|
|
|
2023-08-12 20:51:51 +00:00
|
|
|
set(USE_SYSTEM_CURL
|
|
|
|
OFF
|
|
|
|
CACHE STRING "Use system cURL")
|
|
|
|
|
|
|
|
if(USE_SYSTEM_CURL)
|
|
|
|
find_package(CURL REQUIRED)
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE "${CURL_LIBRARIES}")
|
|
|
|
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM PUBLIC "${CURL_INCLUDE_DIRS}")
|
|
|
|
else()
|
|
|
|
include(cmake/BuildMyCurl.cmake)
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libcurl)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(cmake/BuildWhispercpp.cmake)
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Whispercpp)
|
|
|
|
|
2024-04-01 18:37:31 +00:00
|
|
|
include(cmake/BuildCTranslate2.cmake)
|
|
|
|
include(cmake/BuildSentencepiece.cmake)
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ct2 sentencepiece)
|
|
|
|
|
2024-04-14 02:39:28 +00:00
|
|
|
set(USE_SYSTEM_ONNXRUNTIME
|
|
|
|
OFF
|
|
|
|
CACHE STRING "Use system ONNX Runtime")
|
|
|
|
|
|
|
|
set(DISABLE_ONNXRUNTIME_GPU
|
|
|
|
OFF
|
|
|
|
CACHE STRING "Disables GPU support of ONNX Runtime (Only valid on Linux)")
|
|
|
|
|
|
|
|
if(DISABLE_ONNXRUNTIME_GPU)
|
|
|
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE DISABLE_ONNXRUNTIME_GPU)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_SYSTEM_ONNXRUNTIME)
|
|
|
|
if(OS_LINUX)
|
|
|
|
find_package(Onnxruntime 1.16.3 REQUIRED)
|
|
|
|
set(Onnxruntime_INCLUDE_PATH
|
|
|
|
${Onnxruntime_INCLUDE_DIR} ${Onnxruntime_INCLUDE_DIR}/onnxruntime
|
|
|
|
${Onnxruntime_INCLUDE_DIR}/onnxruntime/core/session ${Onnxruntime_INCLUDE_DIR}/onnxruntime/core/providers/cpu)
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE "${Onnxruntime_LIBRARIES}")
|
|
|
|
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM PUBLIC "${Onnxruntime_INCLUDE_PATH}")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "System ONNX Runtime is only supported on Linux!")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
include(cmake/FetchOnnxruntime.cmake)
|
|
|
|
endif()
|
|
|
|
|
2023-08-13 14:55:04 +00:00
|
|
|
target_sources(
|
|
|
|
${CMAKE_PROJECT_NAME}
|
2023-11-20 14:18:06 +00:00
|
|
|
PRIVATE src/plugin-main.c
|
|
|
|
src/transcription-filter.cpp
|
|
|
|
src/transcription-filter.c
|
2024-06-05 22:02:36 +00:00
|
|
|
src/transcription-filter-callbacks.cpp
|
|
|
|
src/transcription-filter-utils.cpp
|
2024-04-25 21:14:13 +00:00
|
|
|
src/transcription-utils.cpp
|
2023-11-20 14:18:06 +00:00
|
|
|
src/model-utils/model-downloader.cpp
|
|
|
|
src/model-utils/model-downloader-ui.cpp
|
2024-04-01 18:37:31 +00:00
|
|
|
src/model-utils/model-infos.cpp
|
2024-05-10 21:37:09 +00:00
|
|
|
src/model-utils/model-find-utils.cpp
|
2024-04-14 02:39:28 +00:00
|
|
|
src/whisper-utils/whisper-processing.cpp
|
2024-04-01 18:37:31 +00:00
|
|
|
src/whisper-utils/whisper-utils.cpp
|
2024-05-10 21:37:09 +00:00
|
|
|
src/whisper-utils/whisper-model-utils.cpp
|
2024-04-14 02:39:28 +00:00
|
|
|
src/whisper-utils/silero-vad-onnx.cpp
|
2024-04-25 21:14:13 +00:00
|
|
|
src/whisper-utils/token-buffer-thread.cpp
|
2024-05-16 19:07:00 +00:00
|
|
|
src/translation/language_codes.cpp
|
2024-04-18 14:28:32 +00:00
|
|
|
src/translation/translation.cpp
|
2024-06-05 22:02:36 +00:00
|
|
|
src/translation/translation-utils.cpp)
|
2023-08-10 19:05:20 +00:00
|
|
|
|
|
|
|
set_target_properties_plugin(${CMAKE_PROJECT_NAME} PROPERTIES OUTPUT_NAME ${_name})
|
2024-05-10 21:37:09 +00:00
|
|
|
|
|
|
|
if(ENABLE_TESTS)
|
|
|
|
add_executable(${CMAKE_PROJECT_NAME}-tests)
|
|
|
|
|
|
|
|
include(cmake/FindLibAvObs.cmake)
|
|
|
|
|
|
|
|
target_sources(
|
|
|
|
${CMAKE_PROJECT_NAME}-tests
|
|
|
|
PRIVATE src/tests/localvocal-offline-test.cpp
|
2024-05-16 19:07:00 +00:00
|
|
|
src/tests/audio-file-utils.cpp
|
2024-05-10 21:37:09 +00:00
|
|
|
src/transcription-utils.cpp
|
|
|
|
src/model-utils/model-infos.cpp
|
|
|
|
src/model-utils/model-find-utils.cpp
|
|
|
|
src/whisper-utils/whisper-processing.cpp
|
|
|
|
src/whisper-utils/whisper-utils.cpp
|
|
|
|
src/whisper-utils/silero-vad-onnx.cpp
|
|
|
|
src/whisper-utils/token-buffer-thread.cpp
|
2024-05-16 19:07:00 +00:00
|
|
|
src/translation/language_codes.cpp
|
2024-06-05 22:02:36 +00:00
|
|
|
src/translation/translation.cpp)
|
2024-05-10 21:37:09 +00:00
|
|
|
|
|
|
|
find_libav(${CMAKE_PROJECT_NAME}-tests)
|
|
|
|
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME}-tests PRIVATE ct2 sentencepiece Whispercpp Ort OBS::libobs)
|
|
|
|
target_include_directories(${CMAKE_PROJECT_NAME}-tests PRIVATE src)
|
|
|
|
|
|
|
|
# install the tests to the release/test directory
|
|
|
|
install(TARGETS ${CMAKE_PROJECT_NAME}-tests DESTINATION test)
|
|
|
|
endif()
|