v2 rebuild: GDI+ single-surface UI, self-calibrating progress, compact push-to-talk, GGML+Whisper integration
This commit is contained in:
+64
-26
@@ -18,25 +18,32 @@ option(WHISPER_NO_AVX2 "whisper: disable AVX2" OFF)
|
||||
option(WHISPER_NO_FMA "whisper: disable FMA" OFF)
|
||||
option(WHISPER_NO_F16C "whisper: disable F16C" OFF)
|
||||
|
||||
# ----------------------------
|
||||
# SDL2
|
||||
# ----------------------------
|
||||
if(NOT SDL2_DIR)
|
||||
set(SDL2_DIR "${CMAKE_CURRENT_SOURCE_DIR}/SDL2-mingw/cmake")
|
||||
endif()
|
||||
|
||||
find_package(SDL2 REQUIRED)
|
||||
|
||||
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
|
||||
# GGML
|
||||
add_subdirectory(ggml)
|
||||
# ----------------------------
|
||||
# Whisper (ONLY dependency layer)
|
||||
# ----------------------------
|
||||
# IMPORTANT:
|
||||
# We no longer build ggml separately.
|
||||
# whisper/ must contain its own CMakeLists.txt (modern whisper.cpp layout)
|
||||
add_subdirectory(whisper)
|
||||
|
||||
# Whisper
|
||||
# We need to handle include paths for whisper.
|
||||
# whisper/src/CMakeLists.txt expects ../include/whisper.h
|
||||
add_subdirectory(whisper/src)
|
||||
|
||||
# Common Library (needed by win-dictation) - optional if files don't exist
|
||||
# ----------------------------
|
||||
# Common Library (optional legacy utilities)
|
||||
# ----------------------------
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/common.h")
|
||||
|
||||
set(COMMON_TARGET common)
|
||||
|
||||
add_library(${COMMON_TARGET} STATIC
|
||||
common/common.h
|
||||
common/common.cpp
|
||||
@@ -47,32 +54,39 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/common.h")
|
||||
common/grammar-parser.h
|
||||
common/grammar-parser.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${COMMON_TARGET} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/common
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/whisper/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ggml/include
|
||||
)
|
||||
|
||||
# Link against whisper target only (no ggml exposure)
|
||||
target_link_libraries(${COMMON_TARGET} PRIVATE whisper)
|
||||
|
||||
set(COMMON_SDL_TARGET common-sdl)
|
||||
|
||||
add_library(${COMMON_SDL_TARGET} STATIC
|
||||
common/common-sdl.h
|
||||
common/common-sdl.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${COMMON_SDL_TARGET} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/common
|
||||
${SDL2_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(${COMMON_SDL_TARGET} PRIVATE ${SDL2_LIBRARIES})
|
||||
|
||||
else()
|
||||
# Create empty common libraries if files don't exist
|
||||
|
||||
# Empty fallback targets
|
||||
add_library(common INTERFACE)
|
||||
add_library(common-sdl INTERFACE)
|
||||
target_include_directories(common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/whisper/include)
|
||||
target_include_directories(common-sdl INTERFACE ${SDL2_INCLUDE_DIRS})
|
||||
|
||||
endif()
|
||||
|
||||
# Win Dictation Executable
|
||||
# ----------------------------
|
||||
# Main executable
|
||||
# ----------------------------
|
||||
add_executable(win-dictation WIN32
|
||||
src/main.cpp
|
||||
src/transcriber.cpp
|
||||
@@ -90,13 +104,28 @@ target_link_libraries(win-dictation PRIVATE
|
||||
target_include_directories(win-dictation PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/common
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/whisper/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ggml/include
|
||||
${SDL2_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_compile_definitions(win-dictation PRIVATE UNICODE _UNICODE)
|
||||
|
||||
# ----------------------------
|
||||
# Tests
|
||||
# ----------------------------
|
||||
add_executable(test-core
|
||||
tests/test_core.cpp
|
||||
src/transcriber.cpp
|
||||
src/transcriber.h
|
||||
)
|
||||
target_link_libraries(test-core PRIVATE whisper ${SDL2_LIBRARIES})
|
||||
target_include_directories(test-core PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/common
|
||||
)
|
||||
target_compile_definitions(test-core PRIVATE UNICODE _UNICODE)
|
||||
|
||||
# ----------------------------
|
||||
# MSVC optimisations
|
||||
# ----------------------------
|
||||
if(MSVC)
|
||||
target_compile_options(win-dictation PRIVATE
|
||||
$<$<CONFIG:Release>:/O2 /GL>
|
||||
@@ -106,17 +135,26 @@ if(MSVC)
|
||||
)
|
||||
endif()
|
||||
|
||||
# Copy SDL2.dll to output directory
|
||||
add_custom_command(TARGET win-dictation POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/release/WinDictation/SDL2.dll"
|
||||
$<TARGET_FILE_DIR:win-dictation>
|
||||
)
|
||||
# ----------------------------
|
||||
# Post build: runtime assets
|
||||
# ----------------------------
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/SDL2-2.28.5/lib/x64/SDL2.dll")
|
||||
add_custom_command(TARGET win-dictation POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/deps/SDL2-2.28.5/lib/x64/SDL2.dll"
|
||||
$<TARGET_FILE_DIR:win-dictation>
|
||||
)
|
||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/release/WinDictation/SDL2.dll")
|
||||
add_custom_command(TARGET win-dictation POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/release/WinDictation/SDL2.dll"
|
||||
$<TARGET_FILE_DIR:win-dictation>
|
||||
)
|
||||
endif()
|
||||
|
||||
# Copy models directory to output
|
||||
add_custom_command(TARGET win-dictation POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:win-dictation>/models
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/models"
|
||||
$<TARGET_FILE_DIR:win-dictation>/models
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user