Inno installer scripts for createing installer for windows from sd.cpp.gui.wx project
fszontagh
2024-03-09 abef198bc8d5efc44ad9e8cf35c7b677333c26ee
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
@ECHO OFF
 
set startdir=%cd%
set vcpkg_root_dir=%startdir%\vcpkg
set src_dir=%startdir%\src
set compiled_dir=%startdir%\ready
set installers_dir=%startdir%\installers
set basedirname=%src_dir%\sd.cpp.gui.wx
set avx_dir=%basedirname%_avx
set avx2_dir=%basedirname%_avx2
set avx512_dir=%basedirname%_avx512
set CUDA_dir=%basedirname%_CUDA
set ISCC="C:\Program Files (x86)\Inno Setup 6\iscc.exe"
 
:start
@ECHO OFF
cls
@ECHO Select job:
@echo:
@echo 0: Install vcpkg
@echo 1: force clone
@echo 2: build all
@echo 3: copy to place
@echo 4: create installers
@echo --------------  
@echo 5: exit     
 
set /p "id=Choose one: "
 
if %id%==0 goto VCPKG
if %id%==1 goto GITPULL
if %id%==2 goto BUILD
if %id%==3 goto COPY
if %id%==5 goto done
if %id%==4 goto INNO
 
 
:INNO
IF NOT EXIST %installers_dir%\ (
    mkdir %installers_dir%
)
 
REM A fájl elérési útvonala
set "version_file=src\sd.cpp.gui.wx_avx\ui\ver.hpp"
 
 
for /f tokens^=2^ delims^=^" %%a in ('type %version_file% ^| findstr /c:"SD_GUI_VERSION"') do (
    set "SD_GUI_VERSION=%%~a"
)
 
set SD_GUI_VARIATION=avx
set SD_GUI_VERSION=%SD_GUI_VERSION%
echo SD GUI version: %SD_GUI_VERSION%
echo SD GUI variation: %SD_GUI_VARIATION%
 
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /value') do set datetime=%%I
set date=%datetime:~0,4%-%datetime:~4,2%-%datetime:~6,2%
 
 
%ISCC% /O"%installers_dir%/%date%" sd.gui.wx.iss
 
set SD_GUI_VARIATION=avx2
set SD_GUI_VERSION=%SD_GUI_VERSION%
echo SD GUI version: %SD_GUI_VERSION%
echo SD GUI variation: %SD_GUI_VARIATION%
 
%ISCC% /O"%installers_dir%/%date%" sd.gui.wx.iss
 
 
set SD_GUI_VARIATION=avx512
set SD_GUI_VERSION=%SD_GUI_VERSION%
echo SD GUI version: %SD_GUI_VERSION%
echo SD GUI variation: %SD_GUI_VARIATION%
 
%ISCC% /O"%installers_dir%/%date%" sd.gui.wx.iss
 
set SD_GUI_VARIATION=cuda
set SD_GUI_VERSION=%SD_GUI_VERSION%
echo SD GUI version: %SD_GUI_VERSION%
echo SD GUI variation: %SD_GUI_VARIATION%
 
%ISCC% /O"%installers_dir%/%date%" sd.gui.wx.iss
 
REM %ISCC% /O"%installers_dir%/%date%" sd.gui.wx_avx2.iss
REM %ISCC% /O"%installers_dir%/%date%" sd.gui.wx_avx512.iss
REM %ISCC% /O"%installers_dir%/%date%" sd.gui.wx_avx_CUDA.iss
 
pause
goto start
 
 
:VCPKG
cls
IF NOT EXIST "%vcpkg_root_dir%"\ (
 git clone https://github.com/microsoft/vcpkg.git %vcpkg_root_dir%
) ELSE (
 set /p DUMMY=Already installed... hit ENTER to continue...
)
goto start
 
:GITPULL
cls
REM Pulling all git...
if exist %avx_dir%\ (
  rmdir /s /q %avx_dir%
 
git clone https://github.com/fszontagh/sd.cpp.gui.wx.git %avx_dir% 
 
if exist %avx2_dir%\ (
  rmdir /s /q %avx2_dir%
 
git clone https://github.com/fszontagh/sd.cpp.gui.wx.git %avx2_dir% 
 
if exist %avx512_dir%\ (
  rmdir /s /q %avx512_dir% 
 
git clone https://github.com/fszontagh/sd.cpp.gui.wx.git %avx512_dir% 
 
 
if exist %CUDA_dir%\ (
  rmdir /s /q %CUDA_dir% 
 
git clone https://github.com/fszontagh/sd.cpp.gui.wx.git %CUDA_dir% 
 
cd %avx_dir%
git fetch --all
git reset --hard origin/main
git pull
cd %avx2_dir%
git fetch --all
git reset --hard origin/main
git pull
cd %avx512_dir%
git fetch --all
git reset --hard origin/main
git pull
cd %CUDA_dir%
git fetch --all
git reset --hard origin/main
git pull
cd %startdir%
goto :start
 
:BUILD
cls
cd %avx_dir%
powershell -Command "(gc vcpkg.json) -replace '\"cuda\"\,', '' | Out-File -encoding ASCII vcpkg.json"
IF EXIST external\stable-diffusion\ (
    rmdir /s /q external\stable-diffusion
)
IF EXIST build\ (
    rmdir /s /q build
)
cmake -B build/ -S . -DCMAKE_TOOLCHAIN_FILE=%vcpkg_root_dir%/scripts/buildsystems/vcpkg.cmake -DGGML_AVX512=OFF -DGGML_AVX2=OFF -DGGML_AVX=ON -DSD_CUBLAS=OFF
cmake --build build/ --config Release
cd %startdir%
 
cd %avx2_dir%
powershell -Command "(gc vcpkg.json) -replace '\"cuda\"\,', '' | Out-File -encoding ASCII vcpkg.json"
rmdir /s /q external\stable-diffusion
rmdir /s /q build
cmake -B build/ -S . -DCMAKE_TOOLCHAIN_FILE=%vcpkg_root_dir%/scripts/buildsystems/vcpkg.cmake -DGGML_AVX512=OFF -DGGML_AVX2=ON -DGGML_AVX=OFF -DSD_CUBLAS=OFF
cmake --build build/ --config Release
cd %startdir%
 
 
cd %avx512_dir%
powershell -Command "(gc vcpkg.json) -replace '\"cuda\"\,', '' | Out-File -encoding ASCII vcpkg.json"
IF EXIST external\stable-diffusion\ (
    rmdir /s /q external\stable-diffusion
)
IF EXIST build\ (
    rmdir /s /q build
)
cmake -B build/ -S . -DCMAKE_TOOLCHAIN_FILE=%vcpkg_root_dir%/scripts/buildsystems/vcpkg.cmake -DGGML_AVX512=ON -DGGML_AVX2=ON -DGGML_AVX=ON -DSD_CUBLAS=OFF
cmake --build build/ --config Release
cd %startdir%
 
cd %CUDA_dir%
IF EXIST external\stable-diffusion\ (
    rmdir /s /q external\stable-diffusion
)
IF EXIST build\ (
    rmdir /s /q build
)
cmake -B build/ -S . -DCMAKE_TOOLCHAIN_FILE=%vcpkg_root_dir%/scripts/buildsystems/vcpkg.cmake -DSD_CUBLAS=ON
cmake --build build/ --config Release
cd %startdir%
 
goto :start
 
:COPY
cls
IF NOT EXIST %compiled_dir%\ (
    mkdir %compiled_dir%
)
IF NOT EXIST %compiled_dir%\sd.cpp.gui.wx_avx\ (
    mkdir %compiled_dir%\sd.cpp.gui.wx_avx
)
xcopy /s /v /h /y %avx_dir%\build\Release %compiled_dir%\sd.cpp.gui.wx_avx\
 
 
IF NOT EXIST %compiled_dir%\sd.cpp.gui.wx_avx2\ (
    mkdir %compiled_dir%\sd.cpp.gui.wx_avx2
)
 
xcopy /s /v /h /y %avx2_dir%\build\Release %compiled_dir%\sd.cpp.gui.wx_avx2\
 
IF NOT EXIST %compiled_dir%\sd.cpp.gui.wx_avx512\ (
    mkdir %compiled_dir%\sd.cpp.gui.wx_avx512
)
xcopy /s /v /h /y %avx512_dir%\build\Release %compiled_dir%\sd.cpp.gui.wx_avx512\
 
 
IF NOT EXIST %compiled_dir%\sd.cpp.gui.wx_cuda\ (
    mkdir %compiled_dir%\sd.cpp.gui.wx_cuda
)
 
xcopy /s /v /h /y %CUDA_dir%\build\Release %compiled_dir%\sd.cpp.gui.wx_cuda\
 
REM copy duda distr. dlls
xcopy /s /v /h /y %CUDA_PATH%\bin\cublas64_12.dll %compiled_dir%\sd.cpp.gui.wx_cuda\
xcopy /s /v /h /y %CUDA_PATH%\bin\cublasLt64_12.dll %compiled_dir%\sd.cpp.gui.wx_cuda\
xcopy /s /v /h /y %CUDA_PATH%\bin\cudart64_12.dll %compiled_dir%\sd.cpp.gui.wx_cuda\
 
 
 
goto :done
 
:done
cd %startdir%
pause >nul