[Installer] Make the Inno Setup installer the default, with its failure hook.

COCKATRICE_WIN_INSTALLER now defaults to InnoSetup. NSIS stays selectable for
one release as the legacy fallback, and the two can still be built from one
tree and compared on a real upgrade.

The switches question from the previous commit is settled from Inno Setup's
source: the setup command line is an if/else-if chain over the switches it
knows, with no fallback that rejects the rest, so /R, /PID= and /D= are
ignored rather than refused. The client therefore sends one command line that
drives either installer:

- /R and /PID= for NSIS, which also needs /D= last and unquoted;
- /VERYSILENT and the CloseApplications set for Setup, which releases the
  mapped runtime DLLs through Restart Manager instead of waiting for a pid;
- /UPDATER as the client's own mark, read only by the Inno Setup script.

An older client that passes only the NSIS switches still installs; it walks
the wizard once instead of running silently.

The Sentry offer that AbortInstall carried is ported: a silent run the updater
launched, which began replacing files and never reached the end, offers to
send its log through the same helper. The helper is embedded with a [Files]
dontcopy entry and extracted at send time; a repeated [Files] section merges
with the generated one instead of being a compile error. Setup prefixes every
log line with a timestamp, so the helper's ABORT scan now allows that prefix.

CI installs Inno Setup next to NSIS, dumps ISCCOutput.log and the generated
script when the installer fails to compile, and --package NSIS|InnoSetup
selects the installer through the CMake option instead of adding a second
CPack generator to the run.
This commit is contained in:
Lukas Brübach 2026-10-26 08:29:22 +01:00
parent 2c8e47a0a4
commit 0403ac9354
8 changed files with 220 additions and 73 deletions

View file

@ -1,9 +1,9 @@
# Windows installer written by Inno Setup, through CPack's own InnoSetup generator.
#
# Included from the WIN32 branch of the top-level CMakeLists.txt when
# COCKATRICE_WIN_INSTALLER is InnoSetup. It sits next to the NSIS template rather than
# replacing it so both installers can be built from the same tree and compared on a real
# upgrade.
# COCKATRICE_WIN_INSTALLER is InnoSetup, which is the default. The NSIS template is kept
# next to this file rather than deleted so both installers can still be built from one tree
# and compared on a real upgrade.
#
# The generator writes [Files], [Dirs], [Icons], [Run] and [Registry] from the install()
# rules the project already declares, so nothing here repeats them. What is added is only
@ -17,8 +17,10 @@ if(CMAKE_VERSION VERSION_LESS 3.27)
message(FATAL_ERROR "COCKATRICE_WIN_INSTALLER=InnoSetup needs CMake >= 3.27 (found ${CMAKE_VERSION})")
endif()
# CPack is allowed to be told -DCPACK_GENERATOR=... by the caller; do not list the
# generator twice when that caller already asked for it.
# CPack may be told -DCPACK_GENERATOR=... by the caller. For the Windows installers the
# choice is made by COCKATRICE_WIN_INSTALLER instead (.ci/compile.sh --package NSIS or
# InnoSetup maps to it), because picking the generator here and the installer tool there can
# silently build both in one run. Only guard against asking for InnoSetup twice.
if(NOT "InnoSetup" IN_LIST CPACK_GENERATOR)
set(CPACK_GENERATOR InnoSetup ${CPACK_GENERATOR})
endif()
@ -89,4 +91,13 @@ set(CPACK_INNOSETUP_SETUP_UninstallDisplayIcon "{app}\\cockatrice.exe")
set(CPACK_INNOSETUP_EXTRA_SCRIPTS "${COCKATRICE_CMAKE_PATH}/InnoSetup.install.iss")
set(CPACK_INNOSETUP_CODE_FILES "${COCKATRICE_CMAKE_PATH}/InnoSetup.code.iss")
# The installer-log sender the failure hook in InnoSetup.code.iss offers after an upgrade
# that did not finish. CPack passes these as public ISCC macros (/Dname=value), so the extra
# script can embed the helper with a [Files] dontcopy entry and the code can extract it at
# send time. Undefined when the build carries no reporting, which is what the ifdef guards in
# both scripts test.
if(CPACK_SENTRY_ENABLED)
set(CPACK_INNOSETUP_DEFINE_SentryHelperPath "${COCKATRICE_SENTRY_INSTALLER_LOG}")
endif()
message(STATUS "Windows installer: Inno Setup (CPack InnoSetup generator, ${CPACK_INNOSETUP_ARCHITECTURE})")