Skip to content

Commit

Permalink
Add Windows installer
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeYan01 committed Feb 18, 2025
1 parent 090cc9c commit fef4fe0
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/actions/package-plugin/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,8 @@ runs:
Configuration = '${{ inputs.config }}'
}
if ( '${{ inputs.package }}' -eq 'true' ) {
$PackageArgs += @{BuildInstaller = $true}
}
.github/scripts/Package-Windows.ps1 @PackageArgs
21 changes: 20 additions & 1 deletion .github/scripts/Package-Windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ param(
[ValidateSet('x64')]
[string] $Target = 'x64',
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
[string] $Configuration = 'RelWithDebInfo'
[string] $Configuration = 'RelWithDebInfo',
[switch] $BuildInstaller = $false
)

$ErrorActionPreference = 'Stop'
Expand Down Expand Up @@ -67,6 +68,24 @@ function Package {
}
Compress-Archive -Force @CompressArgs
Log-Group

if ( ( $BuildInstaller ) ) {
$IsccFile = "${ProjectRoot}/build_${Target}/installer-Windows.iss"

if ( ! ( Test-Path -Path $IsccFile ) ) {
throw 'InnoSetup install script not found. Run the build script or the CMake build and install procedures first.'
}

Log-Information 'Creating InnoSetup installer...'
Push-Location -Stack BuildTemp
Ensure-Location -Path "${ProjectRoot}/release"
Copy-Item -Path ${Configuration} -Destination Package -Recurse
Invoke-External iscc ${IsccFile} /O"${ProjectRoot}/release" /F"${OutputName}-Installer"
Remove-Item -Path Package -Recurse
Pop-Location -Stack BuildTemp

Log-Group
}
}

Package
5 changes: 4 additions & 1 deletion buildspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@
"version": "0.1.0",
"author": "Ian Rodriguez",
"website": "https://github.com/CodeYan01/media-playlist-source",
"email": "[email protected]"
"email": "[email protected]",
"uuids": {
"windowsApp": "22B0D7BD-767F-45FD-901C-4D6EAB4EF875"
}
}
1 change: 1 addition & 0 deletions cmake/common/bootstrap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ string(JSON _author GET ${buildspec} author)
string(JSON _email GET ${buildspec} email)
string(JSON _version GET ${buildspec} version)
string(JSON _bundleId GET ${buildspec} platformConfig macos bundleId)
string(JSON _windowsAppUUID GET ${buildspec} uuids windowsApp)

set(PLUGIN_AUTHOR ${_author})
set(PLUGIN_WEBSITE ${_website})
Expand Down
13 changes: 13 additions & 0 deletions cmake/windows/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ function(set_target_properties_plugin target)
list(FILTER target_ui_files INCLUDE REGEX ".+\\.(ui|qrc)")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "UI Files" FILES ${target_ui_files})

set(valid_uuid FALSE)
check_uuid(${_windowsAppUUID} valid_uuid)
if(NOT valid_uuid)
message(FATAL_ERROR "Specified Windows package UUID is not a valid UUID value: ${_windowsAppUUID}")
else()
set(UUID_APP ${_windowsAppUUID})
endif()

configure_file(
cmake/windows/resources/installer-Windows.iss.in
"${CMAKE_CURRENT_BINARY_DIR}/installer-Windows.generated.iss"
)

configure_file(cmake/windows/resources/resource.rc.in "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.rc")
target_sources(${CMAKE_PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.rc")
endfunction()
Expand Down
32 changes: 32 additions & 0 deletions cmake/windows/resources/installer-Windows.iss.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#define MyAppName "@CMAKE_PROJECT_NAME@"
#define MyAppVersion "@CMAKE_PROJECT_VERSION@"
#define MyAppPublisher "@PLUGIN_AUTHOR@"
#define MyAppURL "@PLUGIN_WEBSITE@"

[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={{@UUID_APP@}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={commonappdata}\obs-studio\plugins\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-Windows-Installer
Compression=lzma
SolidCompression=yes
DirExistsWarning=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "..\release\Package\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"

0 comments on commit fef4fe0

Please sign in to comment.