2012-10-03 18:08:49 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2012 Kitware, Inc.
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
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-10-23 14:14:39 +04:00
|
|
|
typedef std::map<std::string, cmWIXShortcut> shortcut_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();
|
|
|
|
|
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,
|
2013-11-20 00:38:09 +04:00
|
|
|
shortcut_map_t& shortcutMap);
|
|
|
|
|
|
|
|
bool CreateStartMenuShortcuts(
|
|
|
|
std::string const& cpackComponentName,
|
|
|
|
std::string const& featureId,
|
|
|
|
shortcut_map_t& shortcutMap,
|
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,
|
2013-11-20 00:38:09 +04:00
|
|
|
const std::vector<std::string>& pkgExecutables,
|
2014-02-04 21:40:45 +04:00
|
|
|
const std::vector<std::string>& desktopExecutables,
|
2013-11-20 00:38:09 +04:00
|
|
|
shortcut_map_t& shortcutMap);
|
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-04 21:40:45 +04:00
|
|
|
bool HasDesktopShortcuts;
|
2014-02-25 02:21:12 +04:00
|
|
|
|
|
|
|
std::string CPackTopLevel;
|
|
|
|
|
|
|
|
cmWIXPatch Patch;
|
2012-10-03 18:08:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|