Initial dstalk project: core DLL + CLI + BearSSL TLS

- Core DLL: AI API client (DeepSeek/OpenAI compatible), HTTP(S) via Boost.Beast
- BearSSL vendored as TLS backend (MIT license, replacing OpenSSL)
- CLI frontend with ANSI colors, /help /model /file /save /load commands
- WinHTTP alternative HTTP client for Windows
- GPLv3 license with linking exception
- Build: CMake + Ninja + Clang, dependencies via Conan2

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 16:42:42 +08:00
parent f74ead4d73
commit c9fb924a1c
327 changed files with 80579 additions and 2 deletions

View File

@@ -0,0 +1,43 @@
# BearSSL static library (vendored, MIT license)
# All .c files compiled as a single translation unit for best optimization
add_library(bearssl STATIC)
target_include_directories(bearssl
PUBLIC inc
PRIVATE src
)
# Collect all C source files
file(GLOB_RECURSE BEARSSL_SOURCES "src/*.c")
target_sources(bearssl PRIVATE ${BEARSSL_SOURCES})
# x86_64 Windows optimizations
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
target_compile_definitions(bearssl PRIVATE
BR_64
BR_INT128
BR_LE_UNALIGNED
BR_USE_WIN32_RAND
BR_USE_WIN32_TIME
)
# AES-NI and SSE2 are auto-detected by BearSSL on x86
if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
target_compile_options(bearssl PRIVATE -maes -msse2)
endif()
elseif(UNIX)
target_compile_definitions(bearssl PRIVATE
BR_USE_URANDOM
BR_USE_UNIX_TIME
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_compile_definitions(bearssl PRIVATE BR_64 BR_INT128 BR_LE_UNALIGNED)
endif()
endif()
# Suppress warnings for vendored code
if(MSVC)
target_compile_options(bearssl PRIVATE /W0)
else()
target_compile_options(bearssl PRIVATE -w)
endif()