From 4d661e3a92b09362d4749af24e1cac79071adcfb Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Mar 2024 15:57:27 -0500 Subject: cmMakefile: Reduce GetModulesFile caller allocations --- Source/cmMakefile.cxx | 4 ++-- Source/cmMakefile.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bd24f83..ba9fab5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3906,8 +3906,8 @@ void cmMakefile::DisplayStatus(const std::string& message, float s) const #endif } -std::string cmMakefile::GetModulesFile(const std::string& filename, - bool& system, bool debug, +std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system, + bool debug, std::string& debugBuffer) const { std::string result; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e5edbae..ea0b4c6 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -803,7 +803,7 @@ public: /** * Return a location of a file in cmake or custom modules directory */ - std::string GetModulesFile(const std::string& name) const + std::string GetModulesFile(cm::string_view name) const { bool system; std::string debugBuffer; @@ -813,13 +813,13 @@ public: /** * Return a location of a file in cmake or custom modules directory */ - std::string GetModulesFile(const std::string& name, bool& system) const + std::string GetModulesFile(cm::string_view name, bool& system) const { std::string debugBuffer; return this->GetModulesFile(name, system, false, debugBuffer); } - std::string GetModulesFile(const std::string& name, bool& system, bool debug, + std::string GetModulesFile(cm::string_view name, bool& system, bool debug, std::string& debugBuffer) const; //! Set/Get a property of this directory -- cgit v0.12 From 438809d3ba074356a641f0a1665a8c3b6117648e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Mar 2024 16:00:11 -0500 Subject: cmCPackGenerator: Add option to FindTemplate to use alternate builtin path --- Source/CPack/cmCPackGenerator.cxx | 10 ++++++---- Source/CPack/cmCPackGenerator.h | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 8f72ceb..b7786d3 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -7,6 +7,8 @@ #include #include +#include + #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" @@ -1315,17 +1317,17 @@ const char* cmCPackGenerator::GetPackagingInstallPrefix() return this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX")->c_str(); } -std::string cmCPackGenerator::FindTemplate(const char* name) +std::string cmCPackGenerator::FindTemplate(cm::string_view name, + cm::optional alt) { cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Look for template: " << (name ? name : "(NULL)") - << std::endl); + "Look for template: " << name << std::endl); // Search CMAKE_MODULE_PATH for a custom template. std::string ffile = this->MakefileMap->GetModulesFile(name); if (ffile.empty()) { // Fall back to our internal builtin default. ffile = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/Internal/CPack/", - name); + alt ? *alt : ""_s, name); cmSystemTools::ConvertToUnixSlashes(ffile); if (!cmSystemTools::FileExists(ffile)) { ffile.clear(); diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 8078d9f..223b720 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -9,6 +9,9 @@ #include #include +#include +#include + #include "cm_sys_stat.h" #include "cmCPackComponentGroup.h" @@ -179,7 +182,8 @@ protected: virtual const char* GetInstallPath(); virtual const char* GetPackagingInstallPrefix(); - virtual std::string FindTemplate(const char* name); + std::string FindTemplate(cm::string_view name, + cm::optional alt = cm::nullopt); virtual bool ConfigureFile(const std::string& inName, const std::string& outName, bool copyOnly = false); -- cgit v0.12 From d2f4836f8ed1144aa6f2883953e9db658211afe2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 21 Mar 2024 16:40:27 -0400 Subject: CPack/WIX: Prepare to provide version-specific WiX templates Move our template for WiX Toolset v3 to a versioned location. --- Modules/Internal/CPack/WIX-v3/WIX.template.in | 53 +++++++++++++++++++++++++++ Modules/Internal/CPack/WIX.template.in | 53 --------------------------- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 6 ++- 3 files changed, 58 insertions(+), 54 deletions(-) create mode 100644 Modules/Internal/CPack/WIX-v3/WIX.template.in delete mode 100644 Modules/Internal/CPack/WIX.template.in diff --git a/Modules/Internal/CPack/WIX-v3/WIX.template.in b/Modules/Internal/CPack/WIX-v3/WIX.template.in new file mode 100644 index 0000000..95ba7fa --- /dev/null +++ b/Modules/Internal/CPack/WIX-v3/WIX.template.in @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + ProductIcon.ico + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Internal/CPack/WIX.template.in b/Modules/Internal/CPack/WIX.template.in deleted file mode 100644 index 95ba7fa..0000000 --- a/Modules/Internal/CPack/WIX.template.in +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - ProductIcon.ico - - - - - - - - - - - - - - - - - - - - diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 3cc09da..9a1d335 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -635,9 +635,13 @@ std::string cmCPackWIXGenerator::GetRootFolderId() const bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate() { - std::string wixTemplate = FindTemplate("WIX.template.in"); + std::string wixTemplate; if (cmValue wixtpl = GetOption("CPACK_WIX_TEMPLATE")) { wixTemplate = *wixtpl; + } else { + cm::optional alt; + alt = "WIX-v3/"_s; + wixTemplate = FindTemplate("WIX.template.in"_s, alt); } if (wixTemplate.empty()) { -- cgit v0.12 From 54d09a2b3fc4da6f0b01a143f7dc1bd67e675d1b Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 20 Mar 2024 17:15:20 -0400 Subject: CPack/WIX: Document WiX Toolset v3 tools Add a dedicated section describing the `candle` and `light` tools. Also improve formatting of some variables' documentation. --- Help/cpack_gen/wix.rst | 75 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 23 deletions(-) diff --git a/Help/cpack_gen/wix.rst b/Help/cpack_gen/wix.rst index cb56c9d..4b627e7 100644 --- a/Help/cpack_gen/wix.rst +++ b/Help/cpack_gen/wix.rst @@ -1,10 +1,43 @@ CPack WIX Generator ------------------- -CPack WIX generator specific options +Use the `WiX Toolset`_ to produce a Windows Installer ``.msi`` database. + +.. _`WiX Toolset`: https://wixtoolset.org/ .. versionadded:: 3.7 - Support :variable:`CPACK_COMPONENT__DISABLED` variable. + The :variable:`CPACK_COMPONENT__DISABLED` variable is now + supported. + +WiX Toolset v3 +^^^^^^^^^^^^^^ + +Packaging is performed using the following tools: + +``candle`` + Compiles WiX source files into ``.wixobj`` files. + + Invocations may be customized using tool-specific variables: + + * :variable:`CPACK_WIX_CANDLE_EXTENSIONS _EXTENSIONS>` + * :variable:`CPACK_WIX_CANDLE_EXTRA_FLAGS _EXTRA_FLAGS>` + +``light`` + Links ``.wixobj`` files into a Windows Installer ``.msi`` database. + + Invocations may be customized using tool-specific variables: + + * :variable:`CPACK_WIX_LIGHT_EXTENSIONS _EXTENSIONS>` + * :variable:`CPACK_WIX_LIGHT_EXTRA_FLAGS _EXTRA_FLAGS>` + +CPack invokes both tools as needed. Intermediate ``.wixobj`` files +are considered implementation details. + +WiX extensions must be named with the form ``WixExtension``. + +CPack expects the above tools to be available for command-line +use via the ``PATH``. Or, if the ``WIX`` environment variable is set, +CPack looks for the tools in ``%WIX%`` and ``%WIX%\bin``. Variables specific to CPack WIX generator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -68,8 +101,8 @@ Windows using WiX. .. variable:: CPACK_WIX_UI_REF - This variable allows you to override the Id of the ```` element - in the WiX template. + Specify the WiX ``UI`` extension's dialog set. + This is the Id of the ```` element in the default WiX template. The default is ``WixUI_InstallDir`` in case no CPack components have been defined and ``WixUI_FeatureTree`` otherwise. @@ -107,7 +140,7 @@ Windows using WiX. Language(s) of the installer - Languages are compiled into the WixUI extension library. To use them, + Languages are compiled into the Wix ``UI`` extension library. To use them, simply provide the name of the culture. If you specify more than one culture identifier in a comma or semicolon delimited list, the first one that is found will be used. You can find a list of supported languages at: @@ -196,39 +229,35 @@ Windows using WiX. Extra WiX source files - This variable provides an optional list of extra WiX source files (.wxs) - that should be compiled and linked. The full path to source files is - required. + This variable provides an optional list of extra WiX source files (``.wxs``) + that should be compiled and linked. The paths must be absolute. .. variable:: CPACK_WIX_EXTRA_OBJECTS - Extra WiX object files or libraries + Extra WiX object files or libraries. - This variable provides an optional list of extra WiX object (.wixobj) - and/or WiX library (.wixlib) files. The full path to objects and libraries - is required. + This variable provides an optional list of extra WiX object (``.wixobj``) + and/or WiX library (``.wixlib``) files. The paths must be absolute. .. variable:: CPACK_WIX_EXTENSIONS - This variable provides a list of additional extensions for the WiX - tools light and candle. + Specify a list of additional extensions for WiX tools. + See `WiX Toolset v3`_ for extension naming patterns. .. variable:: CPACK_WIX__EXTENSIONS - This is the tool specific version of CPACK_WIX_EXTENSIONS. - ```` can be either LIGHT or CANDLE. + Specify a list of additional extensions for a specific WiX tool. + See `WiX Toolset v3`_ for possible ```` names. .. variable:: CPACK_WIX__EXTRA_FLAGS - This list variable allows you to pass additional - flags to the WiX tool ````. + Specify a list of additional command-line flags for a specific WiX tool. + See `WiX Toolset v3`_ for possible ```` names. Use it at your own risk. Future versions of CPack may generate flags which may be in conflict with your own flags. - ```` can be either LIGHT or CANDLE. - .. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY If this variable is set the generated installer will create @@ -326,9 +355,9 @@ Windows using WiX. .. versionadded:: 3.23 - If this variable is set then the inclusion of WixUIExtensions is skipped, - i.e. the ``-ext "WixUIExtension"`` command line is not included during - the execution of the WiX light tool. + If this variable is set to true, the default inclusion of the WiX ``UI`` + extension is skipped, i.e., the ``-ext WixUIExtension`` flag is not + passed to WiX tools. .. variable:: CPACK_WIX_ARCHITECTURE -- cgit v0.12 From ac25c645a75f120d15f1399665d0627f41ebb435 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 19 Mar 2024 14:05:55 -0400 Subject: CPack/WIX: Improve formatting of CPACK_WIX_CUSTOM_XMLNS expansion --- Modules/Internal/CPack/WIX-v3/WIX.template.in | 2 +- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Modules/Internal/CPack/WIX-v3/WIX.template.in b/Modules/Internal/CPack/WIX-v3/WIX.template.in index 95ba7fa..71ec5b2 100644 --- a/Modules/Internal/CPack/WIX-v3/WIX.template.in +++ b/Modules/Internal/CPack/WIX-v3/WIX.template.in @@ -2,7 +2,7 @@ - Date: Tue, 19 Mar 2024 14:35:36 -0400 Subject: CPack/WIX: Remove "candle" from tool-agnostic error message --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 306dbcb..b1bb0ca 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -74,7 +74,7 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command) if (!status || returnValue) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running WiX candle. " + "Problem running WiX. " "Please check '" << logFileName << "' for errors." << std::endl); -- cgit v0.12