From 472eede10176a5e15bd528ff2a7482112c1bfac9 Mon Sep 17 00:00:00 2001
From: fszontagh <51741446+fszontagh@users.noreply.github.com>
Date: Sat, 09 Mar 2024 12:33:57 +0000
Subject: [PATCH] unified inno setup script

---
 /dev/null     |   50 ----------------
 sd.gui.wx.iss |   12 ++--
 autobuild.bat |  102 +++++++++++++++++++++++++++-------
 3 files changed, 87 insertions(+), 77 deletions(-)

diff --git a/autobuild.bat b/autobuild.bat
index 84dc3d6..cea35ce 100644
--- a/autobuild.bat
+++ b/autobuild.bat
@@ -39,16 +39,53 @@
 IF NOT EXIST %installers_dir%\ (
 	mkdir %installers_dir%
 )
-@echo off
-REM Get current date in the format YYYY-MM-DD
+
+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%
-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
 
+
+%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
 
 
@@ -112,8 +149,12 @@
 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
+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%
@@ -129,15 +170,23 @@
 
 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
+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%
-rmdir /s /q external\stable-diffusion
-rmdir /s /q build
+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%
@@ -146,20 +195,31 @@
 
 :COPY
 cls
-mkdir %compiled_dir%
-mkdir %compiled_dir%\sd.cpp.gui.wx_avx
+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\
 
-mkdir %compiled_dir%
-mkdir %compiled_dir%\sd.cpp.gui.wx_avx2
+
+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\
 
-mkdir %compiled_dir%
-mkdir %compiled_dir%\sd.cpp.gui.wx_avx512
+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\
 
-mkdir %compiled_dir%
-mkdir %compiled_dir%\sd.cpp.gui.wx_cuda
+
+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\
 
 goto :done
diff --git a/sd.gui.wx_avx512.iss b/sd.gui.wx.iss
similarity index 83%
rename from sd.gui.wx_avx512.iss
rename to sd.gui.wx.iss
index 9d57d66..a449a76 100644
--- a/sd.gui.wx_avx512.iss
+++ b/sd.gui.wx.iss
@@ -1,8 +1,8 @@
 ; 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 MyAppName "sd.cpp.gui.wx_" + str(GetEnv('SD_GUI_VARIATION'))
+#define MyAppVersion str(GetEnv('SD_GUI_VERSION'))
 #define MyAppPublisher "Ferenc Szontagh"
 #define MyAppURL "https://github.com/fszontagh/sd.cpp.gui.wx"
 #define MyAppExeName "sd.ui.exe"
@@ -22,9 +22,9 @@
 DefaultDirName=C:\{#MyAppName}
 DefaultGroupName=sd.cpp.gui.wx
 AllowNoIcons=yes
-LicenseFile=Z:\sd.cpp.gui.wx_github\LICENSE
+LicenseFile=.\src\{#MyAppName}\LICENSE
 OutputBaseFilename={#MyAppName}.x64.installer
-SetupIconFile=Z:\sd.cpp.gui.wx_github\ui\icons\256\cube.ico
+SetupIconFile=.\src\{#MyAppName}\ui\icons\256\cube.ico
 Compression=lzma2
 SolidCompression=yes
 
@@ -36,8 +36,8 @@
 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
+Source: ".\ready\{#MyAppName}\sd.ui.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: ".\ready\{#MyAppName}\*"; DestDir: "{app}"; Flags: ignoreversion
 ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
 
 [Icons]
diff --git a/sd.gui.wx_CUDA.iss b/sd.gui.wx_CUDA.iss
deleted file mode 100644
index 87ac16c..0000000
--- a/sd.gui.wx_CUDA.iss
+++ /dev/null
@@ -1,50 +0,0 @@
-; 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
deleted file mode 100644
index 1df351a..0000000
--- a/sd.gui.wx_avx.iss
+++ /dev/null
@@ -1,50 +0,0 @@
-; 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
deleted file mode 100644
index bd2061e..0000000
--- a/sd.gui.wx_avx2.iss
+++ /dev/null
@@ -1,50 +0,0 @@
-; 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

--
Gitblit v1.9.3