This repository was archived by the owner on Sep 30, 2025. It is now read-only.
forked from isledecomp/isle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSETUP.bat
More file actions
163 lines (137 loc) · 4.13 KB
/
SETUP.bat
File metadata and controls
163 lines (137 loc) · 4.13 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
:: SETUP FOR LAZY PEOPLE
@echo off
color a
cls
REM UAC stuff
:init
setlocal DisableDelayedExpansion
set cmdInvoke=1
set winSysFolder=System32
set "batchPath=%~dpnx0"
rem this works also from cmd shell, other than %~0
for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion
:checkPrivileges
whoami /groups /nh | find "S-1-16-12288" > nul
if '%errorlevel%' == '0' ( goto checkPrivileges2 ) else ( goto getPrivileges )
:checkPrivileges2
net session 1>nul 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
ECHO.
REM Very cool echo!!! Yay
ECHO ===========================================
ECHO - -
ECHO = Invoking UAC for privilege escalation =
ECHO - -
ECHO ===========================================
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
ECHO args = "ELEV " >> "%vbsGetPrivileges%"
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
ECHO Next >> "%vbsGetPrivileges%"
if '%cmdInvoke%'=='1' goto InvokeCmd
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
goto ExecElevation
:InvokeCmd
ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%"
ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%"
:ExecElevation
"%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %*
exit /B
:gotPrivileges
setlocal & cd /d %~dp0
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
REM Sets
set PATH=%cd%
REM for /F %%A in ('echo prompt $E^| cmd') do set "ESC=%%A"
set accuracyOfLego=99%
set funnyCoolThingBuildTypeIDunno=Release
set sdkName=sdk
setx CMakeDir /k "HKEY_LOCAL_MACHINE\SOFTWARE\Kitware\CMake\InstallDir" :: Makes a variable that returns the cmake install directory
cls
goto FirstStep
REM Steps
:FirstStep
echo Welcome to the setup for compiling LEGO Island!
echo ========== Details ===========
echo -
echo = Accuracy: %accuracyOfLego%
echo = Implementation: 100%
echo -
echo ==============================
pause
cls
goto BuildTypeShi
:BuildTypeShi
REM Build Type Configuration
echo Select your build type:
echo ======================
echo -
ECHO 1: Debug
ECHO 2: Release
ECHO 3: MinSizeRel
ECHO 4: RelWithDebInfo
echo -
echo ======================
set /p dumbAss=
if "%dumbAss%"=="1" goto SetDebug
if "%dumbAss%"=="2" goto SetRelease
if "%dumbAss%"=="3" goto SetMinSizeRel
if "%dumbAss%"=="4" goto SetRelWithDebInfo
REM if "%dumbAss%"=="5" goto CMakeDirTest
:SetDebug
set funnyCoolThingBuildTypeIDunno=Debug
goto doneSettingShit
:CMakeDirTest
reg query "HKCU\Environment" /v "CMakeDir" :: (works)
echo on
echo FOR TESTING PURPOSES!
echo "%CMakeDir%"
pause
goto BuildTypeShi
:SetRelease
set funnyCoolThingBuildTypeIDunno=Release
goto doneSettingShit
:SetMinSizeRel
set funnyCoolThingBuildTypeIDunno=MinSizeRel
goto doneSettingShit
:SetRelWithDebInfo
set funnyCoolThingBuildTypeIDunno=RelWithDebInfo
goto doneSettingShit
:doneSettingShit
echo Done!
pause
goto dumb
REM Compiler choice
:dumb
cls
echo Enter your compiler:
echo ====================
echo -
ECHO 1: NMake Makefiles
ECHO 2: Ninja (does not support making debug symbols)
echo -
echo ====================
set /p bullShit=
IF "%bullShit%"=="1" GOTO NMake
IF "%bullShit%"=="2" GOTO Ninja
:NMake
cls
ECHO -- NMake Makefiles --
REM reg query "HKCU\Environment" /v "CMakeDir" :: (works)
cmake %cd% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=%funnyCoolThingBuildTypeIDunno%
goto End
:Ninja
echo [WARNING] Only release binaries are supported!
ECHO -- Ninja --
REM reg query "HKCU\Environment" /v "CMakeDir" :: (works)
cmake %cd% -G "Ninja" -DCMAKE_BUILD_TYPE=Release
goto End
:End
echo Done!
echo To compile, change directory to build in THIS (%cd%) folder!
echo And run either "nmake" or "ninja" (If you desire to compile in Ninja, make sure you installed it!)
pause