Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 7, 2025

现有发布包针对 VS2017-VS2026 分别提供独立静态库,导致包体积过大(lib/ 目录 86MB)。利用 MSVC ABI 兼容性(VS2015+ 共享 Universal CRT),统一使用同一套 MSVC 编译的静态库支持所有现代 Visual Studio 版本。

Changes

Build system

  • CMakeLists.txt: Consolidated MSVC version logic—all MSVC_VERSION >= 1910 now use msvc/{x64,x86} libraries
  • Removed version-specific branches for VS2017/2022/2026

Distribution

  • update-libs.sh: Sync only msvc libraries, removed vs2017/2022/2026 from mapping arrays
  • Deleted 12 obsolete library files (3 directories): lib/vs2017, lib/vs2022, lib/vs2026
  • Renamed lib/vs2019 to lib/msvc for better clarity

Documentation

  • README.md, doc/Release-25.11.md: Added MSVC consolidation notes
  • doc/MSVC-Library-Consolidation.md: Technical documentation on ABI compatibility rationale
  • Updated all references from vs2019 to msvc throughout documentation

Impact

  • Package size: 86MB → 34MB (60% reduction in lib/)
  • Compatibility: VS2017-VS2026 全支持,完全向后兼容
  • User code: Zero changes required—CMake auto-selects correct libraries, headers auto-link via #pragma comment
  • Clearer naming: msvc directory name better indicates cross-version compatibility

Technical Details

Why unified msvc directory: Using generic msvc naming instead of version-specific vs2019 better expresses cross-version compatibility and avoids confusion about which VS version the libraries target

Debug/Release separation maintained: graphicsd.lib vs graphics.lib still separate due to _ITERATOR_DEBUG_LEVEL and STL layout incompatibility between build types

# Before: 4 separate version checks
if(MSVC_VERSION GREATER_EQUAL 1950)      # vs2026
    set(osLibDir "vs2026/x64")
elseif(MSVC_VERSION GREATER_EQUAL 1930)  # vs2022
    set(osLibDir "vs2022/x64")
# ... 2 more branches

# After: Single consolidated check
if(MSVC_VERSION GREATER_EQUAL 1910)
    # vs2017-vs2026 统一使用 msvc 静态库
    set(osLibDir "msvc/x64")
endif()
Original prompt

这是一个图形库项目。 对外发布的时候, 主要发布的是静态库。
首先是问题描述以及分析:
目前在 msvc 上发布的时候, 针对 vs2017vs2026 全部都单独发布了版本。 这导致发布的包特别大, 因为不同的 IDE 本身对应不同版本, 再加上 MSVC 上 Debug 和 Release 都得单独提供。
我希望优化这个行为, 减少包体积。
请仔细帮我分析本项目, 是否可以只使用 msvc 的某一个版本来发布, 比如对于 vs2017
2026, 全部都使用 vs2017 编译出来的静态库。 或者反过来, 全都使用 vs2026 编译出来的静态库。这样是否合理, 以及这样是否推荐? 你是否有更好的办法或者你推荐的做法是什么?

接下来是操作:
请基于你认为最合理的方案, 执行改进。
改进的时候, 要注意修改所有受关联的部分, 包含 README 等文档、 执行更新的脚本等等。


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link

coderabbitai bot commented Dec 7, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits December 7, 2025 08:46
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize release package size for static libraries Consolidate MSVC libraries to VS2019 for 60% package size reduction Dec 7, 2025
Copilot AI requested a review from wysaid December 7, 2025 08:52
@wysaid
Copy link
Collaborator

wysaid commented Dec 7, 2025

@copilot 我看到了你的改动, 但我认为还应该继续改进。
既然 msvc 已经公用一个静态库目录, 那么这个目录没必要保持 vs2019 这样的字样, 直接使用 msvc 岂不是更好?
另外再仔细审查一下所有关联的脚本以及文档, 都改进一下

Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 7, 2025

@copilot 我看到了你的改动, 但我认为还应该继续改进。
既然 msvc 已经公用一个静态库目录, 那么这个目录没必要保持 vs2019 这样的字样, 直接使用 msv...

已完成改进!已将 lib/vs2019 目录重命名为 lib/msvc,并更新了所有相关的脚本和文档:

改进内容:

  • ✅ 目录重命名:lib/vs2019lib/msvc
  • ✅ CMakeLists.txt:更新库路径为 msvc/x64msvc/x86
  • ✅ update-libs.sh:更新同步配置
  • ✅ README.md 和 doc/Release-25.11.md:更新说明文档
  • ✅ doc/MSVC-Library-Consolidation.md:更新技术文档

优势:
msvc 命名更清晰地表达了"适用于所有 MSVC 版本"的含义,避免了 vs2019 可能带来的版本特定性误解。

相关提交:2a8c1cf

Copilot AI changed the title Consolidate MSVC libraries to VS2019 for 60% package size reduction Consolidate MSVC libraries to unified msvc directory for 60% package size reduction Dec 7, 2025
@wysaid wysaid marked this pull request as ready for review December 14, 2025 11:00
Copilot AI review requested due to automatic review settings December 14, 2025 11:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates MSVC static libraries from version-specific directories (vs2017, vs2019, vs2022, vs2026) into a unified msvc directory, leveraging ABI compatibility across Visual Studio 2015+ versions that share the Universal CRT. This optimization reduces the distribution package size by approximately 60% (from 86MB to 34MB in the lib/ directory).

Key changes include:

  • Simplified CMakeLists.txt logic to use a single msvc/{x64,x86} path for all MSVC versions ≥ VS2017
  • Updated build scripts to sync only the unified msvc libraries
  • Comprehensive documentation of the technical rationale for ABI compatibility and the consolidation approach

Reviewed changes

Copilot reviewed 6 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CMakeLists.txt Consolidated MSVC version checks from 4 separate branches into a single MSVC_VERSION >= 1910 check that uses msvc/{x64,x86} libraries
update-libs.sh Removed vs2017/2022/2026 from copy mapping arrays, now only syncs unified msvc directory
lib/vs2017/, lib/vs2022/, lib/vs2026/* Deleted 12 obsolete library files (4 per version, x86/x64 Debug/Release)
doc/MSVC-Library-Consolidation.md New technical documentation explaining ABI compatibility rationale and implementation details
doc/Release-25.11.md Added release notes about MSVC library consolidation and package size reduction
README.md Updated changelog to mention MSVC library consolidation strategy

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


## 更新日志

- **2025.11**: 首次实施 MSVC 库整合策略,减少发布包体积约 52MB
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version number should be "25.11" not "2025.11" to match the version format used elsewhere in the document (see line 5 which refers to "EGE 25.11 版本").

Suggested change
- **2025.11**: 首次实施 MSVC 库整合策略,减少发布包体积约 52MB
- **25.11**: 首次实施 MSVC 库整合策略,减少发布包体积约 52MB

Copilot uses AI. Check for mistakes.
@wysaid
Copy link
Collaborator

wysaid commented Jan 13, 2026

@Auggie review

@augmentcode
Copy link

augmentcode bot commented Jan 13, 2026

🤖 Augment PR Summary

Summary: This PR reduces the Windows/MSVC SDK footprint by consolidating multiple Visual Studio version-specific static library folders into a single shared lib/msvc layout.

Changes:

  • Simplified CMakeLists.txt MSVC selection logic so VS2017+ resolves to lib/msvc/{x64,x86} instead of versioned directories.
  • Renamed lib/vs2019 to lib/msvc and removed obsolete lib/vs2017, lib/vs2022, lib/vs2026 binaries.
  • Updated update-libs.sh to sync only the unified MSVC directory.
  • Documented the ABI-compatibility rationale and updated release notes/README to reflect the new distribution strategy.

Technical Notes: Debug/Release libraries remain separate (graphics.lib vs graphicsd.lib) due to STL/debug iterator layout differences; the approach relies on MSVC ABI compatibility across VS2015+ (UCRT) for VS2017–VS2026 consumers.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

if(MSVC)
# 设置 MSVC 编译选项, 当版本大于 vs2019 时, 使用 c++17 标准.
# 设置 MSVC 编译选项, 使用 c++17 标准.
set(CPP_COMPILE_OPTIONS "/std:c++17")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSVC_VERSION >= 1910 now always uses /std:c++17, but /std:c++17 is only available starting with VS2017 15.3 (MSVC_VERSION 1911); on VS2017 RTW (1910) this will likely fail to configure/build, so “VS2017 supported” may need a minimum update level called out.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

### VS2015 及更早版本

VS2015 及更早版本仍然使用独立的库文件:
- VS2015: `lib/vs2015/`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section says VS2015 uses lib/vs2015/, but this SDK (and the earlier directory tree in this same doc) doesn’t show that folder; could you clarify/remove this to avoid sending users to a non-existent path?

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants