Skip to content

Commit 69923d0

Browse files
committed
update to v0.2, adding --translate --translate-host
1 parent 6d5e779 commit 69923d0

File tree

7 files changed

+307
-114
lines changed

7 files changed

+307
-114
lines changed

CMakeLists.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
55
set(CMAKE_CXX_EXTENSIONS OFF)
66

77
project(get-livecaptions)
8-
add_executable(get-livecaptions src/main.cpp src/pch.cpp)
9-
target_precompile_headers(get-livecaptions PRIVATE src/pch.h)
8+
9+
include(FetchContent)
10+
FetchContent_Declare(CPM GIT_REPOSITORY https://github.com/cpm-cmake/CPM.cmake.git GIT_TAG v0.42.0)
11+
FetchContent_MakeAvailable(CPM)
12+
CPMAddPackage("gh:argosopentech/LibreTranslate-cpp#main")
1013

1114
find_package(asio CONFIG REQUIRED)
1215
find_package(wil CONFIG REQUIRED)
1316
find_package(argparse CONFIG REQUIRED)
14-
target_link_libraries(get-livecaptions PRIVATE WIL::WIL asio::asio argparse::argparse)
17+
find_package(CURL CONFIG REQUIRED)
18+
19+
add_executable(get-livecaptions src/main.cpp src/pch.cpp ${LibreTranslate-cpp_SOURCE_DIR}/LibreTranslate.cpp)
20+
target_precompile_headers(get-livecaptions PRIVATE src/pch.h)
21+
target_include_directories(get-livecaptions PRIVATE ${LibreTranslate-cpp_SOURCE_DIR})
22+
target_link_libraries(get-livecaptions PRIVATE WIL::WIL asio::asio argparse::argparse windowsapp CURL::libcurl)
1523

16-
#if you use lastest cppwinrt from vcpkg, uncomment following
1724
#find_package(cppwinrt CONFIG REQUIRED)
18-
#target_link_libraries(get-livecaptions PRIVATE WIL::WIL asio::asio Microsoft::CppWinRT RuntimeObject.lib)
25+
#target_link_libraries(get-livecaptions PRIVATE WIL::WIL asio::asio Microsoft::CppWinRT RuntimeObject.lib windowsapp)

CMakePresets.json

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,55 @@
11
{
2-
"version": 8,
3-
"cmakeMinimumRequired": {
4-
"major": 3,
5-
"minor": 21,
6-
"patch": 0
2+
"version": 8,
3+
4+
"configurePresets": [
5+
{
6+
"name": "vs2026-x64",
7+
"generator": "Visual Studio 17 2022",
8+
"architecture": "x64",
9+
"binaryDir": "${sourceDir}/builds/${presetName}",
10+
"toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
711
},
8-
"configurePresets": [
9-
{
10-
"name": "ninja-multi-vcpkg",
11-
"displayName": "Ninja Multi-Config",
12-
"description": "Configure with vcpkg toolchain and generate Ninja project files for all configurations",
13-
"binaryDir": "${sourceDir}/builds/${presetName}",
14-
"generator": "Ninja Multi-Config",
15-
"toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
16-
}
17-
],
18-
"buildPresets": [
19-
{
20-
"name": "ninja-vcpkg-debug",
21-
"configurePreset": "ninja-multi-vcpkg",
22-
"displayName": "Build (Debug)",
23-
"description": "Build with Ninja/vcpkg (Debug)",
24-
"configuration": "Debug"
25-
},
26-
{
27-
"name": "ninja-vcpkg-release",
28-
"configurePreset": "ninja-multi-vcpkg",
29-
"displayName": "Build (Release)",
30-
"description": "Build with Ninja/vcpkg (Release)",
31-
"configuration": "Release"
32-
}
33-
]
34-
}
12+
13+
{
14+
"name": "vs2026-x64-static",
15+
"inherits": "vs2026-x64",
16+
"displayName": "VS2026 x64 (Static zlib/libcurl)",
17+
"description": "Use vcpkg static triplet for zlib/libcurl only",
18+
"cacheVariables": {
19+
"VCPKG_TARGET_TRIPLET": "x64-windows-static"
20+
}
21+
}
22+
],
23+
24+
"buildPresets": [
25+
{
26+
"name": "debug",
27+
"configurePreset": "vs2026-x64",
28+
"displayName": "Build (Debug)",
29+
"description": "Build with vsbuild/vcpkg (Debug)",
30+
"configuration": "Debug"
31+
},
32+
{
33+
"name": "release",
34+
"configurePreset": "vs2026-x64",
35+
"displayName": "Build (Release)",
36+
"description": "Build with vsbuild/vcpkg (Release)",
37+
"configuration": "Release"
38+
},
39+
40+
{
41+
"name": "debug-static",
42+
"configurePreset": "vs2026-x64-static",
43+
"displayName": "Build (Static Debug)",
44+
"description": "Build with static zlib/libcurl (Debug)",
45+
"configuration": "Debug"
46+
},
47+
{
48+
"name": "release-static",
49+
"configurePreset": "vs2026-x64-static",
50+
"displayName": "Build (Static Release)",
51+
"description": "Build with static zlib/libcurl (Release)",
52+
"configuration": "Release"
53+
}
54+
]
55+
}

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
# get-livecaptions-cpp
2-
Get real time content of Windows System APP "Live Captions" [win+ctrl+L], write content into file. using c++/winrt, asio
2+
Get real time content of Windows System APP "Live Captions" [win+ctrl+L], write content into file. using c++/winrt, asio.
3+
And translate into English using local translate server: [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate)
34

45
check slibing project [get-livecaptions-rs](https://github.com/corbamico/get-livecaptions-rs)
56

67
## Usage
78

89
```cmd
10+
Usage: get-livecaptions [--help] [--version] [--translate <lang>] [--translate-host HOST] --output <file>
11+
12+
Write the content of LiveCaptions Windows System Program into file, continually.
13+
Translate captions if --translate is specified, using libretranslate(gh:LibreTranslate/LibreTranslate).
14+
915
Optional arguments:
10-
-h, --help shows help message and exits
11-
-v, --version prints version information and exits
12-
-o, --output file filename, write content into file. use - for console. [required]
16+
-h, --help shows help message and exits
17+
-v, --version prints version information and exits
18+
-t, --translate <lang> translation from language, values as es,fr,de,it.
19+
--translate-host HOST libretranslate server running at HOST, default as (http://127.0.0.1:5000).
20+
-o, --output <file> filename, write content into file. use - for console. [required]
1321
```
1422

1523
## UIAutomation

0 commit comments

Comments
 (0)