Skip to content

Commit 892692c

Browse files
committed
Add Windows installer
1 parent 090cc9c commit 892692c

6 files changed

Lines changed: 75 additions & 2 deletions

File tree

.github/actions/package-plugin/action.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,8 @@ runs:
110110
Configuration = '${{ inputs.config }}'
111111
}
112112
113+
if ( '${{ inputs.package }}' -eq 'true' ) {
114+
$PackageArgs += @{BuildInstaller = $true}
115+
}
116+
113117
.github/scripts/Package-Windows.ps1 @PackageArgs

.github/scripts/Package-Windows.ps1

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ param(
33
[ValidateSet('x64')]
44
[string] $Target = 'x64',
55
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
6-
[string] $Configuration = 'RelWithDebInfo'
6+
[string] $Configuration = 'RelWithDebInfo',
7+
[switch] $BuildInstaller = $false
78
)
89

910
$ErrorActionPreference = 'Stop'
@@ -53,6 +54,7 @@ function Package {
5354
ErrorAction = 'SilentlyContinue'
5455
Path = @(
5556
"${ProjectRoot}/release/${ProductName}-*-windows-*.zip"
57+
"${ProjectRoot}/release/${ProductName}-*-windows-*.exe"
5658
)
5759
}
5860

@@ -67,6 +69,24 @@ function Package {
6769
}
6870
Compress-Archive -Force @CompressArgs
6971
Log-Group
72+
73+
if ( ( $BuildInstaller ) ) {
74+
$IsccFile = "${ProjectRoot}/build_${Target}/installer-Windows.generated.iss"
75+
76+
if ( ! ( Test-Path -Path $IsccFile ) ) {
77+
throw 'InnoSetup install script not found. Run the build script or the CMake build and install procedures first.'
78+
}
79+
80+
Log-Information 'Creating InnoSetup installer...'
81+
Push-Location -Stack BuildTemp
82+
Ensure-Location -Path "${ProjectRoot}/release"
83+
Copy-Item -Path ${Configuration} -Destination Package -Recurse
84+
Invoke-External iscc ${IsccFile} /O"${ProjectRoot}/release" /F"${OutputName}-Installer"
85+
Remove-Item -Path Package -Recurse
86+
Pop-Location -Stack BuildTemp
87+
88+
Log-Group
89+
}
7090
}
7191

7292
Package

buildspec.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@
4141
"version": "0.1.0",
4242
"author": "Ian Rodriguez",
4343
"website": "https://github.com/CodeYan01/media-playlist-source",
44-
"email": "ianlemuelr@gmail.com"
44+
"email": "ianlemuelr@gmail.com",
45+
"uuids": {
46+
"windowsApp": "22B0D7BD-767F-45FD-901C-4D6EAB4EF875"
47+
}
4548
}

cmake/common/bootstrap.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ string(JSON _author GET ${buildspec} author)
5151
string(JSON _email GET ${buildspec} email)
5252
string(JSON _version GET ${buildspec} version)
5353
string(JSON _bundleId GET ${buildspec} platformConfig macos bundleId)
54+
string(JSON _windowsAppUUID GET ${buildspec} uuids windowsApp)
5455

5556
set(PLUGIN_AUTHOR ${_author})
5657
set(PLUGIN_WEBSITE ${_website})

cmake/windows/helpers.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ function(set_target_properties_plugin target)
5454
list(FILTER target_ui_files INCLUDE REGEX ".+\\.(ui|qrc)")
5555
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "UI Files" FILES ${target_ui_files})
5656

57+
set(valid_uuid FALSE)
58+
check_uuid(${_windowsAppUUID} valid_uuid)
59+
if(NOT valid_uuid)
60+
message(FATAL_ERROR "Specified Windows package UUID is not a valid UUID value: ${_windowsAppUUID}")
61+
else()
62+
set(UUID_APP ${_windowsAppUUID})
63+
endif()
64+
65+
configure_file(
66+
cmake/windows/resources/installer-Windows.iss.in
67+
"${CMAKE_CURRENT_BINARY_DIR}/installer-Windows.generated.iss"
68+
)
69+
5770
configure_file(cmake/windows/resources/resource.rc.in "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.rc")
5871
target_sources(${CMAKE_PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.rc")
5972
endfunction()
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#define MyAppName "@CMAKE_PROJECT_NAME@"
2+
#define MyAppVersion "@CMAKE_PROJECT_VERSION@"
3+
#define MyAppPublisher "@PLUGIN_AUTHOR@"
4+
#define MyAppURL "@PLUGIN_WEBSITE@"
5+
6+
[Setup]
7+
; NOTE: The value of AppId uniquely identifies this application.
8+
; Do not use the same AppId value in installers for other applications.
9+
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
10+
AppId={{@UUID_APP@}
11+
AppName={#MyAppName}
12+
AppVersion={#MyAppVersion}
13+
AppPublisher={#MyAppPublisher}
14+
AppPublisherURL={#MyAppURL}
15+
AppSupportURL={#MyAppURL}
16+
AppUpdatesURL={#MyAppURL}
17+
DefaultDirName={commonappdata}\obs-studio\plugins\{#MyAppName}
18+
DefaultGroupName={#MyAppName}
19+
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-Windows-Installer
20+
Compression=lzma
21+
SolidCompression=yes
22+
DirExistsWarning=no
23+
24+
[Languages]
25+
Name: "english"; MessagesFile: "compiler:Default.isl"
26+
27+
[Files]
28+
Source: "..\release\Package\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
29+
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
30+
31+
[Icons]
32+
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"

0 commit comments

Comments
 (0)