From 452aa80a1d4fa8f5e724f5c6a81fcd04b977698c Mon Sep 17 00:00:00 2001 From: hatelamers <97636078+hatelamers@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:21:23 +0100 Subject: [PATCH] #15 migrated installer to Inno Setup --- buildenv/CMakeLists.txt | 19 ++--- buildenv/Product.cmake | 3 +- buildenv/cpack/Package.cmake | 140 +++++++++++++++++++++++++++-------- src/app/WinPinMenu.rc | 31 ++++---- src/app/app.manifest.in | 2 +- src/app/buildnumber.txt | 2 +- src/app/productmeta.h | 7 +- src/app/productmeta.h.in | 1 + src/app/res/app.manifest | 2 +- 9 files changed, 144 insertions(+), 63 deletions(-) diff --git a/buildenv/CMakeLists.txt b/buildenv/CMakeLists.txt index f8cf6a9..ba526f3 100644 --- a/buildenv/CMakeLists.txt +++ b/buildenv/CMakeLists.txt @@ -2,6 +2,7 @@ # cmake --build build\Cmake-Debug-x64 --config Debug # cmake -Sbuildenv -Bbuild\Cmake-Debug-x86 -DCMAKE_BUILD_TYPE=Debug -T host=x64 -A Win32 # cmake --build build\Cmake-Debug-x86 --config Debug +# cmake -Sbuildenv -Bbuild\Cmake-Release-ARM64 -DCMAKE_BUILD_TYPE=Release -DSIGNER_ISSUER:STRING="" -T host=x64 -A ARM64 # cmake -Sbuildenv -Bbuild\Cmake-Release-x64 -DCMAKE_BUILD_TYPE=Release -DSIGNER_CERT:STRING= -DSIGNER_PASS:STRING= # cmake --build build\Cmake-Release-x64 --config Release --target WinPinMenu-package-inst @@ -86,18 +87,12 @@ add_custom_command( add_dependencies(${MAIN_TARGET_NAME} ${MAIN_TARGET_NAME}-restore ${MAIN_TARGET_NAME}-vc) -install(FILES ${PRODUCT_LICENSE_FILE} CONFIGURATIONS Release DESTINATION ${INSTALL_DOCDIR}) -install(PROGRAMS "${CMAKE_BINARY_DIR}/../$-${TARGET_ARCH_ID}/${MAIN_TARGET_NAME}.exe" CONFIGURATIONS Release DESTINATION ${CMAKE_INSTALL_BINDIR}) +set(CPACK_INSTALLER_GENERATORS "ZIP" "INNOSETUP") +set(CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS + "bin/${MAIN_TARGET_NAME}.exe" "Source: \\\"bin\\\\${MAIN_TARGET_NAME}.exe\\\"\\; DestDir: \\\"{app}\\\\bin\\\"\\; Flags: restartreplace promptifolder") +set(CPACK_INNOSETUP_MENU_LINKS "bin\\\\${MAIN_TARGET_NAME}.exe" "${PRODUCT_NAME}") include(${CMAKE_CURRENT_LIST_DIR}/cpack/Package.cmake) -add_custom_command( - TARGET ${MAIN_TARGET_NAME}-package-inst POST_BUILD - COMMAND ${CMAKE_COMMAND} - -DSIGNER_ISSUER=${SIGNER_ISSUER} - -DSIGNER_CERT=${SIGNER_CERT} - -DSIGNER_PASS=${SIGNER_PASS} - -DTARGET="${CPACK_PACKAGE_DIRECTORY}/${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}.exe" - -P ${CMAKE_CURRENT_LIST_DIR}/cmake/SignTool.cmake - COMMENT "Signing ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}" -) +install(FILES ${PRODUCT_LICENSE_FILE} CONFIGURATIONS Release DESTINATION ${INSTALL_DOCDIR}) +install(PROGRAMS "${CMAKE_BINARY_DIR}/../$-${TARGET_ARCH_ID}/${MAIN_TARGET_NAME}.exe" CONFIGURATIONS Release DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/buildenv/Product.cmake b/buildenv/Product.cmake index bc9e30a..4f645b3 100644 --- a/buildenv/Product.cmake +++ b/buildenv/Product.cmake @@ -2,7 +2,8 @@ set(PRODUCT_VERSION_MAJOR 0) set(PRODUCT_VERSION_MINOR 1) set(PRODUCT_VERSION_PATCH 1) set(PRODUCT_NAME WinPinMenu) -set(PRODUCT_VERSION ${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}.${PRODUCT_VERSION_PATCH}.${BUILD_NUMBER}) +set(PRODUCT_TITLE "Pinnable Taskbar Menu") +set(PRODUCT_VERSION ${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}.${PRODUCT_VERSION_PATCH}) set(PRODUCT_VENDOR "diVISION") set(PRODUCT_DESCRIPTON "diVISION Pinnable Taskbar Menu For Windows") set(PRODUCT_MAINTANER "dimamizou@jasics.net") diff --git a/buildenv/cpack/Package.cmake b/buildenv/cpack/Package.cmake index 2321d7f..c31cfff 100644 --- a/buildenv/cpack/Package.cmake +++ b/buildenv/cpack/Package.cmake @@ -1,46 +1,128 @@ +if(NOT PRODUCT_NAME) + set(PRODUCT_NAME "${CMAKE_PROJECT_NAME}") +endif() +if(NOT PRODUCT_TITLE) + set(PRODUCT_TITLE "${CMAKE_PROJECT_NAME}") +endif() +if(NOT MAIN_TARGET_NAME) + set(MAIN_TARGET_NAME "${CMAKE_PROJECT_NAME}") +endif() +if(NOT TARGET_ARCH_ID) + set(TARGET_ARCH_ID "${CMAKE_SYSTEM_PROCESSOR}") +endif() + set(CPACK_PACKAGE_VENDOR "${PRODUCT_VENDOR}") set(CPACK_PACKAGE_CONTACT ${PRODUCT_MAINTANER}) +set(CPACK_PACKAGE_NAME "${PRODUCT_NAME}") if(DEFINED CPACK_SINGLE_TARGET_SYSTEM) set(CPACK_SYSTEM_NAME "${TARGET_ARCH_ID}") else() set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${TARGET_ARCH_ID}") endif() -set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PRODUCT_NAME}-${PROJECT_VERSION}") -set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PRODUCT_NAME}-${PROJECT_VERSION}") -set(CPACK_PACKAGE_EXECUTABLES ${MAIN_TARGET_NAME};${PRODUCT_NAME}) -set(CPACK_PACKAGE_DIRECTORY "${WORKSPACE_ROOT}/distr") - -file(TO_NATIVE_PATH ${PRODUCT_LICENSE_FILE} CPACK_RESOURCE_FILE_LICENSE) +set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PRODUCT_NAME}-${PRODUCT_VERSION}") +set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PRODUCT_NAME}-${PRODUCT_VERSION}") +set(CPACK_PACKAGE_EXECUTABLES ${MAIN_TARGET_NAME};${PRODUCT_TITLE}) +if(WORKSPACE_ROOT) + set(CPACK_PACKAGE_DIRECTORY "${WORKSPACE_ROOT}/distr") +endif() set(CPACK_PACKAGE_CHECKSUM "SHA256") set(CPACK_SOURCE_IGNORE_FILES "/thirdparty/[^/]+/(src|stamp|stage)/;/build/;/CVS/;/\\\\.svn/;/\\\\.bzr/;/\\\\.hg/;/\\\\.git/;\\\\.swp\$;\\\\.#;/#") + +if(PRODUCT_LICENSE_FILE) + file(TO_NATIVE_PATH ${PRODUCT_LICENSE_FILE} CPACK_RESOURCE_FILE_LICENSE) +endif() + if(${CMAKE_SYSTEM_NAME} MATCHES Windows) - STRING(REGEX REPLACE "\\\\" "\\\\\\\\" CPACK_RESOURCE_FILE_LICENSE "${CPACK_RESOURCE_FILE_LICENSE}") - file(TO_NATIVE_PATH "${MAIN_TARGET_RESOURCE_DIR}/app.ico" CPACK_PACKAGE_ICON) - STRING(REGEX REPLACE "\\\\" "\\\\\\\\" CPACK_PACKAGE_ICON "${CPACK_PACKAGE_ICON}") - set(CPACK_NSIS_MUI_ICON "${CPACK_PACKAGE_ICON}") - #set(CPACK_NSIS_MUI_UNIICON "${CPACK_PACKAGE_ICON}") - set(CPACK_NSIS_DISPLAY_NAME "${PRODUCT_NAME} ${PROJECT_VERSION}") - set(CPACK_INSTALLER_GENERATOR_ARG "-G" "ZIP\\;NSIS") + if(PRODUCT_LICENSE_FILE) + STRING(REGEX REPLACE "\\\\" "\\\\\\\\" CPACK_RESOURCE_FILE_LICENSE "${CPACK_RESOURCE_FILE_LICENSE}") + endif() + if(NOT CPACK_PACKAGE_ICON) + file(TO_NATIVE_PATH "${MAIN_TARGET_RESOURCE_DIR}/app.ico" CPACK_PACKAGE_ICON) + STRING(REGEX REPLACE "\\\\" "\\\\\\\\" CPACK_PACKAGE_ICON "${CPACK_PACKAGE_ICON}") + endif() + + if(NOT CPACK_INSTALLER_GENERATORS) + set(CPACK_INSTALLER_GENERATORS "ZIP" "NSIS") + endif() + + if("NSIS" IN_LIST CPACK_INSTALLER_GENERATORS) + message(STATUS "Configuring NSIS") + set(CPACK_NSIS_MUI_ICON "${CPACK_PACKAGE_ICON}") + #set(CPACK_NSIS_MUI_UNIICON "${CPACK_PACKAGE_ICON}") + set(CPACK_NSIS_DISPLAY_NAME "${PRODUCT_NAME} ${PRODUCT_VERSION}") + + else("INNOSETUP" IN_LIST CPACK_INSTALLER_GENERATORS) + message(STATUS "Configuring INNOSETUP") + find_program(ISCC_COMMAND iscc HINTS $ENV{INNOSETUP_HOME}) + if(ISCC_COMMAND) + set(CPACK_INNOSETUP_EXECUTABLE "${ISCC_COMMAND}") + endif() + string(TOLOWER ${TARGET_ARCH_ID} CPACK_INNOSETUP_ARCHITECTURE) + set(CPACK_INNOSETUP_ICON_FILE "${CPACK_PACKAGE_ICON}") + set(CPACK_INNOSETUP_SETUP_WizardSmallImageFile "compiler:WizClassicSmallImage.bmp") + set(CPACK_INNOSETUP_PROGRAM_MENU_FOLDER "${PRODUCT_TITLE}") + set(CPACK_INNOSETUP_DEFINE_MAIN_TARGET ${MAIN_TARGET_NAME}.exe) + set(CPACK_INNOSETUP_DEFINE_PRODUCT_NAME ${PRODUCT_NAME}) + set(CPACK_INNOSETUP_DEFINE_PRODUCT_TITLE ${PRODUCT_TITLE}) + set(CPACK_INNOSETUP_DEFINE_PRODUCT_VENDOR ${PRODUCT_VENDOR}) + set(CPACK_INNOSETUP_SETUP_AppName ${PRODUCT_TITLE}) + set(CPACK_INNOSETUP_SETUP_AppVerName "${PRODUCT_TITLE} ${PRODUCT_VERSION}") + set(CPACK_INNOSETUP_SETUP_UninstallDisplayName ${PRODUCT_TITLE}) + set(CPACK_INNOSETUP_SETUP_UninstallDisplayIcon "{app}\\\\bin\\\\${MAIN_TARGET_NAME}.exe") + set(CPACK_INNOSETUP_SETUP_VersionInfoVersion "${PRODUCT_VERSION}.${BUILD_NUMBER}") + set(CPACK_INNOSETUP_SETUP_VersionInfoTextVersion "${PRODUCT_VERSION}") + set(CPACK_INNOSETUP_SETUP_VersionInfoCompany "${PRODUCT_VENDOR}") + set(CPACK_INNOSETUP_SETUP_VersionInfoCopyright "${PROJECT_COPYRIGHT}") + + find_program(SIGNTOOL_COMMAND signtool) + if(SIGNTOOL_COMMAND) + if(SIGNER_ISSUER) + set(SIGNTOOL_OBJECT_ARG "/i $q${SIGNER_ISSUER}$q") + elseif(SIGNER_CERT) + set(SIGNTOOL_OBJECT_ARG "/f $q${SIGNER_CERT}$q") + endif() + if(SIGNER_PASS) + set(SIGNTOOL_PASS_ARG "/p ${SIGNER_PASS}") + endif() + if(SIGNTOOL_OBJECT_ARG) + set(CPACK_INNOSETUP_EXECUTABLE_ARGUMENTS + "\\\"/Sscripted=$q${SIGNTOOL_COMMAND}$q sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /v ${SIGNTOOL_OBJECT_ARG} ${SIGNTOOL_PASS_ARG} $f\\\"") + set(CPACK_INNOSETUP_SETUP_SignTool "scripted") + set(CPACK_INNOSETUP_SETUP_SignedUninstaller "yes") + endif() + endif() + endif() + elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin) - file(TO_NATIVE_PATH "${MAIN_TARGET_RESOURCE_DIR}/app.icns" CPACK_PACKAGE_ICON) - set(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE "ON") - set(CPACK_INSTALLER_GENERATOR_ARG "-G" "ZIP\\\;DragNDrop") + if(NOT CPACK_PACKAGE_ICON) + file(TO_NATIVE_PATH "${MAIN_TARGET_RESOURCE_DIR}/app.icns" CPACK_PACKAGE_ICON) + endif() + if(PRODUCT_LICENSE_FILE) + set(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE "ON") + endif() + if(NOT CPACK_INSTALLER_GENERATORS) + set(CPACK_INSTALLER_GENERATORS "ZIP" "DragNDrop") + endif() + elseif(${CMAKE_SYSTEM_NAME} MATCHES Linux) - set(CPACK_INSTALLER_GENERATORS "TGZ") - find_program(rpmbuild_Found rpmbuild) - if (rpmbuild_Found) - list(APPEND CPACK_INSTALLER_GENERATORS "RPM") - set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/postinst") - endif() - find_program(dpkg_Found dpkg) - if (dpkg_Found) - list(APPEND CPACK_INSTALLER_GENERATORS "DEB") - set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/postinst") - endif() - string(JOIN "\\\\;" CPACK_INSTALLER_GENERATOR_LIST ${CPACK_INSTALLER_GENERATORS}) - set(CPACK_INSTALLER_GENERATOR_ARG "-G" "${CPACK_INSTALLER_GENERATOR_LIST}") + if(NOT CPACK_INSTALLER_GENERATORS) + set(CPACK_INSTALLER_GENERATORS "TGZ") + find_program(rpmbuild_Found rpmbuild) + if (rpmbuild_Found) + list(APPEND CPACK_INSTALLER_GENERATORS "RPM") + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/postinst") + endif() + find_program(dpkg_Found dpkg) + if (dpkg_Found) + list(APPEND CPACK_INSTALLER_GENERATORS "DEB") + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/postinst") + endif() + endif() endif() +string(JOIN "\\\\;" CPACK_INSTALLER_GENERATOR_LIST ${CPACK_INSTALLER_GENERATORS}) +set(CPACK_INSTALLER_GENERATOR_ARG "-G" ${CPACK_INSTALLER_GENERATOR_LIST}) + include(CPack) add_custom_target(${MAIN_TARGET_NAME}-package-zip diff --git a/src/app/WinPinMenu.rc b/src/app/WinPinMenu.rc index 17af940..f21d593 100644 --- a/src/app/WinPinMenu.rc +++ b/src/app/WinPinMenu.rc @@ -96,26 +96,26 @@ END // Dialog // -IDD_ABOUTBOX DIALOGEX 0, 0, 242, 134 +IDD_ABOUTBOX DIALOGEX 0, 0, 236, 134 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTERMOUSE | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "About" FONT 9, "Segoe UI", 0, 0, 0x0 BEGIN - GROUPBOX "",IDC_STATIC,7,7,228,120 - DEFPUSHBUTTON "O&K",IDOK,179,106,50,14 - PUSHBUTTON "&Back To Menu",IDRETRY,122,106,50,14 - ICON IDR_MAINFRAME,IDC_STATIC,12,16,18,17,0,WS_EX_TRANSPARENT + GROUPBOX "",IDC_STATIC,7,7,165,63 + DEFPUSHBUTTON "O&K",IDOK,179,114,50,14 + PUSHBUTTON "&Back To Menu",IDRETRY,122,114,50,14 + ICON IDR_MAINFRAME,IDC_STATIC,12,16,20,20,0,WS_EX_TRANSPARENT LTEXT "Product Name",IDC_TXT_PRODUCTNAME,41,16,125,18,0,WS_EX_TRANSPARENT RTEXT "License",IDC_LNK_LICENSE,172,16,57,8,WS_TABSTOP,WS_EX_TRANSPARENT RTEXT "Company Name",IDC_TXT_COMPANYNAME,172,27,57,8,0,WS_EX_TRANSPARENT - LTEXT "File Description",IDC_TXT_FILEDESCRIPTION,12,40,217,22 - RTEXT "Version:",IDC_STATIC,12,68,51,8,0,WS_EX_TRANSPARENT - RTEXT "Module Version:",IDC_STATIC,12,79,51,8,0,WS_EX_TRANSPARENT - RTEXT "Copyright:",IDC_STATIC,12,89,51,8,0,WS_EX_TRANSPARENT - RTEXT "Release Notes",IDC_LNK_RELNOTES,172,68,57,8,WS_TABSTOP,WS_EX_TRANSPARENT - LTEXT "1.0.0.0",IDC_TXT_PRODUCTVERSION,70,68,96,8,0,WS_EX_TRANSPARENT - LTEXT "1.0.0.1",IDC_TXT_FILEVERSION,70,79,96,8,0,WS_EX_TRANSPARENT - LTEXT "Legal Copyright",IDC_TXT_LEGALCOPYRIGHT,70,89,96,8,0,WS_EX_TRANSPARENT + LTEXT "File Description",IDC_TXT_FILEDESCRIPTION,12,40,154,22 + RTEXT "Version:",IDC_STATIC,12,76,51,8,0,WS_EX_TRANSPARENT + RTEXT "Module Version:",IDC_STATIC,12,87,51,8,0,WS_EX_TRANSPARENT + RTEXT "Copyright:",IDC_STATIC,12,97,51,8,0,WS_EX_TRANSPARENT + RTEXT "Release Notes",IDC_LNK_RELNOTES,172,76,57,8,WS_TABSTOP,WS_EX_TRANSPARENT + LTEXT "1.0.0.0",IDC_TXT_PRODUCTVERSION,70,76,96,8,0,WS_EX_TRANSPARENT + LTEXT "1.0.0.1",IDC_TXT_FILEVERSION,70,87,96,8,0,WS_EX_TRANSPARENT + LTEXT "Legal Copyright",IDC_TXT_LEGALCOPYRIGHT,70,97,96,8,0,WS_EX_TRANSPARENT END @@ -130,7 +130,7 @@ BEGIN IDD_ABOUTBOX, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 235 + RIGHTMARGIN, 229 VERTGUIDE, 12 VERTGUIDE, 63 VERTGUIDE, 70 @@ -141,7 +141,8 @@ BEGIN BOTTOMMARGIN, 127 HORZGUIDE, 15 HORZGUIDE, 39 - HORZGUIDE, 68 + HORZGUIDE, 70 + HORZGUIDE, 76 HORZGUIDE, 120 END END diff --git a/src/app/app.manifest.in b/src/app/app.manifest.in index dbead88..c835987 100644 --- a/src/app/app.manifest.in +++ b/src/app/app.manifest.in @@ -1,6 +1,6 @@ - + ${PRODUCT_DESCRIPTON} diff --git a/src/app/buildnumber.txt b/src/app/buildnumber.txt index dc7b54a..72f523f 100644 --- a/src/app/buildnumber.txt +++ b/src/app/buildnumber.txt @@ -1 +1 @@ -33 \ No newline at end of file +39 \ No newline at end of file diff --git a/src/app/productmeta.h b/src/app/productmeta.h index 99b6426..316612a 100644 --- a/src/app/productmeta.h +++ b/src/app/productmeta.h @@ -4,8 +4,9 @@ #define PRODUCT_VERSION_MAJOR 0 #define PRODUCT_VERSION_MINOR 1 #define PRODUCT_VERSION_PATCH 1 -#define PRODUCT_VERSION_TWEAK 33 +#define PRODUCT_VERSION_TWEAK 39 #define PRODUCT_NAME _T("WinPinMenu\0") +#define PRODUCT_TITLE _T("Pinnable Taskbar Menu\0") #define PRODUCT_DESCRIPTION _T("diVISION Pinnable Taskbar Menu For Windows\0") #define PRODUCT_HOMEPAGE_URL _T("https://github.com/hatelamers/WinPinMenu\0") #define PRODUCT_VENDOR _T("diVISION\0") @@ -19,5 +20,5 @@ #define FILE_NAME _T("WinPinMenu\0") #define FILE_DESCRIPTION _T("diVISION Pinnable Taskbar Menu For Windows\0") -#define FILE_VERSION 0,1,1,33 -#define FILE_VERSION_S _T("0.1.1.33\0") +#define FILE_VERSION 0,1,1,39 +#define FILE_VERSION_S _T("0.1.1.39\0") diff --git a/src/app/productmeta.h.in b/src/app/productmeta.h.in index b394a93..0f4c464 100644 --- a/src/app/productmeta.h.in +++ b/src/app/productmeta.h.in @@ -6,6 +6,7 @@ #define PRODUCT_VERSION_PATCH ${PRODUCT_VERSION_PATCH} #define PRODUCT_VERSION_TWEAK ${BUILD_NUMBER} #define PRODUCT_NAME _T("${PRODUCT_NAME}\0") +#define PRODUCT_TITLE _T("${PRODUCT_TITLE}\0") #define PRODUCT_DESCRIPTION _T("${PRODUCT_DESCRIPTON}\0") #define PRODUCT_HOMEPAGE_URL _T("${PRODUCT_HOMEPAGE_URL}\0") #define PRODUCT_VENDOR _T("${PRODUCT_VENDOR}\0") diff --git a/src/app/res/app.manifest b/src/app/res/app.manifest index b379ef5..aaa0996 100644 --- a/src/app/res/app.manifest +++ b/src/app/res/app.manifest @@ -1,6 +1,6 @@ - + diVISION Pinnable Taskbar Menu For Windows