This repository has been archived by the owner on Dec 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.bat
126 lines (109 loc) · 3.37 KB
/
install.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
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
@Echo off
REM ##### COLOR SUPPORT #####
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
SET aqua=03
SET light_green=0a
SET red=04
SET title_color=0b
SET header_color=%aqua%
REM ##### COLOR SUPPORT #####
REM ##### LOG NAMES #####
SET log_prefix="cmd_log_"
SET log_suffix=".txt"
REM ##### LOG NAMES #####
REM ##### local vars #####
set is_remote=0
set enable_unit_test=0
set enable_submodule_update=0
set windows_sdk_version=0
REM if left blank it stays in the root folder of the .bat file
set workspace_path=""
REM ##### MAIN #####
call :colorEcho %title_color% "==================================="
call :colorEcho %title_color% "== Wisp Installer =="
call :colorEcho %title_color% "==================================="
rem ##### argument handeling ######
if "%1" == "-remote" (
set is_remote=1
)
if "%1" == "-help" (
echo This install.bat is use to complete the setup of the ray tracing git repository.
echo It will donwload all dependencies and use CMake to generate a MS Visual Studio project.
echo Options:
echo -remote [s]
echo Can be used to make this script run on build servers. It no longer needs any user input
echo remote accepts one argument a directory path to supply your working directory.
echo leave this argument blank to use the default directory.
goto :eof
)
rem ##### pre install settings #####
if "%is_remote%" == "1" (
set workspace_path="%~df2"
set enable_unit_test=1
set enable_submodule_update=1
) else (
choice /c yn /m "Do you want to update submodules?"
if errorlevel 2 (
echo submodules will not be updated
) else (
set enable_submodule_update=1
echo submodules will be updated
)
)
FOR /F "delims=" %%i IN ('dir "C:\Program Files (x86)\Windows Kits\10\Include" /b /ad-h /t:c /o-n') DO (
SET windows_sdk_version=%%i
GOTO :found
)
call :colorEcho %red% No Windows SDK found in location: C:\Program Files (x86)\Windows Kits\10\Include
EXIT 1
:found
echo Latest installed Windows SDK: %windows_sdk_version%
echo Windows SDK required: 10.0.17763.0 or newer
rem ##### install #####
if "%enable_submodule_update%" == "1" (
call :downloadDeps
)
call :genVS15Win64
call :colorEcho %light_green% "Installation Finished!"
if "%is_remote%" == "1" (
goto :eof
) else (
pause
)
EXIT
REM ##### MAIN #####
REM ##### DOWNLOAD DEPS #####
:downloadDeps
call :colorEcho %header_color% "#### Downloading Dependencies ####"
cd "%workspace_path%"
git submodule init
git submodule update --recursive
EXIT /B 0
REM ##### DOWNLOAD DEPS #####
REM ##### GEN PROJECTS #####
:genVS15Win64
call :colorEcho %header_color% "#### Generating Visual Studio 16 2019 Win64 Project. ####"
cd "%workspace_path%"
echo current path: "%cd%"
if exist "./build_vs2019_win64/" (
del ".\build_vs2019_win64\CMakeCache.txt"
)
mkdir build_vs2019_win64
cd build_vs2019_win64
echo cmake -DCMAKE_SYSTEM_VERSION=%windows_sdk_version% -G "Visual Studio 16 2019" -A x64 ..
cmake -DCMAKE_SYSTEM_VERSION=%windows_sdk_version% -G "Visual Studio 16 2019" -A x64 ..
if errorlevel 1 call :colorecho %red% "CMake finished with errors"
cd ..
EXIT /B 0
REM ##### GEN CMAKE PROJECTS #####
REM ##### COLOR SUPPORT #####
:colorEcho
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1i
echo.
EXIT /B 0
REM ##### COLOR SUPPORT #####