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:
13
tools/env.bat
Normal file
13
tools/env.bat
Normal file
@@ -0,0 +1,13 @@
|
||||
@echo off
|
||||
:: ============================================================
|
||||
:: env.bat — 将 tools\ 内工具加入 PATH
|
||||
:: ============================================================
|
||||
|
||||
set "TOOLS=%~dp0"
|
||||
|
||||
if exist "%TOOLS%cmake\bin" set "PATH=%TOOLS%cmake\bin;%PATH%"
|
||||
if exist "%TOOLS%ninja" set "PATH=%TOOLS%ninja;%PATH%"
|
||||
if exist "%TOOLS%llvm\bin" set "PATH=%TOOLS%llvm\bin;%PATH%"
|
||||
if exist "%TOOLS%conan2" set "PATH=%TOOLS%conan2;%PATH%"
|
||||
|
||||
echo [dstalk] tools\ 工具链已加载
|
||||
140
tools/setup.bat
Normal file
140
tools/setup.bat
Normal file
@@ -0,0 +1,140 @@
|
||||
@echo off
|
||||
chcp 65001 >nul
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set "TOOLS=%~dp0"
|
||||
|
||||
echo ============================================
|
||||
echo dstalk 工具链 — 便携安装
|
||||
echo 目标: %TOOLS%
|
||||
echo ============================================
|
||||
echo.
|
||||
|
||||
:: ============================================================
|
||||
:: 0. 检测 Visual Studio Build Tools (MSVC 头文件/库)
|
||||
:: 这是 Windows C++ 编译的硬依赖, 需单独安装
|
||||
:: ============================================================
|
||||
echo [0/5] 检测 MSVC (Visual Studio Build Tools) ...
|
||||
set "VS_FOUND="
|
||||
for %%v in (2022 2019 2017) do (
|
||||
for %%e in (Professional Community Enterprise BuildTools) do (
|
||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio\%%v\%%e\VC\Auxiliary\Build\vcvarsall.bat" set "VS_FOUND=%%v %%e"
|
||||
if exist "C:\Program Files\Microsoft Visual Studio\%%v\%%e\VC\Auxiliary\Build\vcvarsall.bat" set "VS_FOUND=%%v %%e"
|
||||
)
|
||||
)
|
||||
if defined VS_FOUND (
|
||||
echo [OK] 已安装: !VS_FOUND!
|
||||
) else (
|
||||
echo [WARN] 未找到 Visual Studio Build Tools
|
||||
echo 这是 C++ 编译必需的 (提供 vcruntime.h / msvcrt.lib 等)
|
||||
echo.
|
||||
echo 请下载安装: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022
|
||||
echo 安装时勾选 "使用 C++ 的桌面开发" 工作负载
|
||||
echo.
|
||||
echo 安装完成后重新运行 setup.bat
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: ============================================================
|
||||
:: 1. CMake (便携 zip, ~50MB)
|
||||
:: ============================================================
|
||||
echo [1/5] CMake ...
|
||||
if exist "%TOOLS%cmake\bin\cmake.exe" (
|
||||
echo [OK] 已存在
|
||||
) else (
|
||||
mkdir "%TOOLS%cmake" 2>nul
|
||||
set "URL=https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-windows-x86_64.zip"
|
||||
echo 下载中...
|
||||
curl -L -o "%TOOLS%cmake\cmake.zip" "!URL!" 2>nul
|
||||
if !errorlevel! neq 0 (
|
||||
set "URL=https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-windows-x86_64.zip"
|
||||
curl -L -o "%TOOLS%cmake\cmake.zip" "!URL!" 2>nul
|
||||
)
|
||||
if !errorlevel! neq 0 (
|
||||
echo [FAIL] 请手动下载: https://cmake.org/download/
|
||||
echo 选择 cmake-*-windows-x86_64.zip 解压到 %TOOLS%cmake\
|
||||
) else (
|
||||
powershell -Command "Expand-Archive -Force '%TOOLS%cmake\cmake.zip' '%TOOLS%cmake\tmp\'"
|
||||
for /d %%d in ("%TOOLS%cmake\tmp\cmake-*") do xcopy /E /Y "%%d\*" "%TOOLS%cmake\" >nul
|
||||
rmdir /s /q "%TOOLS%cmake\tmp" 2>nul
|
||||
del "%TOOLS%cmake\cmake.zip" 2>nul
|
||||
echo [OK] CMake
|
||||
)
|
||||
)
|
||||
|
||||
:: ============================================================
|
||||
:: 2. Ninja (单文件 ~300KB)
|
||||
:: ============================================================
|
||||
echo [2/5] Ninja ...
|
||||
if exist "%TOOLS%ninja\ninja.exe" (
|
||||
echo [OK] 已存在
|
||||
) else (
|
||||
mkdir "%TOOLS%ninja" 2>nul
|
||||
curl -L -o "%TOOLS%ninja\ninja.zip" "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win64.zip" 2>nul
|
||||
if !errorlevel! neq 0 (
|
||||
curl -L -o "%TOOLS%ninja\ninja.zip" "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win64.zip" 2>nul
|
||||
)
|
||||
if !errorlevel! neq 0 (
|
||||
echo [FAIL] 请手动下载: https://github.com/ninja-build/ninja/releases
|
||||
) else (
|
||||
powershell -Command "Expand-Archive -Force '%TOOLS%ninja\ninja.zip' '%TOOLS%ninja\'"
|
||||
del "%TOOLS%ninja\ninja.zip" 2>nul
|
||||
echo [OK] Ninja
|
||||
)
|
||||
)
|
||||
|
||||
:: ============================================================
|
||||
:: 3. LLVM/Clang (便携, ~1.2GB)
|
||||
:: ============================================================
|
||||
echo [3/5] LLVM/Clang ...
|
||||
if exist "%TOOLS%llvm\bin\clang.exe" (
|
||||
echo [OK] 已存在
|
||||
) else (
|
||||
mkdir "%TOOLS%llvm" 2>nul
|
||||
echo 下载中 (~1.2GB, 耐心等待)...
|
||||
curl -L -o "%TOOLS%llvm\llvm.exe" "https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.7/LLVM-19.1.7-win64.exe" 2>nul
|
||||
if !errorlevel! neq 0 (
|
||||
echo [FAIL] 请手动下载: https://github.com/llvm/llvm-project/releases
|
||||
echo 选择 LLVM-*-win64.exe, 运行后复制安装目录到 %TOOLS%llvm\
|
||||
) else (
|
||||
"%TOOLS%llvm\llvm.exe" /S /D="%TOOLS%llvm"
|
||||
del "%TOOLS%llvm\llvm.exe" 2>nul
|
||||
echo [OK] LLVM
|
||||
)
|
||||
)
|
||||
|
||||
:: ============================================================
|
||||
:: 4. Conan2 (独立安装器)
|
||||
:: ============================================================
|
||||
echo [4/5] Conan2 ...
|
||||
if exist "%TOOLS%conan2\conan.exe" (
|
||||
echo [OK] 已存在
|
||||
) else (
|
||||
mkdir "%TOOLS%conan2" 2>nul
|
||||
curl -L -o "%TOOLS%conan2\conan-installer.exe" "https://github.com/conan-io/conan/releases/latest/download/conan-2-win-64.exe" 2>nul
|
||||
if !errorlevel! neq 0 (
|
||||
echo [FAIL] 请手动下载: https://conan.org.cn/downloads
|
||||
) else (
|
||||
"%TOOLS%conan2\conan-installer.exe" /S /D="%TOOLS%conan2"
|
||||
del "%TOOLS%conan2\conan-installer.exe" 2>nul
|
||||
echo [OK] Conan2
|
||||
)
|
||||
)
|
||||
|
||||
:: ============================================================
|
||||
:: 5. 配置 Conan profile
|
||||
:: ============================================================
|
||||
echo [5/5] 配置 Conan ...
|
||||
call "%TOOLS%conan2\conan.exe" profile detect --force 2>nul
|
||||
if errorlevel 1 (
|
||||
echo [WARN] Conan profile 配置失败 (可能首次运行需手动配置)
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ============================================
|
||||
echo 完成! 所有工具已就绪
|
||||
echo ============================================
|
||||
echo.
|
||||
echo 下一步: 回到项目根目录运行 build.bat
|
||||
pause
|
||||
Reference in New Issue
Block a user