-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.bat
More file actions
57 lines (51 loc) · 1.37 KB
/
build.bat
File metadata and controls
57 lines (51 loc) · 1.37 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
@echo off
:: ===============================
:: build.bat - Build executable and run
:: Author: DragonTaki
:: ===============================
cd /d %~dp0
:: Set up VS compilation environment
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
:: Create "build" and "obj" folders
if not exist build mkdir build
if not exist build\obj mkdir build\obj
:: Clean up old .obj files
del /q build\obj\*.obj 2>nul
:: Recursively compile all .cpp files in the src folder
for /R src %%F in (*.cpp) do (
echo Compiling %%F
rem Convert backslashes in the src relative path to underscores to avoid conflicts between obj files with the same name in subfolders
set "relPath=%%~pF"
setlocal enabledelayedexpansion
set "relPath=!relPath:\=_!"
cl ^
/std:c++latest ^
/Zc:__cplusplus ^
/EHsc ^
/Od ^
/Zi ^
/utf-8 ^
/I"." ^
/I"src" ^
/I"external\fmtlib\fmt_12.0.0" ^
/c %%F ^
/Fo"build\obj\!relPath!%%~nF.obj" ^
/Fd"build\main.pdb"
endlocal
)
:: Compile fmt.cpp
echo Compiling external\fmtlib\fmt_12.0.0\src\fmt.cpp
cl ^
/std:c++latest ^
/Zc:__cplusplus ^
/EHsc ^
/Od ^
/Zi ^
/utf-8 ^
/I"." ^
/I"external\fmtlib\fmt_12.0.0" ^
/c external\fmtlib\fmt_12.0.0\src\fmt.cpp ^
/Fo"build\obj\fmt.obj" ^
/Fd"build\main.pdb"
:: Link
link /DEBUG /PDB:"build\main.pdb" /OUT:"build\main.exe" build\obj\*.obj