forked from rei-2/Amalgam
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
229 lines (210 loc) · 6.49 KB
/
setup.bat
File metadata and controls
229 lines (210 loc) · 6.49 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
@echo off
setlocal EnableDelayedExpansion
echo ================================
echo Amalgam Development Setup
echo ================================
echo.
:: Check for Windows 10/11
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
echo Detected Windows version: %VERSION%
:: Check for Visual Studio 2022
echo.
echo [1/5] Checking Visual Studio 2022...
set VS2022_PATH=""
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" (
set VS2022_PATH="%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
echo Found: Visual Studio 2022 Enterprise
) else if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe" (
set VS2022_PATH="%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe"
echo Found: Visual Studio 2022 Professional
) else if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" (
set VS2022_PATH="%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe"
echo Found: Visual Studio 2022 Community
) else (
echo ERROR: Visual Studio 2022 not found!
echo Please install Visual Studio 2022 with C++ development tools.
echo Download from: https://visualstudio.microsoft.com/downloads/
pause
exit /b 1
)
:: Check for Git
echo.
echo [2/5] Checking Git...
git --version >nul 2>&1
if errorlevel 1 (
echo ERROR: Git not found!
echo Please install Git from: https://git-scm.com/download/win
pause
exit /b 1
) else (
echo Git is installed
)
:: Setup vcpkg
echo.
echo [3/5] Setting up vcpkg...
if not exist "vcpkg" (
echo Cloning vcpkg...
git clone https://github.com/Microsoft/vcpkg.git
if errorlevel 1 (
echo ERROR: Failed to clone vcpkg
pause
exit /b 1
)
) else (
echo vcpkg directory already exists
)
cd vcpkg
:: Bootstrap vcpkg
echo Bootstrapping vcpkg...
if not exist "vcpkg.exe" (
call bootstrap-vcpkg.bat
if errorlevel 1 (
echo ERROR: Failed to bootstrap vcpkg
pause
exit /b 1
)
) else (
echo vcpkg.exe already exists
)
:: Install dependencies
echo.
echo [4/5] Installing dependencies...
:: Clean any corrupted builds
echo Cleaning vcpkg build cache...
if exist "buildtrees" (
rmdir /s /q buildtrees
echo Build cache cleaned
)
if exist "packages\cpr_x64-windows-static" (
rmdir /s /q packages\cpr_x64-windows-static
)
if exist "packages\curl_x64-windows-static" (
rmdir /s /q packages\curl_x64-windows-static
)
if exist "packages\zlib_x64-windows-static" (
rmdir /s /q packages\zlib_x64-windows-static
)
echo Installing cpr (C++ Requests library)...
vcpkg.exe install cpr:x64-windows-static --clean-after-build
if errorlevel 1 (
echo ERROR: Failed to install cpr
echo Retrying with verbose output...
vcpkg.exe install cpr:x64-windows-static --clean-after-build --debug
if errorlevel 1 (
pause
exit /b 1
)
)
echo Installing nlohmann-json...
vcpkg.exe install nlohmann-json:x64-windows-static --clean-after-build
if errorlevel 1 (
echo ERROR: Failed to install nlohmann-json
pause
exit /b 1
)
echo Installing freetype (font rendering library)...
vcpkg.exe install freetype:x64-windows-static --clean-after-build
if errorlevel 1 (
echo ERROR: Failed to install freetype
pause
exit /b 1
)
echo Note: Dynamic versions not needed - using static linking only...
echo Integrating vcpkg with Visual Studio...
vcpkg.exe integrate install
if errorlevel 1 (
echo WARNING: Failed to integrate vcpkg with Visual Studio
echo You may need to run this as administrator
)
cd ..
:: Initialize submodules
echo.
echo [5/5] Initializing submodules...
echo Initializing AmalgamLoader and Blackbone submodules...
git submodule update --init --recursive
if errorlevel 1 (
echo ERROR: Failed to initialize submodules
pause
exit /b 1
) else (
echo Submodules initialized successfully
)
:: Restore NuGet packages
echo.
echo [6/6] Restoring NuGet packages...
where nuget >nul 2>&1
if errorlevel 1 (
echo WARNING: NuGet not found in PATH
echo Downloading NuGet...
if not exist "nuget.exe" (
powershell -Command "Invoke-WebRequest -Uri 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile 'nuget.exe'"
if errorlevel 1 (
echo ERROR: Failed to download NuGet
pause
exit /b 1
)
)
echo Restoring packages with downloaded NuGet...
nuget.exe restore Amalgam.sln
if errorlevel 1 (
echo ERROR: Failed to restore NuGet packages
echo Retrying with detailed output...
nuget.exe restore Amalgam.sln -Verbosity detailed
)
) else (
echo Restoring packages with system NuGet...
nuget restore Amalgam.sln
if errorlevel 1 (
echo ERROR: Failed to restore NuGet packages
echo Retrying with detailed output...
nuget restore Amalgam.sln -Verbosity detailed
)
)
:: Clean any existing Visual Studio build artifacts
echo.
echo Cleaning Visual Studio build artifacts...
if exist ".vs" (
rmdir /s /q .vs
echo .vs folder cleaned
)
if exist "Amalgam\x64" (
rmdir /s /q Amalgam\x64
echo Amalgam x64 build folder cleaned
)
if exist "build" (
rmdir /s /q build
echo Build folder cleaned
)
echo.
echo ================================
echo Setup Complete!
echo ================================
echo.
echo You can now:
echo 1. Open Amalgam.sln in Visual Studio 2022
echo 2. Build the project (Release/x64 recommended)
echo 3. Output will be in: output\x64\Release\
echo 4. AmalgamLoader.exe includes runtime signature randomization
echo.
echo Available build configurations:
echo - Release
echo - ReleaseAVX2
echo - ReleaseFreetype
echo - ReleaseFreetypeAVX2
echo.
echo Dependencies installed:
echo - cpr (C++ Requests) - x64-windows-static (for Amalgam DLL only)
echo - nlohmann-json - x64-windows-static (for Amalgam DLL only)
echo - freetype (font rendering) - x64-windows-static (for Amalgam DLL only)
echo - boost (via NuGet)
echo - libolm (embedded in source)
echo - AmalgamLoader (submodule - standalone executable)
echo - Blackbone (nested submodule in AmalgamLoader)
echo.
echo Build Features:
echo - Runtime signature randomization with embedded hash detection
echo - Generic naming (no identifying strings)
echo - Self-contained processing state (no external marker files)
echo - Static linking: Amalgam DLL embeds dependencies, AmalgamLoader is standalone
echo.
pause