-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_mingw.bat
More file actions
118 lines (96 loc) · 3.67 KB
/
build_mingw.bat
File metadata and controls
118 lines (96 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
@echo off
setlocal
:: ============================================================================
:: Clean and Build Script for MinGW (GMake2)
::
:: - This script runs Premake5 to generate up-to-date Makefiles.
:: - It then CLEANS and BUILDS the project using 'mingw32-make'.
:: - The "Download progress..." indicator appears if Premake5 needs to
:: download any libraries (like raylib, imgui, etc.).
:: ============================================================================
:: ============================================================================
:: CONFIGURATION
:: - Change the values below to customize your build.
:: - These correspond to the options in premake5.lua.
:: ============================================================================
:: --graphics: The version of OpenGL to use.
:: - opengl33 (Default), opengl43, opengl21, opengl11, openges2, openges3
set "GRAPHICS_OPTION=opengl33"
:: --with-raygui: How to handle the raygui library.
:: - download (Default), local, none
set "RAYGUI_OPTION=download"
:: --with-rlimgui: How to handle the rlImGui & ImGui libraries.
:: - download (Default), local, none
set "RLIMGUI_OPTION=download"
:: ============================================================================
:: SCRIPT EXECUTION
:: (No changes needed below this line)
:: ============================================================================
:: Use %~dp0 to get the directory of this batch file
set "PROJECT_ROOT=%~dp0"
set "BUILD_DIR=%PROJECT_ROOT%build"
:: --- Step 1: Generate Makefiles ---
echo ============================================================================
echo GENERATING Makefiles for MinGW...
echo ============================================================================
echo With options:
echo --graphics=%GRAPHICS_OPTION%
echo --with-raygui=%RAYGUI_OPTION%
echo --with-rlimgui=%RLIMGUI_OPTION%
echo.
:: Check if premake5.exe exists
if not exist "%BUILD_DIR%\premake5.exe" (
echo ERROR: premake5.exe not found in '%BUILD_DIR%'
echo Please ensure premake5.exe is placed in the 'build' directory.
goto :error
)
:: Navigate to the build directory to run premake
pushd "%BUILD_DIR%"
premake5.exe --graphics=%GRAPHICS_OPTION% --with-raygui=%RAYGUI_OPTION% --with-rlimgui=%RLIMGUI_OPTION% gmake2
if %errorlevel% neq 0 (
echo.
echo ERROR: Premake failed to generate project files.
popd
goto :error
)
popd
echo Makefiles generated successfully.
echo.
:: --- Step 2: Clean previous build ---
echo ============================================================================
echo CLEANING previous build...
echo ============================================================================
echo.
mingw32-make SHELL=CMD clean
if %errorlevel% neq 0 (
echo.
echo WARNING: The 'clean' step failed or produced an error. Continuing anyway.
echo.
)
:: --- Step 3: Build the project ---
echo ============================================================================
echo BUILDING the project...
echo ============================================================================
echo.
mingw32-make SHELL=CMD
if %errorlevel% neq 0 (
echo.
echo ERROR: The build failed. Check the output above for errors.
goto :error
)
echo.
echo ============================================================================
echo Success!
echo The project has been successfully cleaned and rebuilt.
echo ============================================================================
echo.
pause
exit /b 0
:error
echo.
echo ============================================================================
echo Script failed.
echo ============================================================================
echo.
pause
exit /b 1