From 8c80aa9da2623127394cf07c3bda5ef3a5c8b659 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Wed, 27 Oct 2021 22:48:39 +0200 Subject: CMakeLists.txt: configure NSIS - Install a link to sdgui to the Start Menu. - Associate the .ifo file extension with sdgui. - Change the installation directory name to contain a space, rather than a dash, since that appears to be the norm. It's also copied over to the display name. And thus, the GUI has become somewhat usable on Windows. --- CMakeLists.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25981b7..f566cd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -365,9 +365,27 @@ set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") set (CPACK_GENERATOR "TGZ;ZIP") set (CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") -set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${PROJECT_VERSION}") +set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${PROJECT_VERSION}") set (CPACK_SOURCE_GENERATOR "TGZ;ZIP") set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user") set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") +# XXX: It is still possible to install multiple copies, making commands collide. +set (CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) +set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME}") + +set (CPACK_NSIS_INSTALLED_ICON_NAME sdgui.exe) +set (CPACK_PACKAGE_EXECUTABLES sdgui sdgui) +set (CPACK_NSIS_EXECUTABLES_DIRECTORY .) +set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS [[ + WriteRegStr HKCR '.ifo' '' 'sdgui.Dictionary' + WriteRegStr HKCR 'sdgui.Dictionary' '' 'StarDict Dictionary' + WriteRegStr HKCR 'sdgui.Dictionary\\shell\\open\\command' '' '\"$INSTDIR\\sdgui.exe\" \"%1\"' + System::Call 'shell32::SHChangeNotify(i,i,i,i) (0x08000000, 0x1000, 0, 0)' +]]) +set (CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS [[ + DeleteRegKey HKCR 'sdgui.Dictionary' + System::Call 'shell32::SHChangeNotify(i,i,i,i) (0x08000000, 0x1000, 0, 0)' +]]) + include (CPack) -- cgit v1.2.3-70-g09d2