summaryrefslogtreecommitdiffstats
path: root/Source/CPack/WiX
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CPack/WiX')
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx56
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h6
-rw-r--r--Source/CPack/WiX/cmWIXAccessControlList.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXAccessControlList.h4
-rw-r--r--Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h2
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.h2
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.cxx14
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.h2
-rw-r--r--Source/CPack/WiX/cmWIXPatch.cxx8
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.cxx30
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.h10
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.h4
-rw-r--r--Source/CPack/WiX/cmWIXShortcut.h2
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.h4
17 files changed, 92 insertions, 66 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 2bccf2e..274dfd0 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -2,14 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackWIXGenerator.h"
-#include <CPack/cmCPackComponentGroup.h>
-#include <CPack/cmCPackLog.h>
+#include "cmCPackComponentGroup.h"
+#include "cmCPackLog.h"
+#include "cmCryptoHash.h"
+#include "cmGeneratedFileStream.h"
+#include "cmInstalledFile.h"
+#include "cmSystemTools.h"
+#include "cmUuid.h"
#include <algorithm>
-#include <cmCryptoHash.h>
-#include <cmGeneratedFileStream.h>
-#include <cmInstalledFile.h>
-#include <cmSystemTools.h>
-#include <cmUuid.h>
#include "cmWIXDirectoriesSourceWriter.h"
#include "cmWIXFeaturesSourceWriter.h"
@@ -17,10 +17,10 @@
#include "cmWIXRichTextFormatWriter.h"
#include "cmWIXSourceWriter.h"
-#include <cmsys/Directory.hxx>
-#include <cmsys/Encoding.hxx>
-#include <cmsys/FStream.hxx>
-#include <cmsys/SystemTools.hxx>
+#include "cmsys/Directory.hxx"
+#include "cmsys/Encoding.hxx"
+#include "cmsys/FStream.hxx"
+#include "cmsys/SystemTools.hxx"
#include <rpc.h> // for GUID generation
@@ -437,8 +437,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
directoryDefinitions.AddAttribute("Name", "SourceDir");
size_t installRootSize =
- directoryDefinitions.BeginInstallationPrefixDirectory(
- GetProgramFilesFolderId(), installRoot);
+ directoryDefinitions.BeginInstallationPrefixDirectory(GetRootFolderId(),
+ installRoot);
std::string fileDefinitionsFilename = this->CPackTopLevel + "/files.wxs";
@@ -570,16 +570,26 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
return this->Patch->CheckForUnappliedFragments();
}
-std::string cmCPackWIXGenerator::GetProgramFilesFolderId() const
+std::string cmCPackWIXGenerator::GetRootFolderId() const
{
if (cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) {
return "";
}
+
+ std::string result = "ProgramFiles<64>Folder";
+
+ const char* rootFolderId = GetOption("CPACK_WIX_ROOT_FOLDER_ID");
+ if (rootFolderId) {
+ result = rootFolderId;
+ }
+
if (GetArchitecture() == "x86") {
- return "ProgramFilesFolder";
+ cmSystemTools::ReplaceString(result, "<64>", "");
} else {
- return "ProgramFiles64Folder";
+ cmSystemTools::ReplaceString(result, "<64>", "64");
}
+
+ return result;
}
bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
@@ -667,10 +677,10 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
cpackPackageDesktopLinksList);
}
- AddDirectoryAndFileDefinitons(rootPath, "INSTALL_ROOT", directoryDefinitions,
- fileDefinitions, featureDefinitions,
- cpackPackageExecutablesList,
- cpackPackageDesktopLinksList, shortcuts);
+ AddDirectoryAndFileDefinitions(
+ rootPath, "INSTALL_ROOT", directoryDefinitions, fileDefinitions,
+ featureDefinitions, cpackPackageExecutablesList,
+ cpackPackageDesktopLinksList, shortcuts);
featureDefinitions.EndElement("FeatureRef");
@@ -831,7 +841,7 @@ bool cmCPackWIXGenerator::CreateLicenseFile()
return true;
}
-void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
+void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions(
std::string const& topdir, std::string const& directoryId,
cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXFilesSourceWriter& fileDefinitions,
@@ -896,12 +906,12 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", subDirectoryId);
directoryDefinitions.AddAttribute("Name", fileName);
+ this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions);
- AddDirectoryAndFileDefinitons(
+ AddDirectoryAndFileDefinitions(
fullPath, subDirectoryId, directoryDefinitions, fileDefinitions,
featureDefinitions, packageExecutables, desktopExecutables, shortcuts);
- this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions);
directoryDefinitions.EndElement("Directory");
} else {
cmInstalledFile const* installedFile = this->GetInstalledFile(
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index fc0994c..b2633a7 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackWIXGenerator_h
#define cmCPackWIXGenerator_h
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
#include "cmWIXPatch.h"
#include "cmWIXShortcut.h"
@@ -65,7 +65,7 @@ private:
bool CreateWiXSourceFiles();
- std::string GetProgramFilesFolderId() const;
+ std::string GetRootFolderId() const;
bool GenerateMainSourceFileFromTemplate();
@@ -104,7 +104,7 @@ private:
bool RunLightCommand(std::string const& objectFiles);
- void AddDirectoryAndFileDefinitons(
+ void AddDirectoryAndFileDefinitions(
std::string const& topdir, std::string const& directoryId,
cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXFilesSourceWriter& fileDefinitions,
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx
index 9f9b39c..744a932 100644
--- a/Source/CPack/WiX/cmWIXAccessControlList.cxx
+++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXAccessControlList.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
-#include <cmSystemTools.h>
+#include "cmSystemTools.h"
cmWIXAccessControlList::cmWIXAccessControlList(
cmCPackLog* logger, cmInstalledFile const& installedFile,
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.h b/Source/CPack/WiX/cmWIXAccessControlList.h
index 0a25ee5..2a23f2f 100644
--- a/Source/CPack/WiX/cmWIXAccessControlList.h
+++ b/Source/CPack/WiX/cmWIXAccessControlList.h
@@ -5,8 +5,8 @@
#include "cmWIXSourceWriter.h"
-#include <CPack/cmCPackLog.h>
-#include <cmInstalledFile.h>
+#include "cmCPackLog.h"
+#include "cmInstalledFile.h"
class cmWIXAccessControlList
{
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
index 062efe3..8233331 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
@@ -5,7 +5,7 @@
#include "cmWIXSourceWriter.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
#include <string>
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
index 79a9fdd..0be4377 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
@@ -44,6 +44,8 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
AddAttributeUnlessEmpty("Title", group.DisplayName);
AddAttributeUnlessEmpty("Description", group.Description);
+ patch.ApplyFragment("CM_G_" + group.Name, *this);
+
for (std::vector<cmCPackComponentGroup*>::const_iterator i =
group.Subgroups.begin();
i != group.Subgroups.end(); ++i) {
@@ -56,8 +58,6 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
EmitFeatureForComponent(**i, patch);
}
- patch.ApplyFragment("CM_G_" + group.Name, *this);
-
EndElement("Feature");
}
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
index 368b250..e751ca7 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
@@ -6,7 +6,7 @@
#include "cmWIXPatch.h"
#include "cmWIXSourceWriter.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
/** \class cmWIXFeaturesSourceWriter
* \brief Helper class to generate features.wxs
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
index a471d26..b4cd1a3 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
@@ -4,14 +4,12 @@
#include "cmWIXAccessControlList.h"
-#include <cmInstalledFile.h>
+#include "cmInstalledFile.h"
-#include <cmSystemTools.h>
-#include <cmUuid.h>
+#include "cmSystemTools.h"
+#include "cmUuid.h"
-#include <sys/types.h>
-// include sys/stat.h after sys/types.h
-#include <sys/stat.h>
+#include "cm_sys_stat.h"
cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger,
std::string const& filename,
@@ -138,6 +136,7 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
}
}
+ patch.ApplyFragment(componentId, *this);
BeginElement("File");
AddAttribute("Id", fileId);
AddAttribute("Source", filePath);
@@ -149,16 +148,15 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
if (!(fileMode & S_IWRITE)) {
AddAttribute("ReadOnly", "yes");
}
+ patch.ApplyFragment(fileId, *this);
if (installedFile) {
cmWIXAccessControlList acl(Logger, *installedFile, *this);
acl.Apply();
}
- patch.ApplyFragment(fileId, *this);
EndElement("File");
- patch.ApplyFragment(componentId, *this);
EndElement("Component");
EndElement("DirectoryRef");
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
index d7a642d..dc9c636 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
@@ -8,7 +8,7 @@
#include "cmWIXPatch.h"
#include "cmWIXShortcut.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
/** \class cmWIXFilesSourceWriter
* \brief Helper class to generate files.wxs
diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx
index 7c48653..287a644 100644
--- a/Source/CPack/WiX/cmWIXPatch.cxx
+++ b/Source/CPack/WiX/cmWIXPatch.cxx
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXPatch.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
cmWIXPatch::cmWIXPatch(cmCPackLog* logger)
: Logger(logger)
@@ -29,7 +29,11 @@ void cmWIXPatch::ApplyFragment(std::string const& id,
return;
const cmWIXPatchElement& fragment = i->second;
-
+ for (cmWIXPatchElement::attributes_t::const_iterator attr_i =
+ fragment.attributes.begin();
+ attr_i != fragment.attributes.end(); ++attr_i) {
+ writer.AddAttribute(attr_i->first, attr_i->second);
+ }
this->ApplyElementChildren(fragment, writer);
Fragments.erase(i);
diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx
index 47f98d1..0dcc74a 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.cxx
+++ b/Source/CPack/WiX/cmWIXPatchParser.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXPatchParser.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
-#include <cm_expat.h>
+#include "cm_expat.h"
cmWIXPatchNode::Type cmWIXPatchText::type()
{
@@ -72,9 +72,11 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char** atts)
void cmWIXPatchParser::StartFragment(const char** attributes)
{
+ cmWIXPatchElement* new_element = CM_NULLPTR;
+ /* find the id of for fragment */
for (size_t i = 0; attributes[i]; i += 2) {
- std::string key = attributes[i];
- std::string value = attributes[i + 1];
+ const std::string key = attributes[i];
+ const std::string value = attributes[i + 1];
if (key == "Id") {
if (Fragments.find(value) != Fragments.end()) {
@@ -83,10 +85,22 @@ void cmWIXPatchParser::StartFragment(const char** attributes)
ReportValidationError(tmp.str());
}
- ElementStack.push_back(&Fragments[value]);
- } else {
- ReportValidationError(
- "The only allowed 'CPackWixFragment' attribute is 'Id'");
+ new_element = &Fragments[value];
+ ElementStack.push_back(new_element);
+ }
+ }
+
+ /* add any additional attributes for the fragement */
+ if (!new_element) {
+ ReportValidationError("No 'Id' specified for 'CPackWixFragment' element");
+ } else {
+ for (size_t i = 0; attributes[i]; i += 2) {
+ const std::string key = attributes[i];
+ const std::string value = attributes[i + 1];
+
+ if (key != "Id") {
+ new_element->attributes[key] = value;
+ }
}
}
}
diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
index a2f0a3c..52c7e35 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.h
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -3,12 +3,12 @@
#ifndef cmCPackWIXPatchParser_h
#define cmCPackWIXPatchParser_h
-#include <CPack/cmCPackLog.h>
+#include "cmCPackLog.h"
-#include <cmXMLParser.h>
+#include "cmXMLParser.h"
-#include <list>
#include <map>
+#include <vector>
struct cmWIXPatchNode
{
@@ -36,7 +36,7 @@ struct cmWIXPatchElement : cmWIXPatchNode
~cmWIXPatchElement();
- typedef std::list<cmWIXPatchNode*> child_list_t;
+ typedef std::vector<cmWIXPatchNode*> child_list_t;
typedef std::map<std::string, std::string> attributes_t;
std::string name;
@@ -84,7 +84,7 @@ private:
fragment_map_t& Fragments;
- std::list<cmWIXPatchElement*> ElementStack;
+ std::vector<cmWIXPatchElement*> ElementStack;
};
#endif
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
index d819347..2c99a22 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXRichTextFormatWriter.h"
-#include <cmVersion.h>
+#include "cmVersion.h"
cmWIXRichTextFormatWriter::cmWIXRichTextFormatWriter(
std::string const& filename)
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
index a3c8394..30df878 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
@@ -3,9 +3,9 @@
#ifndef cmWIXRichTextFormatWriter_h
#define cmWIXRichTextFormatWriter_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
-#include <cmsys/FStream.hxx>
+#include "cmsys/FStream.hxx"
#include <string>
/** \class cmWIXRichtTextFormatWriter
diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h
index cba3b34..23ddc6a 100644
--- a/Source/CPack/WiX/cmWIXShortcut.h
+++ b/Source/CPack/WiX/cmWIXShortcut.h
@@ -3,7 +3,7 @@
#ifndef cmWIXShortcut_h
#define cmWIXShortcut_h
-#include <cmInstalledFile.h>
+#include "cmInstalledFile.h"
#include <map>
#include <set>
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx
index b434334..a86e28d 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXSourceWriter.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
-#include <cmUuid.h>
+#include "cmUuid.h"
#include <windows.h>
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h
index 45aefe5..4af1ed6 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXSourceWriter.h
@@ -3,9 +3,9 @@
#ifndef cmWIXSourceWriter_h
#define cmWIXSourceWriter_h
-#include <CPack/cmCPackLog.h>
+#include "cmCPackLog.h"
-#include <cmsys/FStream.hxx>
+#include "cmsys/FStream.hxx"
#include <string>
#include <vector>