2012-10-03 18:08:49 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
2015-02-13 13:57:20 +03:00
|
|
|
Copyright 2012-2015 Kitware, Inc.
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
|
|
|
|
|
|
|
#ifndef cmCPackWIXGenerator_h
|
|
|
|
#define cmCPackWIXGenerator_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 <CPack/cmCPackGenerator.h>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
virtual const char* GetOutputExtension()
|
|
|
|
{
|
|
|
|
return ".msi";
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual enum CPackSetDestdirSupport SupportsSetDestdir() const
|
|
|
|
{
|
|
|
|
return SETDESTDIR_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool SupportsAbsoluteDestination() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool SupportsComponentInstallation() const
|
|
|
|
{
|
2013-11-20 00:38:09 +04:00
|
|
|
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();
|
|
|
|
|
2012-10-03 18:08:49 +04:00
|
|
|
void CopyDefinition(
|
2014-02-25 02:21:12 +04:00
|
|
|
cmWIXSourceWriter &source, std::string const& name);
|
2012-10-03 18:08:49 +04:00
|
|
|
|
|
|
|
void AddDefinition(cmWIXSourceWriter& source,
|
2014-02-25 02:21:12 +04:00
|
|
|
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
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
bool CreateFeatureHierarchy(
|
|
|
|
cmWIXFeaturesSourceWriter& featureDefinitions);
|
2013-11-20 00:38:09 +04:00
|
|
|
|
|
|
|
bool AddComponentsToFeature(
|
|
|
|
std::string const& rootPath,
|
|
|
|
std::string const& featureId,
|
2014-02-25 02:21:12 +04:00
|
|
|
cmWIXDirectoriesSourceWriter& directoryDefinitions,
|
|
|
|
cmWIXFilesSourceWriter& fileDefinitions,
|
|
|
|
cmWIXFeaturesSourceWriter& featureDefinitions,
|
2015-02-21 14:38:14 +03:00
|
|
|
cmWIXShortcuts& shortcuts);
|
2013-11-20 00:38:09 +04:00
|
|
|
|
2015-02-21 14:38:14 +03:00
|
|
|
bool CreateShortcuts(
|
2013-11-20 00:38:09 +04:00
|
|
|
std::string const& cpackComponentName,
|
|
|
|
std::string const& featureId,
|
2015-02-21 14:38:14 +03:00
|
|
|
cmWIXShortcuts const& shortcuts,
|
|
|
|
bool emitUninstallShortcut,
|
|
|
|
cmWIXFilesSourceWriter& fileDefinitions,
|
|
|
|
cmWIXFeaturesSourceWriter& featureDefinitions);
|
|
|
|
|
|
|
|
bool CreateShortcutsOfSpecificType(
|
|
|
|
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
|
|
|
|
|
|
|
bool RunCandleCommand(
|
2014-02-25 02:21:12 +04:00
|
|
|
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
|
|
|
|
2014-02-25 02:21:12 +04:00
|
|
|
void AddDirectoryAndFileDefinitons(std::string const& topdir,
|
|
|
|
std::string const& directoryId,
|
|
|
|
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
|
|
|
|
|
|
|
static std::string CreateHashedId(
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string const& path, std::string const& normalizedFilename);
|
2013-10-11 00:49:33 +04:00
|
|
|
|
|
|
|
std::string NormalizeComponentForId(
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string const& component, size_t& replacementCount);
|
2013-10-11 00:49:33 +04:00
|
|
|
|
|
|
|
static bool IsLegalIdCharacter(char c);
|
|
|
|
|
2013-11-10 22:48:29 +04:00
|
|
|
void CollectExtensions(
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string const& variableName, extension_set_t& extensions);
|
2013-11-10 22:48:29 +04:00
|
|
|
|
|
|
|
void AddCustomFlags(
|
2014-02-25 02:21:12 +04:00
|
|
|
std::string const& variableName, std::ostream& stream);
|
2013-12-17 01:30:11 +04: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;
|
2012-10-03 18:08:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|