project: Improve user experience in the Installer

Adds a BeforeInstall step to the InnoSetup installer which uses the msvc-redist-helper tool to automatically check for the necessary DLLs and install the required redistributable if some are found to be missing.

Additionally slightly modernized the installer with a design that isn't from the 90s, and paves the way for preventing updating StreamFX while OBS Studio is still running.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-07-15 18:07:09 +02:00
parent 1229815299
commit 16489c4180
4 changed files with 129 additions and 107 deletions

View File

@ -270,16 +270,17 @@ configure_file(
"${PROJECT_BINARY_DIR}/generated/module.cpp" "${PROJECT_BINARY_DIR}/generated/module.cpp"
) )
# Packaging if(NOT TARGET libobs)
if("${CMAKE_PACKAGE_SUFFIX_OVERRIDE}" STREQUAL "") # Packaging
if("${CMAKE_PACKAGE_SUFFIX_OVERRIDE}" STREQUAL "")
set(_PACKAGE_SUFFIX_OVERRIDE "${VERSION_STRING}") set(_PACKAGE_SUFFIX_OVERRIDE "${VERSION_STRING}")
else() else()
set(_PACKAGE_SUFFIX_OVERRIDE "${CMAKE_PACKAGE_SUFFIX_OVERRIDE}") set(_PACKAGE_SUFFIX_OVERRIDE "${CMAKE_PACKAGE_SUFFIX_OVERRIDE}")
endif() endif()
set(_PACKAGE_FULL_NAME "${CMAKE_PACKAGE_PREFIX}/${CMAKE_PACKAGE_NAME}-${_PACKAGE_SUFFIX_OVERRIDE}") set(_PACKAGE_FULL_NAME "${CMAKE_PACKAGE_PREFIX}/${CMAKE_PACKAGE_NAME}-${_PACKAGE_SUFFIX_OVERRIDE}")
# Windows # Windows
if(WIN32) if(WIN32)
## Installer (InnoSetup) ## Installer (InnoSetup)
get_filename_component(ISS_FILES_DIR "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) get_filename_component(ISS_FILES_DIR "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
file(TO_NATIVE_PATH "${ISS_FILES_DIR}" ISS_FILES_DIR) file(TO_NATIVE_PATH "${ISS_FILES_DIR}" ISS_FILES_DIR)
@ -287,6 +288,8 @@ if(WIN32)
file(TO_NATIVE_PATH "${ISS_PACKAGE_DIR}" ISS_PACKAGE_DIR) file(TO_NATIVE_PATH "${ISS_PACKAGE_DIR}" ISS_PACKAGE_DIR)
get_filename_component(ISS_SOURCE_DIR "${PROJECT_SOURCE_DIR}" ABSOLUTE) get_filename_component(ISS_SOURCE_DIR "${PROJECT_SOURCE_DIR}" ABSOLUTE)
file(TO_NATIVE_PATH "${ISS_SOURCE_DIR}" ISS_SOURCE_DIR) file(TO_NATIVE_PATH "${ISS_SOURCE_DIR}" ISS_SOURCE_DIR)
get_filename_component(ISS_MSVCHELPER_PATH "${msvc-redist-helper_BUILD_DIR}" ABSOLUTE)
file(TO_NATIVE_PATH "${ISS_MSVCHELPER_PATH}" ISS_MSVCHELPER_PATH)
configure_file( configure_file(
"cmake/installer.iss.in" "cmake/installer.iss.in"
"${PROJECT_BINARY_DIR}/installer.iss" "${PROJECT_BINARY_DIR}/installer.iss"
@ -304,10 +307,11 @@ if(WIN32)
"${PROJECT_BINARY_DIR}/generated/version.rc" "${PROJECT_BINARY_DIR}/generated/version.rc"
@ONLY @ONLY
) )
endif()
# Download OBS Studio and OBS Dependencies endif()
if(${PropertyPrefix}OBS_DOWNLOAD)
# Download OBS Studio and OBS Dependencies
if(${PropertyPrefix}OBS_DOWNLOAD)
include("DownloadProject") include("DownloadProject")
set(OBS_DOWNLOAD_VERSION "25.0.3-fe-ci") set(OBS_DOWNLOAD_VERSION "25.0.3-fe-ci")
@ -341,19 +345,19 @@ if(${PropertyPrefix}OBS_DOWNLOAD)
# Other OS # Other OS
message(FATAL "Unable to download libOBS as this Operating System is not yet supported.") message(FATAL "Unable to download libOBS as this Operating System is not yet supported.")
endif() endif()
endif() endif()
# Load OBS Studio & Dependencies # Load OBS Studio & Dependencies
if(${PropertyPrefix}OBS_PACKAGE) if(${PropertyPrefix}OBS_PACKAGE)
include("${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake") include("${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake")
if (EXISTS "${OBS_STUDIO_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake") if (EXISTS "${OBS_STUDIO_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
include("${OBS_STUDIO_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake") include("${OBS_STUDIO_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake")
set(HAVE_OBS_FRONTEND TRUE) set(HAVE_OBS_FRONTEND TRUE)
endif() endif()
elseif(${PropertyPrefix}OBS_REFERENCE) elseif(${PropertyPrefix}OBS_REFERENCE)
set(obsPath "${OBS_STUDIO_DIR}") set(obsPath "${OBS_STUDIO_DIR}")
include("${OBS_STUDIO_DIR}/cmake/external/FindLibobs.cmake") include("${OBS_STUDIO_DIR}/cmake/external/FindLibobs.cmake")
elseif(${PropertyPrefix}OBS_DOWNLOAD) elseif(${PropertyPrefix}OBS_DOWNLOAD)
set(_INCLUDE_PREFIX "") set(_INCLUDE_PREFIX "")
if(WIN32) if(WIN32)
set(_INCLUDE_PREFIX "${libobs_SOURCE_DIR}/cmake") set(_INCLUDE_PREFIX "${libobs_SOURCE_DIR}/cmake")
@ -382,6 +386,7 @@ elseif(${PropertyPrefix}OBS_DOWNLOAD)
endif() endif()
set(HAVE_OBS_FRONTEND TRUE) set(HAVE_OBS_FRONTEND TRUE)
endif() endif()
endif()
endif() endif()
# QT5 # QT5

View File

@ -10,31 +10,41 @@
; NOTE: The value of AppId uniquely identifies this application. ; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications. ; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
; app Information
AppId={{DE56A03A-C8A4-474B-83B0-CFD270262D38}} AppId={{DE56A03A-C8A4-474B-83B0-CFD270262D38}}
AppName={#MyAppName} AppName={#MyAppName}
AppVersion={#MyAppVersion} AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher} AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL} AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL} AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL} AppUpdatesURL={#MyAppURL}
AppMutex={#MyAppName}
VersionInfoVersion={#MyAppVersion}
VersionInfoCompany={#MyAppPublisher}
VersionInfoDescription={#MyAppName} Setup
; Compression
Compression=lzma2/ultra64
SolidCompression=yes
LZMAAlgorithm=1
; Other Information
DefaultDirName={code:GetDirName} DefaultDirName={code:GetDirName}
DefaultGroupName={#MyAppName} DefaultGroupName={#MyAppName}
AllowNoIcons=yes AllowNoIcons=yes
LicenseFile="@ISS_SOURCE_DIR@/LICENSE" LicenseFile="@ISS_SOURCE_DIR@/LICENSE"
OutputDir="@ISS_PACKAGE_DIR@" OutputDir="@ISS_PACKAGE_DIR@"
OutputBaseFilename=@CMAKE_PACKAGE_NAME@-@_PACKAGE_SUFFIX_OVERRIDE@ OutputBaseFilename=@CMAKE_PACKAGE_NAME@-@_PACKAGE_SUFFIX_OVERRIDE@
Compression=lzma ; Wizard Information
SolidCompression=yes WizardStyle=modern
VersionInfoVersion={#MyAppVersion} WizardResizable=yes
VersionInfoCompany={#MyAppPublisher} SetupIconFile="@PROJECT_SOURCE_DIR@/media/icon.ico"
VersionInfoDescription={#MyAppName} Setup
[Languages] [Languages]
Name: "english"; MessagesFile: "compiler:Default.isl" Name: "english"; MessagesFile: "compiler:Default.isl"
[Files] [Files]
Source: "@ISS_FILES_DIR@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "@ISS_FILES_DIR@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "@PROJECT_SOURCE_DIR@/third-party/msvc-redist-helper.exe"; DestDir: "{app}"; DestName: "msvc-redist-helper.exe"; Flags: ignoreversion dontcopy noencryption
; NOTE: Don't use "Flags: ignoreversion" on any shared system files ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons] [Icons]
@ -93,7 +103,7 @@ begin
sUnInstallString := GetUninstallString(); sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString); sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then if Exec(sUnInstallString, '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3 Result := 3
else else
Result := 2; Result := 2;
@ -103,6 +113,8 @@ end;
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep); procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
begin begin
if (CurStep=ssInstall) then if (CurStep=ssInstall) then
begin begin
@ -111,4 +123,9 @@ begin
UnInstallOldVersion(); UnInstallOldVersion();
end; end;
end; end;
if (CurStep=ssPostInstall) then
begin
ExtractTemporaryFile('msvc-redist-helper.exe');
Exec(ExpandConstant('{tmp}\msvc-redist-helper.exe'), '2019', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
end; end;

BIN
media/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
third-party/msvc-redist-helper.exe vendored Normal file

Binary file not shown.