This repository has been archived by the owner on Jan 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathbuild.bat
91 lines (70 loc) · 2.1 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
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
@echo off
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT
set buildVars=
set buildType=Debug
if %OS%==32BIT set buildVars=%buildVars% -A Win32
if %OS%==64BIT set buildVars=%buildVars% -A x64
if "%1" == "help" goto notYetSupported
if "%1" == "/h" goto notYetSupported
if "%1" == "clean" goto cleanBuild
if "%1" == "nuke" goto cleanBuild
if "%1" == "rebuild" goto cleanBuild
if "%1" == "install" goto cleanBuild
if "%2" == "install" goto cleanBuild
goto checkBuild
:cleanBuild (
if exist build/ (
rd /s /q build
REM We should be able to just wildcard away here
if exist include\character\exports (rd /s /q include\character\exports)
if exist include\core\exports (rd /s /q include\core\exports)
if exist include\names\exports (rd /s /q include\names\exports)
if exist include\roll\exports (rd /s /q include\roll\exports)
)
if "%1" == "clean" goto commonExit
if "%1" == "nuke" goto commonExit
)
:checkBuild
if "%1" == "release" goto setReleaseBuild
if "%2" == "release" goto setReleaseBuild
if "%1" == "install" goto setReleaseBuild
if "%2" == "install" goto setReleaseBuild
goto startBuild
:setReleaseBuild
set buildVars=%buildVars% -DCMAKE_BUILD_TYPE=RELEASE
set buildType=Release
:startBuild
WHERE cmake
if %ERRORLEVEL% == 0 goto cmakeFound
if %ERRORLEVEL% neq 0 goto cmakeMissing
:cmakeFound
if exist build/ (
pushd build
cmake %buildVars% ..
WHERE msbuild
if %ERRORLEVEL% == 0 goto msbuildFound
if %ERRORLEVEL% neq 0 goto msbuildMissing
:msbuildFound
msbuild OpenRPG.sln /property:Configuration=%buildType%
if "%1" == "package" goto package
if "%2" == "package" goto package
goto poptag
:package
cmake --build . --target package
:poptag
popd
goto commonExit
)
mkdir build
goto cmakeFound
:cmakeMissing
echo cmake not found in PATH
exit 1
:msbuildMissing
echo msbuild not found in PATH
exit 1
:notYetSupported
echo This option is not yet supported: %1
exit 1
:commonExit
echo exiting