Skip to content

Commit

Permalink
#15 migrated installer to Inno Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
hatelamers committed Dec 5, 2024
1 parent 17eb122 commit 452aa80
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 63 deletions.
19 changes: 7 additions & 12 deletions buildenv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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="<ISSUER_CN>" -T host=x64 -A ARM64
# cmake -Sbuildenv -Bbuild\Cmake-Release-x64 -DCMAKE_BUILD_TYPE=Release -DSIGNER_CERT:STRING=<CERT_PATH> -DSIGNER_PASS:STRING=<CERT_PASSWORD>
# cmake --build build\Cmake-Release-x64 --config Release --target WinPinMenu-package-inst

Expand Down Expand Up @@ -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}/../$<CONFIG>-${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}/../$<CONFIG>-${TARGET_ARCH_ID}/${MAIN_TARGET_NAME}.exe" CONFIGURATIONS Release DESTINATION ${CMAKE_INSTALL_BINDIR})
3 changes: 2 additions & 1 deletion buildenv/Product.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
140 changes: 111 additions & 29 deletions buildenv/cpack/Package.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
31 changes: 16 additions & 15 deletions src/app/WinPinMenu.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -130,7 +130,7 @@ BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 235
RIGHTMARGIN, 229
VERTGUIDE, 12
VERTGUIDE, 63
VERTGUIDE, 70
Expand All @@ -141,7 +141,8 @@ BEGIN
BOTTOMMARGIN, 127
HORZGUIDE, 15
HORZGUIDE, 39
HORZGUIDE, 68
HORZGUIDE, 70
HORZGUIDE, 76
HORZGUIDE, 120
END
END
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.manifest.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity processorArchitecture="*" type="win32" name="${PRODUCT_IDENTIFIER}" version="${PRODUCT_VERSION}"/>
<assemblyIdentity processorArchitecture="*" type="win32" name="${PRODUCT_IDENTIFIER}" version="${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}.${PRODUCT_VERSION_PATCH}.${BUILD_NUMBER}"/>
<description>${PRODUCT_DESCRIPTON}</description>
<dependency>
<dependentAssembly>
Expand Down
2 changes: 1 addition & 1 deletion src/app/buildnumber.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
33
39
7 changes: 4 additions & 3 deletions src/app/productmeta.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
1 change: 1 addition & 0 deletions src/app/productmeta.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/app/res/app.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity processorArchitecture="*" type="win32" name="winpinmenu" version="0.1.1.32"/>
<assemblyIdentity processorArchitecture="*" type="win32" name="winpinmenu" version="0.1.1.38"/>
<description>diVISION Pinnable Taskbar Menu For Windows</description>
<dependency>
<dependentAssembly>
Expand Down

0 comments on commit 452aa80

Please sign in to comment.