11# windows specific packaging
2-
3- # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.html
42install (TARGETS sunshine RUNTIME DESTINATION "." COMPONENT application)
53
64# Hardening: include zlib1.dll (loaded via LoadLibrary() in openssl's libcrypto.a)
@@ -39,9 +37,8 @@ install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/vdd/"
3937
4038# Check if cmd directory exists
4139if (EXISTS "${SUNSHINE_SOURCE_ASSETS_DIR} /windows/misc/cmd" )
42- # Convert path to native format for Windows
43- file (TO_NATIVE_PATH "${SUNSHINE_SOURCE_ASSETS_DIR} /windows/misc/cmd" cmd_dir_native)
44- install (DIRECTORY "${cmd_dir_native} /"
40+ # Use original path with forward slashes for CMake install command
41+ install (DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR} /windows/misc/cmd/"
4542 DESTINATION "tools"
4643 COMPONENT superCmds)
4744else ()
@@ -62,81 +59,11 @@ file(TO_NATIVE_PATH "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/shaders" shade
6259file (TO_NATIVE_PATH "${CMAKE_BINARY_DIR} /assets/shaders" shaders_in_build_dest_native)
6360execute_process (COMMAND cp -rpf "${shaders_in_build_src_native} " "${shaders_in_build_dest_native} " )
6461
65- # set(CPACK_NSIS_MUI_HEADERIMAGE "") # TODO: image should be 150x57 bmp
6662set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR} \\\\ sunshine.ico" )
67- set (CPACK_NSIS_INSTALLED_ICON_NAME " ${PROJECT__DIR} \\\\ ${PROJECT_EXE} " )
63+
6864# The name of the directory that will be created in C:/Program files/
6965set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME} " )
7066
71- # Extra install commands
72- # Restores permissions on the install directory
73- # Migrates config files from the root into the new config folder
74- # Install service
75- SET (CPACK_NSIS_EXTRA_INSTALL_COMMANDS
76- "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}
77- IfSilent +2 0
78- CreateShortCut '\\\" $DESKTOP\\\\ SunshineGUI.lnk\\\" ' '\\\" $INSTDIR\\\\ assets\\\\ gui\\\\ sunshine-gui.exe\\\" '
79- ExecShell 'startpin' '\\\" $DESKTOP\\\\ SunshineGUI.lnk\\\" '
80- ExecShell 'open' 'https://docs.qq.com/aio/DSGdQc3htbFJjSFdO'
81- nsExec::ExecToLog 'icacls \\\" $INSTDIR\\\" /reset'
82- nsExec::ExecToLog '\\\" $INSTDIR\\\\ scripts\\\\ migrate-config.bat\\\" '
83- nsExec::ExecToLog '\\\" $INSTDIR\\\\ scripts\\\\ add-firewall-rule.bat\\\" '
84- nsExec::ExecToLog '\\\" $INSTDIR\\\\ scripts\\\\ install-vdd.bat\\\" '
85- nsExec::ExecToLog '\\\" $INSTDIR\\\\ scripts\\\\ install-gamepad.bat\\\" '
86- nsExec::ExecToLog '\\\" $INSTDIR\\\\ scripts\\\\ install-service.bat\\\" '
87- nsExec::ExecToLog '\\\" $INSTDIR\\\\ scripts\\\\ autostart-service.bat\\\" '
88- NoController:
89- " )
90-
91- # Extra uninstall commands
92- # Uninstall service
93- set (CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
94- "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}
95- ExecShell 'startunpin' '\\\" $DESKTOP\\\\ SunshineGUI.lnk\\\" '
96- nsExec::ExecToLog '\\\" $INSTDIR\\\\ scripts\\\\ delete-firewall-rule.bat\\\" '
97- nsExec::ExecToLog '\\\" $INSTDIR\\\\ scripts\\\\ uninstall-service.bat\\\" '
98- nsExec::ExecToLog '\\\" $INSTDIR\\\\ scripts\\\\ uninstall-vdd.bat\\\" '
99- nsExec::ExecToLog '\\\" $INSTDIR\\\\ sunshine.exe\\\" --restore-nvprefs-undo'
100- MessageBox MB_YESNO|MB_ICONQUESTION \
101- 'Do you want to remove Virtual Gamepad)?' \
102- /SD IDNO IDNO NoGamepad
103- nsExec::ExecToLog '\\\" $INSTDIR\\\\ scripts\\\\ uninstall-gamepad.bat\\\" '; skipped if no
104- NoGamepad:
105- MessageBox MB_YESNO|MB_ICONQUESTION \
106- 'Do you want to remove $INSTDIR (this includes the configuration, cover images, and settings)?' \
107- /SD IDNO IDNO NoDelete
108- RMDir /r \\\" $INSTDIR\\\" ; skipped if no
109- NoDelete:
110- " )
111-
112- # Adding an option for the start menu
113- set (CPACK_NSIS_MODIFY_PATH "OFF" )
114- set (CPACK_NSIS_EXECUTABLES_DIRECTORY "." )
115- # This will be shown on the installed apps Windows settings
116- set (CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_PROJECT_NAME} .exe" )
117- set (CPACK_NSIS_CREATE_ICONS_EXTRA
118- "${CPACK_NSIS_CREATE_ICONS_EXTRA}
119- CreateShortCut '\$ SMPROGRAMS\\\\ $STARTMENU_FOLDER\\\\ ${CMAKE_PROJECT_NAME} .lnk' \
120- '\$ INSTDIR\\\\ ${CMAKE_PROJECT_NAME} .exe' '--shortcut'
121- " )
122- set (CPACK_NSIS_DELETE_ICONS_EXTRA
123- "${CPACK_NSIS_DELETE_ICONS_EXTRA}
124- Delete '\$ SMPROGRAMS\\\\ $MUI_TEMP\\\\ ${CMAKE_PROJECT_NAME} .lnk'
125- " )
126-
127- # Checking for previous installed versions
128- set (CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON" )
129-
130- set (CPACK_NSIS_HELP_LINK "https://sunshinestream.readthedocs.io/en/latest/about/installation.html" )
131- set (CPACK_NSIS_URL_INFO_ABOUT "${CMAKE_PROJECT_HOMEPAGE_URL} " )
132- set (CPACK_NSIS_CONTACT "${CMAKE_PROJECT_HOMEPAGE_URL} /support" )
133-
134- set (CPACK_NSIS_MENU_LINKS
135- "https://sunshinestream.readthedocs.io" "Sunshine documentation"
136- "https://app.lizardbyte.dev" "LizardByte Web Site"
137- "https://app.lizardbyte.dev/support" "LizardByte Support" )
138- set (CPACK_NSIS_MANIFEST_DPI_AWARE true )
139-
14067# Setting components groups and dependencies
14168set (CPACK_COMPONENT_GROUP_CORE_EXPANDED true )
14269set (CPACK_COMPONENT_GROUP_SCRIPTS_EXPANDED true )
@@ -184,3 +111,7 @@ set(CPACK_COMPONENT_VDD_DISPLAY_NAME "Zako Display Driver")
184111set (CPACK_COMPONENT_VDD_DESCRIPTION "支持HDR的虚拟显示器驱动安装" )
185112set (CPACK_COMPONENT_VDD_REQUIRED OFF )
186113set (CPACK_COMPONENT_VDD_GROUP "Scripts" )
114+
115+ # include specific packaging
116+ include (${CMAKE_MODULE_PATH} /packaging/windows_nsis.cmake)
117+ include (${CMAKE_MODULE_PATH} /packaging/windows_wix.cmake)
0 commit comments