-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstallerWindows.bat
More file actions
182 lines (143 loc) · 4.79 KB
/
Copy pathinstallerWindows.bat
File metadata and controls
182 lines (143 loc) · 4.79 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
@echo off
setlocal EnableDelayedExpansion
title Pacman C++ - Build si Rulare
echo ============================================================
echo Pacman C++ / Raylib - Script Automat de Build (Windows)
echo ============================================================
echo.
where cmake >nul 2>&1
if %ERRORLEVEL% EQU 0 (
echo [OK] CMake gasit in PATH.
cmake --version | findstr /i "cmake version"
goto :check_msys2
)
set CMAKE_DIR=%~dp0cmake_portable
set CMAKE_EXE=%CMAKE_DIR%\cmake-3.29.3-windows-x86_64\bin\cmake.exe
if exist "%CMAKE_EXE%" (
echo [OK] CMake portabil gasit.
goto :add_cmake_to_path
)
echo [INFO] CMake nu a fost gasit. Se descarca CMake 3.29.3...
if not exist "%CMAKE_DIR%" mkdir "%CMAKE_DIR%"
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"Invoke-WebRequest -Uri 'https://github.com/Kitware/CMake/releases/download/v3.29.3/cmake-3.29.3-windows-x86_64.zip' -OutFile '%CMAKE_DIR%\cmake.zip' -UseBasicParsing"
if %ERRORLEVEL% NEQ 0 (
echo [EROARE] Descarcarea CMake a esuat.
pause
exit /b 1
)
echo [INFO] Se extrage CMake...
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"Expand-Archive -Path '%CMAKE_DIR%\cmake.zip' -DestinationPath '%CMAKE_DIR%' -Force"
if not exist "%CMAKE_EXE%" (
echo [EROARE] Extractia CMake a esuat.
pause
exit /b 1
)
echo [OK] CMake descarcat si extras cu succes.
:add_cmake_to_path
set PATH=%CMAKE_DIR%\cmake-3.29.3-windows-x86_64\bin;%PATH%
echo [OK] CMake adaugat in PATH pentru aceasta sesiune.
:check_msys2
echo.
where g++ >nul 2>&1
if %ERRORLEVEL% EQU 0 (
echo [OK] G++ gasit in PATH.
g++ --version | findstr /i "g++"
goto :configure
)
if exist "C:\msys64\mingw64\bin\g++.exe" (
echo [OK] MSYS2 + GCC deja instalate la C:\msys64
goto :add_msys2_to_path
)
if exist "C:\msys64\usr\bin\bash.exe" (
echo [OK] MSYS2 gasit, se instaleaza GCC...
goto :install_gcc
)
echo [INFO] MSYS2 nu a fost gasit. Se descarca installerul...
echo [INFO] Dimensiune aproximativa: ~120 MB.
echo.
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"Invoke-WebRequest -Uri 'https://github.com/msys2/msys2-installer/releases/download/2025-12-13/msys2-x86_64-20251213.exe' -OutFile '%TEMP%\msys2-installer.exe' -UseBasicParsing"
if %ERRORLEVEL% NEQ 0 (
echo [EROARE] Descarcarea MSYS2 a esuat. Verifica conexiunea la internet.
pause
exit /b 1
)
echo [INFO] Se instaleaza MSYS2 in C:\msys64 (silentios^)...
"%TEMP%\msys2-installer.exe" in --confirm-command --accept-messages --root C:\msys64
if not exist "C:\msys64\usr\bin\bash.exe" (
echo [EROARE] Instalarea MSYS2 a esuat.
pause
exit /b 1
)
echo [OK] MSYS2 instalat cu succes.
:install_gcc
echo.
echo [INFO] Se instaleaza mingw-w64-x86_64-gcc prin pacman...
echo [INFO] Poate dura 1-3 minute in functie de conexiune.
echo.
C:\msys64\usr\bin\bash.exe -lc "pacman -Sy --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-make 2>&1"
if not exist "C:\msys64\mingw64\bin\g++.exe" (
echo [EROARE] Instalarea GCC a esuat.
pause
exit /b 1
)
echo [OK] GCC instalat cu succes.
:add_msys2_to_path
set PATH=C:\msys64\mingw64\bin;%PATH%
echo [OK] MinGW (MSYS2^) adaugat in PATH pentru aceasta sesiune.
:configure
echo.
echo [INFO] Se configureaza proiectul cu CMake...
echo.
set BUILD_DIR=%~dp0build
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
cmake -S "%~dp0." -B "%BUILD_DIR%" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TLS_VERIFY=0 -DCMAKE_POLICY_VERSION_MINIMUM=3.5
if %ERRORLEVEL% NEQ 0 (
echo.
echo [EROARE] Configurarea CMake a esuat.
echo Verifica mesajele de mai sus pentru detalii.
pause
exit /b 1
)
echo.
echo [OK] Configurare reusita.
echo.
echo [INFO] Se compileaza proiectul...
echo.
cmake --build "%BUILD_DIR%" --config Release
if %ERRORLEVEL% NEQ 0 (
echo.
echo [EROARE] Compilarea a esuat.
echo Verifica mesajele de eroare de mai sus.
pause
exit /b 1
)
echo.
echo [OK] Compilare reusita.
set EXE=%BUILD_DIR%\Pacman.exe
if not exist "%EXE%" (
echo [EROARE] Executabilul nu a fost gasit la: %EXE%
pause
exit /b 1
)
echo.
echo [INFO] Se creeaza shortcut...
set SHORTCUT=%~dp0Pacman.lnk
set ICO=%~dp0resources\images\player\pacman_r.ico
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut('%SHORTCUT%'); $s.TargetPath = '%EXE%'; $s.WorkingDirectory = '%BUILD_DIR%'; $s.IconLocation = '%ICO%'; $s.Description = 'Pacman C++ Raylib'; $s.Save()"
if exist "%SHORTCUT%" (
echo [OK] Shortcut creat: Pacman.lnk
) else (
echo [AVERTISMENT] Shortcut-ul nu a putut fi creat.
)
echo.
echo ============================================================
echo Pornire joc: Pacman.exe
echo ============================================================
echo.
cd /d "%BUILD_DIR%"
start "" "%EXE%"
endlocal