mirror of
https://github.com/LHY0125/Gobang-Game.git
synced 2026-05-10 02:19:46 +08:00
feat: v8.2版本更新 - 编译脚本优化\n\n- 🔧 交互式编译脚本:compile_gui.bat支持选择编译控制台或GUI版本\n- 📋 用户友好界面:提供清晰的编译选项菜单和操作指引\n- ⚡ 编译流程优化:统一编译参数,解决SDL3依赖问题\n- �� 多语言支持:英文界面避免编码问题,确保兼容性\n- ✅ 错误处理完善:添加无效输入处理和详细错误提示\n- 🎯 开发体验提升:简化编译流程,提高开发效率
This commit is contained in:
+99
@@ -0,0 +1,99 @@
|
||||
@echo off
|
||||
echo ===== Gobang Game Compile Script =====
|
||||
echo.
|
||||
echo Please select compile version:
|
||||
echo 1. Console version (gobang_console.exe)
|
||||
echo 2. GUI version (gobang_gui.exe)
|
||||
echo 3. Compile all versions
|
||||
echo 0. Exit
|
||||
echo.
|
||||
set /p choice="Please enter your choice (0-3): "
|
||||
|
||||
if "%choice%"=="0" goto :exit
|
||||
if "%choice%"=="1" goto :console
|
||||
if "%choice%"=="2" goto :gui
|
||||
if "%choice%"=="3" goto :all
|
||||
echo Invalid choice!
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:console
|
||||
echo.
|
||||
echo Compiling console version...
|
||||
echo.
|
||||
gcc -std=c17 -o gobang_console.exe *.c -ID:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include -LD:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\lib -lSDL3 -lws2_32
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
echo.
|
||||
echo Compilation successful! Generated: gobang_console.exe
|
||||
echo Run command: .\gobang_console.exe
|
||||
echo.
|
||||
) else (
|
||||
echo.
|
||||
echo Compilation failed! Please check source files and compiler installation
|
||||
echo.
|
||||
)
|
||||
goto :end
|
||||
|
||||
:gui
|
||||
echo.
|
||||
echo Compiling GUI version...
|
||||
echo.
|
||||
REM Check if SDL3 library exists
|
||||
if not exist "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include" (
|
||||
echo Error: SDL3 library not found!
|
||||
echo Please ensure SDL3 is extracted to: D:\settings\SDL\SDL3-3.2.22\
|
||||
goto :end
|
||||
)
|
||||
gcc -std=c17 -o gobang_gui.exe *.c -ID:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include -LD:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\lib -lSDL3 -lws2_32
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
echo.
|
||||
echo Compilation successful! Generated: gobang_gui.exe
|
||||
echo.
|
||||
echo Copying SDL3.dll to current directory...
|
||||
copy "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\bin\SDL3.dll" . >nul 2>&1
|
||||
echo Run command: .\gobang_gui.exe
|
||||
echo.
|
||||
) else (
|
||||
echo.
|
||||
echo Compilation failed! Please check:
|
||||
echo 1. SDL3 library path is correct
|
||||
echo 2. All source files exist
|
||||
echo 3. gcc compiler is installed
|
||||
echo.
|
||||
)
|
||||
goto :end
|
||||
|
||||
:all
|
||||
echo.
|
||||
echo Compiling all versions...
|
||||
echo.
|
||||
echo [1/2] Compiling console version...
|
||||
gcc -std=c17 -o gobang_console.exe *.c -ID:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include -LD:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\lib -lSDL3 -lws2_32
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
echo Console version compilation successful!
|
||||
) else (
|
||||
echo Console version compilation failed!
|
||||
)
|
||||
echo.
|
||||
echo [2/2] Compiling GUI version...
|
||||
if not exist "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include" (
|
||||
echo Error: SDL3 library not found! Skipping GUI version compilation
|
||||
goto :end
|
||||
)
|
||||
gcc -std=c17 -o gobang_gui.exe *.c -ID:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include -LD:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\lib -lSDL3 -lws2_32
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
echo GUI version compilation successful!
|
||||
copy "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\bin\SDL3.dll" . >nul 2>&1
|
||||
) else (
|
||||
echo GUI version compilation failed!
|
||||
)
|
||||
echo.
|
||||
echo Compilation complete! Generated files:
|
||||
dir *.exe 2>nul
|
||||
echo.
|
||||
goto :end
|
||||
|
||||
:end
|
||||
pause
|
||||
|
||||
:exit
|
||||
Reference in New Issue
Block a user