-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBuild.bat
61 lines (48 loc) · 1.4 KB
/
Build.bat
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
@echo off
:: Only execute in main folder
setlocal enabledelayedexpansion
set "current_dir=%cd%"
for %%A in ("%current_dir%") do set "last_part=%%~nxA"
if /i "!last_part!"=="build" (
cd ..
)
set "main_dir=%cd%"
cls
:: Defaults
set "src_dir=src/world/*.cpp"
set "debug_mode=false"
set "release_mode=false"
:: Parse arguments
for %%a in (%*) do (
if /i "%%a"=="-d" set "debug_mode=true"
if /i "%%a"=="--debug" set "debug_mode=true"
if /i "%%a"=="--dev" set "debug_mode=true"
if /i "%%a"=="-r" set "release_mode=true"
if /i "%%a"=="--release" set "release_mode=true"
if /i "%%a"=="world" set "src_dir=src/world/*.cpp"
if /i "%%a"=="level" set "src_dir=src/level/*.cpp"
)
:: Compile Command
set "compile_cmd=g++ build/resource.o src/glad.c src/*.cpp !src_dir! src/font/*.cpp src/math/*.cpp src/popup/*.cpp --std=c++17 -I"include/" -L"lib/GLFW/" -o FloodForge.exe -lglfw3 -lgdi32 -lopengl32 -luser32 -lcomdlg32 -lole32"
if "%debug_mode%"=="false" (
set "compile_cmd=!compile_cmd! -mwindows"
)
if "%release_mode%"=="true" (
set "compile_cmd=!compile_cmd! -static"
)
:: Compile
!compile_cmd!
:: Execute
if "%release_mode%"=="false" (
if %errorlevel%==0 (
FloodForge.exe
) else (
echo Compilation failed.
)
)
:: Zip
if "%release_mode%"=="true" (
"C:\Program Files\7-Zip\7z.exe" a "FloodForge.zip" "FloodForge.exe" "assets\*" "README.md" "LICENSE" -r
)
:: Return
cd %current_dir%