Inno installer scripts for createing installer for windows from sd.cpp.gui.wx project
fszontagh
2024-03-09 ba7c9d0ca28db7724cebd40cd7e456df6eda6396
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
@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%
)
@echo off
REM Get current date in the format YYYY-MM-DD
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%
REM Run Inno Setup compiler with the specified output path
%ISCC% /O "%installers_dir%/%date%" sd.gui.wx_avx.iss
%ISCC% /O "%installers_dir%/%date%" sd.gui.wx_avx2.iss
%ISCC% /O "%installers_dir%/%date%" sd.gui.wx_avx512.iss
%ISCC% /O "%installers_dir%/%date%" sd.gui.wx_avx_CUDA.iss
 
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"
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=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"
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=ON -DGGML_AVX2=ON -DGGML_AVX=ON -DSD_CUBLAS=OFF
cmake --build build/ --config Release
cd %startdir%
 
cd %CUDA_dir%
rmdir /s /q external\stable-diffusion
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
mkdir %compiled_dir%
mkdir %compiled_dir%\sd.cpp.gui.wx_avx
xcopy /s /v /h /y %avx_dir%\build\Release %compiled_dir%\sd.cpp.gui.wx_avx\
 
mkdir %compiled_dir%
mkdir %compiled_dir%\sd.cpp.gui.wx_avx2
xcopy /s /v /h /y %avx2_dir%\build\Release %compiled_dir%\sd.cpp.gui.wx_avx2\
 
mkdir %compiled_dir%
mkdir %compiled_dir%\sd.cpp.gui.wx_avx512
xcopy /s /v /h /y %avx512_dir%\build\Release %compiled_dir%\sd.cpp.gui.wx_avx512\
 
mkdir %compiled_dir%
mkdir %compiled_dir%\sd.cpp.gui.wx_cuda
xcopy /s /v /h /y %CUDA_dir%\build\Release %compiled_dir%\sd.cpp.gui.wx_cuda\
 
goto :done
 
:done
cd %startdir%
pause >nul