Implement automatic versioning logic for the stable-diffusion.cpp-rest project using git information.
Requirements
Git-based Version Detection:
Use git tag if available (prefer annotated tags)
Fall back to git commit hash for development builds
Handle detached HEAD state and tagless repositories
CMake Integration:
Update CMakeLists.txt to set version variables automatically
Make version available to both C++ backend and web frontend
Support semantic versioning format (vX.Y.Z or X.Y.Z)
Version Display:
Expose version through API endpoint (e.g., /api/version)
Display version in web UI
Include version in server startup logs
Build Information:
Include build timestamp
Include build type (Release/Debug)
Include commit hash (even when using tag)
Implementation Plan
Create version detection script or CMake function
Update main CMakeLists.txt to set version variables
Add version.h header file for C++ backend
Add /api/version endpoint to server.cpp
Update web UI to display version information
Add version to server startup logging
Expected Outcome
Consistent versioning across all components
Easy identification of build commits
Professional version display in UI and API
Support for both release (tagged) and development builds
## Issue Description
Implement automatic versioning logic for the stable-diffusion.cpp-rest project using git information.
## Requirements
1. **Git-based Version Detection**:
- Use git tag if available (prefer annotated tags)
- Fall back to git commit hash for development builds
- Handle detached HEAD state and tagless repositories
2. **CMake Integration**:
- Update CMakeLists.txt to set version variables automatically
- Make version available to both C++ backend and web frontend
- Support semantic versioning format (vX.Y.Z or X.Y.Z)
3. **Version Display**:
- Expose version through API endpoint (e.g., /api/version)
- Display version in web UI
- Include version in server startup logs
4. **Build Information**:
- Include build timestamp
- Include build type (Release/Debug)
- Include commit hash (even when using tag)
## Implementation Plan
- Create version detection script or CMake function
- Update main CMakeLists.txt to set version variables
- Add version.h header file for C++ backend
- Add /api/version endpoint to server.cpp
- Update web UI to display version information
- Add version to server startup logging
## Expected Outcome
- Consistent versioning across all components
- Easy identification of build commits
- Professional version display in UI and API
- Support for both release (tagged) and development builds
Issue Description
Implement automatic versioning logic for the stable-diffusion.cpp-rest project using git information.
Requirements
Git-based Version Detection:
CMake Integration:
Version Display:
Build Information:
Implementation Plan
Expected Outcome