mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Generate dependency versions header from CMake (#22561)
## Summary This PR introduces a CMake-generated header file containing all dependency versions, eliminating the need for C++ code to depend on Zig-exported version constants. ## Changes - **New CMake script**: `cmake/tools/GenerateDependencyVersions.cmake` that: - Reads versions from the existing `generated_versions_list.zig` file - Extracts semantic versions from header files where available (libdeflate, zlib) - Generates `bun_dependency_versions.h` with all dependency versions as compile-time constants - **Updated BunProcess.cpp**: - Now includes the CMake-generated `bun_dependency_versions.h` - Uses `BUN_VERSION_*` constants instead of `Bun__versions_*` - Removes dependency on Zig-exported version constants - **Build system updates**: - Added `GenerateDependencyVersions` to main CMakeLists.txt - Added build directory to include paths in BuildBun.cmake ## Benefits ✅ Single source of truth for dependency versions ✅ Versions accessible from C++ without Zig exports ✅ Automatic regeneration during CMake configuration ✅ Semantic versions shown where available (e.g., zlib 1.2.8 instead of commit hash) ✅ Debug output file for verification ## Test Results Verified that `process.versions` correctly shows all dependency versions: ```javascript $ bun -e "console.log(JSON.stringify(process.versions, null, 2))" { "node": "24.3.0", "bun": "1.2.22-debug", "boringssl": "29a2cd359458c9384694b75456026e4b57e3e567", "libarchive": "898dc8319355b7e985f68a9819f182aaed61b53a", "mimalloc": "4c283af60cdae205df5a872530c77e2a6a307d43", "webkit": "0ddf6f47af0a9782a354f61e06d7f83d097d9f84", "zlib": "1.2.8", "libdeflate": "1.24", // ... all versions present and correct } ``` ## Generated Files - `build/debug/bun_dependency_versions.h` - Header file with version constants - `build/debug/bun_dependency_versions_debug.txt` - Human-readable version list 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1126,6 +1126,9 @@ endif()
|
||||
|
||||
include_directories(${WEBKIT_INCLUDE_PATH})
|
||||
|
||||
# Include the generated dependency versions header
|
||||
include_directories(${CMAKE_BINARY_DIR})
|
||||
|
||||
if(NOT WEBKIT_LOCAL AND NOT APPLE)
|
||||
include_directories(${WEBKIT_INCLUDE_PATH}/wtf/unicode)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user