From ba7c9d0ca28db7724cebd40cd7e456df6eda6396 Mon Sep 17 00:00:00 2001
From: fszontagh <51741446+fszontagh@users.noreply.github.com>
Date: Sat, 09 Mar 2024 10:48:37 +0000
Subject: [PATCH] initial

---
 .gitignore           |    6 
 sd.gui.wx_CUDA.iss   |   50 +++++++
 sd.gui.wx_avx512.iss |   50 +++++++
 autobuild.bat        |  171 ++++++++++++++++++++++++
 sd.gui.wx_avx.iss    |   50 +++++++
 sd.gui.wx_avx2.iss   |   50 +++++++
 6 files changed, 377 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0def275..79d2cb9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,9 @@
 *.exe
 *.out
 *.app
+
+
+/output
+/vcpkg
+/src
+/installers
diff --git a/autobuild.bat b/autobuild.bat
new file mode 100644
index 0000000..84dc3d6
--- /dev/null
+++ b/autobuild.bat
@@ -0,0 +1,171 @@
+@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
+
+
diff --git a/sd.gui.wx_CUDA.iss b/sd.gui.wx_CUDA.iss
new file mode 100644
index 0000000..87ac16c
--- /dev/null
+++ b/sd.gui.wx_CUDA.iss
@@ -0,0 +1,50 @@
+; Script generated by the Inno Script Studio Wizard.
+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
+
+#define MyAppName "sd.cpp.gui.wx_CUDA"
+#define MyAppVersion "0.1.1-beta"
+#define MyAppPublisher "Ferenc Szontagh"
+#define MyAppURL "https://github.com/fszontagh/sd.cpp.gui.wx"
+#define MyAppExeName "sd.ui.exe"
+
+[Setup]
+; NOTE: The value of AppId uniquely identifies this application.
+; Do not use the same AppId value in installers for other applications.
+; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
+AppId={{B2D1F8D0-645E-4BBF-9B47-06828BEAD02F}
+AppName={#MyAppName}
+AppVersion={#MyAppVersion}
+;AppVerName={#MyAppName} {#MyAppVersion}
+AppPublisher={#MyAppPublisher}
+AppPublisherURL={#MyAppURL}
+AppSupportURL={#MyAppURL}
+AppUpdatesURL={#MyAppURL}
+DefaultDirName=C:\{#MyAppName}
+DefaultGroupName=sd.cpp.gui.wx
+AllowNoIcons=yes
+LicenseFile=Z:\sd.cpp.gui.wx_github\LICENSE
+OutputBaseFilename={#MyAppName}.x64.installer
+SetupIconFile=Z:\sd.cpp.gui.wx_github\ui\icons\256\cube.ico
+Compression=lzma2
+SolidCompression=yes
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+[Tasks]
+Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
+Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
+
+[Files]
+Source: "Z:\previews\latest\{#MyAppName}\sd.ui.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "Z:\previews\latest\{#MyAppName}\*"; DestDir: "{app}"; Flags: ignoreversion
+; NOTE: Don't use "Flags: ignoreversion" on any shared system files
+
+[Icons]
+Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
+Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
+Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
+
+[Run]
+Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
diff --git a/sd.gui.wx_avx.iss b/sd.gui.wx_avx.iss
new file mode 100644
index 0000000..1df351a
--- /dev/null
+++ b/sd.gui.wx_avx.iss
@@ -0,0 +1,50 @@
+; Script generated by the Inno Script Studio Wizard.
+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
+
+#define MyAppName "sd.cpp.gui.wx_avx"
+#define MyAppVersion "0.1.1-beta"
+#define MyAppPublisher "Ferenc Szontagh"
+#define MyAppURL "https://github.com/fszontagh/sd.cpp.gui.wx"
+#define MyAppExeName "sd.ui.exe"
+
+[Setup]
+; NOTE: The value of AppId uniquely identifies this application.
+; Do not use the same AppId value in installers for other applications.
+; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
+AppId={{B2D1F8D0-645E-4BBF-9B47-06828BEAD02F}
+AppName={#MyAppName}
+AppVersion={#MyAppVersion}
+;AppVerName={#MyAppName} {#MyAppVersion}
+AppPublisher={#MyAppPublisher}
+AppPublisherURL={#MyAppURL}
+AppSupportURL={#MyAppURL}
+AppUpdatesURL={#MyAppURL}
+DefaultDirName=C:\{#MyAppName}
+DefaultGroupName=sd.cpp.gui.wx
+AllowNoIcons=yes
+LicenseFile=Z:\sd.cpp.gui.wx_github\LICENSE
+OutputBaseFilename={#MyAppName}.x64.installer
+SetupIconFile=Z:\sd.cpp.gui.wx_github\ui\icons\256\cube.ico
+Compression=lzma2
+SolidCompression=yes
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+[Tasks]
+Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
+Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
+
+[Files]
+Source: "Z:\previews\latest\{#MyAppName}\sd.ui.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "Z:\previews\latest\{#MyAppName}\*"; DestDir: "{app}"; Flags: ignoreversion
+; NOTE: Don't use "Flags: ignoreversion" on any shared system files
+
+[Icons]
+Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
+Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
+Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
+
+[Run]
+Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
diff --git a/sd.gui.wx_avx2.iss b/sd.gui.wx_avx2.iss
new file mode 100644
index 0000000..bd2061e
--- /dev/null
+++ b/sd.gui.wx_avx2.iss
@@ -0,0 +1,50 @@
+; Script generated by the Inno Script Studio Wizard.
+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
+
+#define MyAppName "sd.cpp.gui.wx_avx2"
+#define MyAppVersion "0.1.1-beta"
+#define MyAppPublisher "Ferenc Szontagh"
+#define MyAppURL "https://github.com/fszontagh/sd.cpp.gui.wx"
+#define MyAppExeName "sd.ui.exe"
+
+[Setup]
+; NOTE: The value of AppId uniquely identifies this application.
+; Do not use the same AppId value in installers for other applications.
+; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
+AppId={{B2D1F8D0-645E-4BBF-9B47-06828BEAD02F}
+AppName={#MyAppName}
+AppVersion={#MyAppVersion}
+;AppVerName={#MyAppName} {#MyAppVersion}
+AppPublisher={#MyAppPublisher}
+AppPublisherURL={#MyAppURL}
+AppSupportURL={#MyAppURL}
+AppUpdatesURL={#MyAppURL}
+DefaultDirName=C:\{#MyAppName}
+DefaultGroupName=sd.cpp.gui.wx
+AllowNoIcons=yes
+LicenseFile=Z:\sd.cpp.gui.wx_github\LICENSE
+OutputBaseFilename={#MyAppName}.x64.installer
+SetupIconFile=Z:\sd.cpp.gui.wx_github\ui\icons\256\cube.ico
+Compression=lzma2
+SolidCompression=yes
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+[Tasks]
+Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
+Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
+
+[Files]
+Source: "Z:\previews\latest\{#MyAppName}\sd.ui.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "Z:\previews\latest\{#MyAppName}\*"; DestDir: "{app}"; Flags: ignoreversion
+; NOTE: Don't use "Flags: ignoreversion" on any shared system files
+
+[Icons]
+Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
+Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
+Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
+
+[Run]
+Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
diff --git a/sd.gui.wx_avx512.iss b/sd.gui.wx_avx512.iss
new file mode 100644
index 0000000..9d57d66
--- /dev/null
+++ b/sd.gui.wx_avx512.iss
@@ -0,0 +1,50 @@
+; Script generated by the Inno Script Studio Wizard.
+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
+
+#define MyAppName "sd.cpp.gui.wx_avx512"
+#define MyAppVersion "0.1.1-beta"
+#define MyAppPublisher "Ferenc Szontagh"
+#define MyAppURL "https://github.com/fszontagh/sd.cpp.gui.wx"
+#define MyAppExeName "sd.ui.exe"
+
+[Setup]
+; NOTE: The value of AppId uniquely identifies this application.
+; Do not use the same AppId value in installers for other applications.
+; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
+AppId={{B2D1F8D0-645E-4BBF-9B47-06828BEAD02F}
+AppName={#MyAppName}
+AppVersion={#MyAppVersion}
+;AppVerName={#MyAppName} {#MyAppVersion}
+AppPublisher={#MyAppPublisher}
+AppPublisherURL={#MyAppURL}
+AppSupportURL={#MyAppURL}
+AppUpdatesURL={#MyAppURL}
+DefaultDirName=C:\{#MyAppName}
+DefaultGroupName=sd.cpp.gui.wx
+AllowNoIcons=yes
+LicenseFile=Z:\sd.cpp.gui.wx_github\LICENSE
+OutputBaseFilename={#MyAppName}.x64.installer
+SetupIconFile=Z:\sd.cpp.gui.wx_github\ui\icons\256\cube.ico
+Compression=lzma2
+SolidCompression=yes
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+[Tasks]
+Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
+Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
+
+[Files]
+Source: "Z:\previews\latest\{#MyAppName}\sd.ui.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "Z:\previews\latest\{#MyAppName}\*"; DestDir: "{app}"; Flags: ignoreversion
+; NOTE: Don't use "Flags: ignoreversion" on any shared system files
+
+[Icons]
+Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
+Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
+Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
+
+[Run]
+Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

--
Gitblit v1.9.3