secondvoice/CMakePresets.json
StillHammer 94ad6b4a22 feat: Add MinGW support - Build without Visual Studio!
Lightweight Windows build option using MinGW-w64 instead of Visual Studio:

Size Comparison:
- Visual Studio: 10-20 GB install
- MinGW: ~500 MB install (20x smaller!)

New Files:
- setup_mingw.bat: One-click installer for all tools
  - Chocolatey (package manager)
  - MinGW-w64 (GCC compiler)
  - CMake, Ninja, Git
  - vcpkg integration

- build_mingw.bat: Build script for MinGW
  - Auto-detection of GCC
  - Debug/Release modes
  - Clean build support
  - User-friendly error messages

- WINDOWS_MINGW.md: Complete MinGW guide
  - Installation instructions
  - Troubleshooting
  - Performance comparison MSVC vs GCC
  - Distribution guide

CMake Updates:
- Added mingw-debug and mingw-release presets
- GCC compiler flags: -O3 -Wall -Wextra
- Static linking for portable .exe

Documentation:
- Updated WINDOWS_QUICK_START.md with MinGW option
- Comparison table: MinGW vs Visual Studio
- Recommendation: MinGW for most users

Benefits:
- 20x smaller download (500MB vs 10-20GB)
- 5-10 min install vs 30-60 min
- Same performance as MSVC
- Portable standalone .exe
- Perfect for users without Visual Studio

Usage:
1. Run setup_mingw.bat (one time)
2. Restart terminal
3. Run build_mingw.bat --release
4. Done!

Output: build/mingw-release/SecondVoice.exe

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 03:42:41 +08:00

118 lines
2.9 KiB
JSON

{
"version": 3,
"configurePresets": [
{
"name": "windows-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "windows-debug",
"displayName": "Windows x64 Debug",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS": "/W4"
}
},
{
"name": "windows-release",
"displayName": "Windows x64 Release",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS": "/O2 /W4"
}
},
{
"name": "linux-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "linux-debug",
"displayName": "Linux x64 Debug",
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS": "-Wall -Wextra"
}
},
{
"name": "linux-release",
"displayName": "Linux x64 Release",
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS": "-O3 -Wall -Wextra"
}
},
{
"name": "mingw-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++"
}
},
{
"name": "mingw-debug",
"displayName": "MinGW x64 Debug",
"inherits": "mingw-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -g"
}
},
{
"name": "mingw-release",
"displayName": "MinGW x64 Release",
"inherits": "mingw-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS": "-O3 -Wall -Wextra"
}
}
],
"buildPresets": [
{
"name": "windows-debug",
"configurePreset": "windows-debug"
},
{
"name": "windows-release",
"configurePreset": "windows-release"
},
{
"name": "linux-debug",
"configurePreset": "linux-debug"
},
{
"name": "linux-release",
"configurePreset": "linux-release"
},
{
"name": "mingw-debug",
"configurePreset": "mingw-debug"
},
{
"name": "mingw-release",
"configurePreset": "mingw-release"
}
]
}