2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2012-10-03 18:08:49 +04:00
|
|
|
#ifndef cmCPackWIXGenerator_h
|
|
|
|
#define cmCPackWIXGenerator_h
|
|
|
|
|
2016-04-29 16:40:20 +03:00
|
|
|
#include <CPack/cmCPackGenerator.h>
|
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
#include "cmWIXPatch.h"
|
|
|
|
#include "cmWIXShortcut.h"
|
2013-12-17 01:30:11 +04:00
|
|
|
|
2012-10-03 18:08:49 +04:00
|
|
|
#include <map>
|
2016-04-29 17:53:13 +03:00
|
|
|
#include <string>
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
class cmWIXSourceWriter;
|
2014-02-25 02:21:12 +04:00
|
|
|
class cmWIXDirectoriesSourceWriter;
|
|
|
|
class cmWIXFilesSourceWriter;
|
|
|
|
class cmWIXFeaturesSourceWriter;
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
/** \class cmCPackWIXGenerator
|
|
|
|
* \brief A generator for WIX files
|
|
|
|
*/
|
|
|
|
class cmCPackWIXGenerator : public cmCPackGenerator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmCPackTypeMacro(cmCPackWIXGenerator, cmCPackGenerator);
|
|
|
|
|
2014-02-04 21:40:45 +04:00
|
|
|
cmCPackWIXGenerator();
|
2014-04-19 00:45:30 +04:00
|
|
|
~cmCPackWIXGenerator();
|
2014-02-04 21:40:45 +04:00
|
|
|
|
2012-10-03 18:08:49 +04:00
|
|
|
protected:
|
|
|
|
virtual int InitializeInternal();
|
|
|
|
|
|
|
|
virtual int PackageFiles();
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
virtual const char* GetOutputExtension() { return ".msi"; }
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
virtual enum CPackSetDestdirSupport SupportsSetDestdir() const
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
2012-10-03 18:08:49 +04:00
|
|
|
return SETDESTDIR_UNSUPPORTED;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
virtual bool SupportsAbsoluteDestination() const { return false; }
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
virtual bool SupportsComponentInstallation() const { return true; }
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
private:
|
2013-10-11 00:49:33 +04:00
|
|
|
typedef std::map<std::string, std::string> id_map_t;
|
|
|
|
typedef std::map<std::string, size_t> ambiguity_map_t;
|
2013-11-10 22:48:29 +04:00
|
|
|
typedef std::set<std::string> extension_set_t;
|
2013-10-11 00:49:33 +04:00
|
|
|
|
2012-10-03 18:08:49 +04:00
|
|
|
bool InitializeWiXConfiguration();
|
|
|
|
|
|
|
|
bool PackageFilesImpl();
|
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
void CreateWiXVariablesIncludeFile();
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2014-03-02 02:13:35 +04:00
|
|
|
void CreateWiXPropertiesIncludeFile();
|
|
|
|
|
2015-02-13 13:57:20 +03:00
|
|
|
void CreateWiXProductFragmentIncludeFile();
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void CopyDefinition(cmWIXSourceWriter& source, std::string const& name);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void AddDefinition(cmWIXSourceWriter& source, std::string const& name,
|
|
|
|
std::string const& value);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
bool CreateWiXSourceFiles();
|
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string GetProgramFilesFolderId() const;
|
2014-01-08 04:28:24 +04:00
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
bool GenerateMainSourceFileFromTemplate();
|
2013-11-20 00:38:09 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool CreateFeatureHierarchy(cmWIXFeaturesSourceWriter& featureDefinitions);
|
2013-11-20 00:38:09 +04:00
|
|
|
|
|
|
|
bool AddComponentsToFeature(
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string const& rootPath, std::string const& featureId,
|
2014-02-25 02:21:12 +04:00
|
|
|
cmWIXDirectoriesSourceWriter& directoryDefinitions,
|
|
|
|
cmWIXFilesSourceWriter& fileDefinitions,
|
2016-05-16 17:34:04 +03:00
|
|
|
cmWIXFeaturesSourceWriter& featureDefinitions, cmWIXShortcuts& shortcuts);
|
2013-11-20 00:38:09 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool CreateShortcuts(std::string const& cpackComponentName,
|
|
|
|
std::string const& featureId,
|
|
|
|
cmWIXShortcuts const& shortcuts,
|
|
|
|
bool emitUninstallShortcut,
|
|
|
|
cmWIXFilesSourceWriter& fileDefinitions,
|
|
|
|
cmWIXFeaturesSourceWriter& featureDefinitions);
|
2015-02-21 14:38:14 +03:00
|
|
|
|
|
|
|
bool CreateShortcutsOfSpecificType(
|
2016-05-16 17:34:04 +03:00
|
|
|
cmWIXShortcuts::Type type, std::string const& cpackComponentName,
|
|
|
|
std::string const& featureId, std::string const& idPrefix,
|
|
|
|
cmWIXShortcuts const& shortcuts, bool emitUninstallShortcut,
|
2014-02-25 02:21:12 +04:00
|
|
|
cmWIXFilesSourceWriter& fileDefinitions,
|
|
|
|
cmWIXFeaturesSourceWriter& featureDefinitions);
|
2013-10-23 14:14:39 +04:00
|
|
|
|
2013-10-13 15:16:54 +04:00
|
|
|
void AppendUserSuppliedExtraSources();
|
|
|
|
|
|
|
|
void AppendUserSuppliedExtraObjects(std::ostream& stream);
|
|
|
|
|
2012-10-03 18:08:49 +04:00
|
|
|
bool CreateLicenseFile();
|
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
bool RunWiXCommand(std::string const& command);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool RunCandleCommand(std::string const& sourceFile,
|
|
|
|
std::string const& objectFile);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
bool RunLightCommand(std::string const& objectFiles);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void AddDirectoryAndFileDefinitons(
|
|
|
|
std::string const& topdir, std::string const& directoryId,
|
2014-02-25 02:21:12 +04:00
|
|
|
cmWIXDirectoriesSourceWriter& directoryDefinitions,
|
|
|
|
cmWIXFilesSourceWriter& fileDefinitions,
|
|
|
|
cmWIXFeaturesSourceWriter& featureDefinitions,
|
2015-02-21 19:30:31 +03:00
|
|
|
std::vector<std::string> const& packageExecutables,
|
2015-02-21 14:38:14 +03:00
|
|
|
std::vector<std::string> const& desktopExecutables,
|
|
|
|
cmWIXShortcuts& shortcuts);
|
2013-03-01 06:09:58 +04:00
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
bool RequireOption(std::string const& name, std::string& value) const;
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
std::string GetArchitecture() const;
|
|
|
|
|
|
|
|
static std::string GenerateGUID();
|
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
static std::string QuotePath(std::string const& path);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
static std::string GetRightmostExtension(std::string const& filename);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string PathToId(std::string const& path);
|
2013-10-11 00:49:33 +04:00
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string CreateNewIdForPath(std::string const& path);
|
2013-10-11 00:49:33 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
static std::string CreateHashedId(std::string const& path,
|
|
|
|
std::string const& normalizedFilename);
|
2013-10-11 00:49:33 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string NormalizeComponentForId(std::string const& component,
|
|
|
|
size_t& replacementCount);
|
2013-10-11 00:49:33 +04:00
|
|
|
|
|
|
|
static bool IsLegalIdCharacter(char c);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void CollectExtensions(std::string const& variableName,
|
|
|
|
extension_set_t& extensions);
|
2013-11-10 22:48:29 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void AddCustomFlags(std::string const& variableName, std::ostream& stream);
|
2013-12-17 01:30:11 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string RelativePathWithoutComponentPrefix(std::string const& path);
|
2015-12-10 19:38:18 +03:00
|
|
|
|
2013-12-20 21:12:01 +04:00
|
|
|
std::vector<std::string> WixSources;
|
|
|
|
id_map_t PathToIdMap;
|
|
|
|
ambiguity_map_t IdAmbiguityCounter;
|
2013-11-10 22:48:29 +04:00
|
|
|
|
2013-12-20 21:12:01 +04:00
|
|
|
extension_set_t CandleExtensions;
|
|
|
|
extension_set_t LightExtensions;
|
2013-12-17 01:30:11 +04:00
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string CPackTopLevel;
|
|
|
|
|
2014-04-19 00:45:30 +04:00
|
|
|
cmWIXPatch* Patch;
|
2016-09-06 13:11:00 +03:00
|
|
|
|
|
|
|
cmWIXSourceWriter::GuidType ComponentGuidType;
|
2012-10-03 18:08:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|