From f2f4e66f64c5bd574fd868af928bdd6ee39cfc86 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 7 Oct 2021 22:56:44 +0200 Subject: CPackIFW: Add support for RunProgram* config variables This patch adds support for specifying , , and in the IFW configuration file. --- Help/cpack_gen/ifw.rst | 28 +++++++++++++++++++ Help/release/dev/cpackifw-package-run-program.rst | 10 +++++++ Source/CPack/IFW/cmCPackIFWInstaller.cxx | 33 +++++++++++++++++++++++ Source/CPack/IFW/cmCPackIFWInstaller.h | 11 ++++++++ 4 files changed, 82 insertions(+) create mode 100644 Help/release/dev/cpackifw-package-run-program.rst diff --git a/Help/cpack_gen/ifw.rst b/Help/cpack_gen/ifw.rst index 4eb6095..6b8bc26 100644 --- a/Help/cpack_gen/ifw.rst +++ b/Help/cpack_gen/ifw.rst @@ -264,6 +264,34 @@ Package This feature is available for QtIFW 4.0.0 or newer. +.. variable:: CPACK_IFW_PACKAGE_RUN_PROGRAM + + .. versionadded:: 3.23 + + Command executed after the installer is done if the user accepts the action. + Provide the full path to the application. + + This feature is available for QtIFW 4.0.0 and newer. + +.. variable:: CPACK_IFW_PACKAGE_RUN_PROGRAM_ARGUMENTS + + .. versionadded:: 3.23 + + List of arguments passed to the program specified in + :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM`. + + This feature is available for QtIFW 4.0.0 and newer. + +.. variable:: CPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTION + + .. versionadded:: 3.23 + + Text shown next to the check box for running the program after the + installation. If :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM` is set but no + description provided, the UI will display ``Run now``. instead. + + This feature is available for QtIFW 4.0.0 and newer. + Components """""""""" diff --git a/Help/release/dev/cpackifw-package-run-program.rst b/Help/release/dev/cpackifw-package-run-program.rst new file mode 100644 index 0000000..5d6f1b2 --- /dev/null +++ b/Help/release/dev/cpackifw-package-run-program.rst @@ -0,0 +1,10 @@ + +cpackifw-package-run-program +---------------------------- + +* The :cpack_gen:`CPack IFW Generator` gained the new + :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM`, + :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM_ARGUMENTS`, and + :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTION` variables for executing + a command after the installer is done if the user accepts the action. + This feature is available for QtIFW 4.0 and newer. diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 0948a84..a94ca48 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -292,6 +292,20 @@ void cmCPackIFWInstaller::ConfigureFromOptions() this->ProductImages.clear(); cmExpandList(productImages, this->ProductImages); } + + // Run program, run program arguments, and run program description + if (cmValue program = this->GetOption("CPACK_IFW_PACKAGE_RUN_PROGRAM")) { + this->RunProgram = *program; + } + if (cmValue arguments = + this->GetOption("CPACK_IFW_PACKAGE_RUN_PROGRAM_ARGUMENTS")) { + this->RunProgramArguments.clear(); + cmExpandList(arguments, this->RunProgramArguments); + } + if (cmValue description = + this->GetOption("CPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTION")) { + this->RunProgramDescription = *description; + } } /** \class cmCPackIFWResourcesParser @@ -542,6 +556,25 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout.Element("DisableCommandLineInterface", this->DisableCommandLineInterface); } + + // RunProgram + if (!this->RunProgram.empty()) { + xout.Element("RunProgram", this->RunProgram); + } + + // RunProgramArguments + if (!this->RunProgramArguments.empty()) { + xout.StartElement("RunProgramArguments"); + for (const auto& arg : this->RunProgramArguments) { + xout.Element("Argument", arg); + } + xout.EndElement(); + } + + // RunProgramDescription + if (!this->RunProgramDescription.empty()) { + xout.Element("RunProgramDescription", this->RunProgramDescription); + } } if (!this->RemoveTargetDir.empty()) { diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 047f287..0ace099 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -124,6 +124,17 @@ public: /// A list of images to be shown on PerformInstallationPage. std::vector ProductImages; + /// Command executed after the installer is done if the user accepts the + /// action + std::string RunProgram; + + /// Arguments passed to the program specified in + std::vector RunProgramArguments; + + /// Text shown next to the check box for running the program after the + /// installation + std::string RunProgramDescription; + public: // Internal implementation -- cgit v0.12