mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
Compare commits
1 Commits
master
...
feat/insta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07c0044df3 |
12
.github/workflows/ci-windows.yml
vendored
12
.github/workflows/ci-windows.yml
vendored
@@ -236,6 +236,11 @@ jobs:
|
||||
# Clean up
|
||||
Remove-Item -Path doxygen-setup.exe
|
||||
|
||||
- name: Setup dotnet # needed for wix
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '9.x'
|
||||
|
||||
- name: Setup python
|
||||
id: setup-python
|
||||
uses: actions/setup-python@v5
|
||||
@@ -282,12 +287,19 @@ jobs:
|
||||
|
||||
# package
|
||||
cpack -G NSIS
|
||||
cpack -G WIX
|
||||
cpack -G ZIP
|
||||
|
||||
# move
|
||||
mv ./cpack_artifacts/Sunshine.exe ../artifacts/Sunshine-${{ matrix.name }}-installer.exe
|
||||
mv ./cpack_artifacts/Sunshine.msi ../artifacts/Sunshine-${{ matrix.name }}-installer.msi
|
||||
mv ./cpack_artifacts/Sunshine.zip ../artifacts/Sunshine-${{ matrix.name }}-portable.zip
|
||||
|
||||
- name: Debug wix
|
||||
if: always()
|
||||
shell: msys2 {0}
|
||||
run: cat /d/a/Sunshine/Sunshine/build/cpack_artifacts/_CPack_Packages/win64/WIX/wix.log
|
||||
|
||||
- name: Run tests
|
||||
id: test
|
||||
shell: msys2 {0}
|
||||
|
||||
@@ -1,4 +1,72 @@
|
||||
# WIX Packaging
|
||||
# see options at: https://cmake.org/cmake/help/latest/cpack_gen/wix.html
|
||||
|
||||
# TODO: Replace nsis with wix
|
||||
set(CPACK_WIX_VERSION 4)
|
||||
set(WIX_VERSION 4.0.4)
|
||||
set(WIX_UI_VERSION 4.0.4) # extension versioning is independent of the WiX version
|
||||
set(WIX_BUILD_PARENT_DIRECTORY "${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/win64")
|
||||
set(WIX_BUILD_DIRECTORY "${WIX_BUILD_PARENT_DIRECTORY}/WIX")
|
||||
|
||||
# Download and install WiX tools locally in the build directory
|
||||
set(WIX_TOOL_PATH "${CMAKE_BINARY_DIR}/.wix")
|
||||
file(MAKE_DIRECTORY ${WIX_TOOL_PATH})
|
||||
|
||||
# find dotnet
|
||||
find_program(DOTNET_EXECUTABLE dotnet REQUIRED HINTS "C:/Program Files/dotnet")
|
||||
|
||||
# Install WiX locally using dotnet
|
||||
execute_process(
|
||||
COMMAND ${DOTNET_EXECUTABLE} tool install --tool-path ${WIX_TOOL_PATH} wix --version ${WIX_VERSION}
|
||||
ERROR_VARIABLE WIX_INSTALL_OUTPUT
|
||||
RESULT_VARIABLE WIX_INSTALL_RESULT
|
||||
)
|
||||
|
||||
if(NOT WIX_INSTALL_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to install WiX tools locally.
|
||||
WiX packaging may not work correctly, error: ${WIX_INSTALL_OUTPUT}")
|
||||
endif()
|
||||
|
||||
# Install WiX UI Extension
|
||||
execute_process(
|
||||
COMMAND "${WIX_TOOL_PATH}/wix" extension add WixToolset.UI.wixext/${WIX_UI_VERSION}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
ERROR_VARIABLE WIX_UI_INSTALL_OUTPUT
|
||||
RESULT_VARIABLE WIX_UI_INSTALL_RESULT
|
||||
)
|
||||
|
||||
if(NOT WIX_UI_INSTALL_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to install WiX UI extension, error: ${WIX_UI_INSTALL_OUTPUT}")
|
||||
endif()
|
||||
|
||||
# Set WiX-specific variables
|
||||
set(CPACK_WIX_ROOT "${WIX_TOOL_PATH}")
|
||||
set(CPACK_WIX_UPGRADE_GUID "512A3D1B-BE16-401B-A0D1-59BBA3942FB8")
|
||||
|
||||
# Help/Support URLs
|
||||
set(CPACK_WIX_HELP_LINK "https://docs.lizardbyte.dev/projects/sunshine/latest/md_docs_2getting__started.html")
|
||||
set(CPACK_WIX_PRODUCT_URL "${CMAKE_PROJECT_HOMEPAGE_URL}")
|
||||
set(CPACK_WIX_PROGRAM_MENU_FOLDER "LizardByte")
|
||||
|
||||
set(CPACK_WIX_EXTENSIONS
|
||||
"WixToolset.UI.wixext"
|
||||
)
|
||||
|
||||
message(STATUS "cpack package directory: ${CPACK_PACKAGE_DIRECTORY}")
|
||||
|
||||
# copy custom wxs files to the build directory
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/wix_resources/"
|
||||
DESTINATION "${WIX_BUILD_PARENT_DIRECTORY}/")
|
||||
|
||||
set(CPACK_WIX_EXTRA_SOURCES
|
||||
"${WIX_BUILD_PARENT_DIRECTORY}/custom-actions.wxs"
|
||||
"${WIX_BUILD_PARENT_DIRECTORY}/custom-shortcuts.wxs"
|
||||
)
|
||||
|
||||
# Copy root LICENSE and rename to have .txt extension
|
||||
file(COPY "${CMAKE_SOURCE_DIR}/LICENSE"
|
||||
DESTINATION "${CMAKE_BINARY_DIR}")
|
||||
file(RENAME "${CMAKE_BINARY_DIR}/LICENSE" "${CMAKE_BINARY_DIR}/LICENSE.txt")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/LICENSE.txt") # cpack will covert this to an RTF if it is txt
|
||||
|
||||
# https://cmake.org/cmake/help/latest/cpack_gen/wix.html#variable:CPACK_WIX_ARCHITECTURE
|
||||
set(CPACK_WIX_ARCHITECTURE "x64")
|
||||
|
||||
100
cmake/packaging/wix_resources/custom-actions.wxs
Normal file
100
cmake/packaging/wix_resources/custom-actions.wxs
Normal file
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?include "WIX/cpack_variables.wxi"?>
|
||||
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
||||
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
|
||||
<Fragment Id="CustomActionsFragment">
|
||||
<CustomAction Id='InstallService'
|
||||
ExeCommand='cmd.exe /c "[INSTALL_ROOT]scripts\install-service.bat"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<CustomAction Id='ConfigFirewall'
|
||||
ExeCommand='cmd.exe /c "[INSTALL_ROOT]scripts\add-firewall-rule.bat"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<CustomAction Id='InstallGamepad'
|
||||
ExeCommand='cmd.exe /c "[INSTALL_ROOT]scripts\install-gamepad.bat"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<CustomAction Id='AutostartService'
|
||||
ExeCommand='cmd.exe /c "[INSTALL_ROOT]scripts\autostart-service.bat"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<CustomAction Id='MigrateConfig'
|
||||
ExeCommand='cmd.exe /c "[INSTALL_ROOT]scripts\migrate-config.bat"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<CustomAction Id='UpdatePath'
|
||||
ExeCommand='cmd.exe /c "[INSTALL_ROOT]scripts\update-path.bat add"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<CustomAction Id='ResetPermissions'
|
||||
ExeCommand='cmd.exe /c "icacls \"[INSTALL_ROOT]\" /reset"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<CustomAction Id='UninstallService'
|
||||
ExeCommand='cmd.exe /c "[INSTALL_ROOT]scripts\uninstall-service.bat"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<CustomAction Id='RemoveFirewall'
|
||||
ExeCommand='cmd.exe /c "[INSTALL_ROOT]scripts\delete-firewall-rule.bat"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<CustomAction Id='RestoreNvPrefs'
|
||||
ExeCommand='cmd.exe /c "[INSTALL_ROOT]$(var.CPACK_PACKAGE_NAME).exe --restore-nvprefs-undo"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<CustomAction Id='RemovePathUpdate'
|
||||
ExeCommand='cmd.exe /c "[INSTALL_ROOT]scripts\update-path.bat remove"'
|
||||
Directory='INSTALL_ROOT'
|
||||
Execute='deferred'
|
||||
Return='check'
|
||||
Impersonate='no' />
|
||||
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action='ResetPermissions' After='InstallFiles' Condition="NOT Installed" />
|
||||
<Custom Action='UpdatePath' After='ResetPermissions' Condition="NOT Installed" />
|
||||
<Custom Action='MigrateConfig' After='UpdatePath' Condition="NOT Installed" />
|
||||
<Custom Action='ConfigFirewall' After='MigrateConfig' Condition="NOT Installed" />
|
||||
<Custom Action='InstallGamepad' After='ConfigFirewall' Condition="NOT Installed" />
|
||||
<Custom Action='InstallService' After='InstallGamepad' Condition="NOT Installed" />
|
||||
<Custom Action='AutostartService' After='InstallService' Condition="NOT Installed" />
|
||||
|
||||
<Custom Action='RemoveFirewall' Before='RemoveFiles' Condition="REMOVE" />
|
||||
<Custom Action='UninstallService' Before='RemoveFiles' Condition="REMOVE" />
|
||||
<Custom Action='RestoreNvPrefs' Before='RemoveFiles' Condition="REMOVE" />
|
||||
<Custom Action='RemovePathUpdate' Before='RemoveFiles' Condition="REMOVE" />
|
||||
</InstallExecuteSequence>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
23
cmake/packaging/wix_resources/custom-shortcuts.wxs
Normal file
23
cmake/packaging/wix_resources/custom-shortcuts.wxs
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
|
||||
<?include "WIX/cpack_variables.wxi"?>
|
||||
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Fragment Id="CustomShortcutsFragment">
|
||||
<StandardDirectory Id='ProgramMenuFolder'>
|
||||
<Directory Id='ApplicationProgramsFolder' Name='$(var.CPACK_PACKAGE_VENDOR)'>
|
||||
<Component Id='ApplicationShortcut' Guid='*'>
|
||||
<Shortcut Id='ApplicationStartMenuShortcut'
|
||||
Name='$(var.CPACK_PACKAGE_NAME)'
|
||||
Description='Self-hosted game stream host for Moonlight'
|
||||
Target='[INSTALL_ROOT]$(var.CPACK_PACKAGE_NAME).exe'
|
||||
Arguments='--shortcut'
|
||||
WorkingDirectory='INSTALL_ROOT'/>
|
||||
<RemoveFolder Id='ApplicationProgramsFolder' On='uninstall'/>
|
||||
<RegistryValue Root='HKCU' Key='Software\\LizardByte\\$(var.CPACK_PACKAGE_NAME)'
|
||||
Name='installed' Type='integer' Value='1' KeyPath='yes'/>
|
||||
</Component>
|
||||
</Directory>
|
||||
</StandardDirectory>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
@@ -56,11 +56,11 @@ else()
|
||||
if(NOT GIT_DESCRIBE_ERROR_CODE)
|
||||
MESSAGE("Sunshine Branch: ${GIT_DESCRIBE_BRANCH}")
|
||||
if(NOT GIT_DESCRIBE_BRANCH STREQUAL "master")
|
||||
set(PROJECT_VERSION ${PROJECT_VERSION}.${GIT_DESCRIBE_VERSION})
|
||||
set(PROJECT_VERSION ${PROJECT_VERSION}-${GIT_DESCRIBE_VERSION})
|
||||
MESSAGE("Sunshine Version: ${GIT_DESCRIBE_VERSION}")
|
||||
endif()
|
||||
if(GIT_IS_DIRTY)
|
||||
set(PROJECT_VERSION ${PROJECT_VERSION}.dirty)
|
||||
set(PROJECT_VERSION ${PROJECT_VERSION}-dirty)
|
||||
MESSAGE("Git tree is dirty!")
|
||||
endif()
|
||||
else()
|
||||
|
||||
@@ -138,9 +138,12 @@ ninja -C build
|
||||
```}
|
||||
}}
|
||||
@tab{Windows | @tabs{
|
||||
@tab{Installer | ```bash
|
||||
@tab{NSIS Installer | ```bash
|
||||
cpack -G NSIS --config ./build/CPackConfig.cmake
|
||||
```}
|
||||
@tab{WiX Installer | ```bash
|
||||
cpack -G WIX --config ./build/CPackConfig.cmake
|
||||
```}
|
||||
@tab{Portable | ```bash
|
||||
cpack -G ZIP --config ./build/CPackConfig.cmake
|
||||
```}
|
||||
|
||||
Reference in New Issue
Block a user