diff --git a/.gitignore b/.gitignore index 51a8ad0..74572e7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ node_modules/ *.tsbuildinfo .npm-cache +# C++ 编译中间产物(目标文件,clone 后无用) +*.obj + # Generated Vite config output (source is vite.config.ts) vite.config.js vite.config.d.ts diff --git a/connector/native/connector_service.cpp b/connector/native/connector_service.cpp index 32828a3..d5ffc1f 100644 --- a/connector/native/connector_service.cpp +++ b/connector/native/connector_service.cpp @@ -81,8 +81,20 @@ std::string form_value(const std::string& body, const std::string& key) { } std::string sanitize_process_error(std::string output) { - output = std::regex_replace(output, std::regex(R"(^Licensed to:.*$)", std::regex::icase | std::regex::multiline), "Spine 授权信息已隐藏"); - return trim(output); + // 逐行替换,避免依赖 std::regex::multiline(MSVC 的 未实现该标志)。 + const std::regex licensed(R"(^Licensed to:.*$)", std::regex::icase); + std::string result; + std::size_t start = 0; + while (start <= output.size()) { + const auto end = output.find('\n', start); + std::string line = output.substr(start, end - start); + if (!line.empty() && line.back() == '\r') line.pop_back(); + result += std::regex_replace(line, licensed, "Spine 授权信息已隐藏"); + if (end == std::string::npos) break; + result += '\n'; + start = end + 1; + } + return trim(result); } std::pair, std::string> convert(const Json& payload, const std::string& executable) { diff --git a/release/connector/windows-x64/SpineParticleConnector.exe b/release/connector/windows-x64/SpineParticleConnector.exe index b7a964e..ca5bf70 100644 Binary files a/release/connector/windows-x64/SpineParticleConnector.exe and b/release/connector/windows-x64/SpineParticleConnector.exe differ diff --git a/scripts/build-connector-windows-msvc.bat b/scripts/build-connector-windows-msvc.bat new file mode 100644 index 0000000..c76a6ca --- /dev/null +++ b/scripts/build-connector-windows-msvc.bat @@ -0,0 +1,31 @@ +@echo off +setlocal +rem 使用 MSVC 编译 Windows 原生连接器(单 exe,体积优化) +call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" >nul +if errorlevel 1 ( + echo 未能初始化 MSVC 环境,请确认已安装 VS 2022 Build Tools 及 C++ 工具集。 + exit /b 1 +) + +set "SRC_DIR=%~dp0..\connector\native" +set "OUT_DIR=%~dp0..\release\connector\windows-x64" +if not exist "%OUT_DIR%" mkdir "%OUT_DIR%" + +pushd "%SRC_DIR%" +cl /nologo /std:c++17 /utf-8 /O1 /GL /EHsc /MT /W3 /D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0601 ^ + app_windows.cpp config.cpp connector_service.cpp encoding.cpp http_server.cpp json.cpp platform_common.cpp process_windows.cpp workspace.cpp zip.cpp ^ + /link /SUBSYSTEM:WINDOWS /LTCG /OPT:REF /OPT:ICF ^ + user32.lib gdi32.lib comdlg32.lib ws2_32.lib shell32.lib ole32.lib ^ + /OUT:"%OUT_DIR%\SpineParticleConnector.exe" +del /q "%SRC_DIR%\*.obj" >nul 2>&1 +set "RC=%ERRORLEVEL%" +popd + +if "%RC%"=="0" ( + echo. + echo 构建成功:%OUT_DIR%\SpineParticleConnector.exe +) else ( + echo. + echo 构建失败,错误码 %RC% +) +exit /b %RC%