Path: blob/master/Source/CPack/cmCPackInnoSetupGenerator.h
4998 views
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying1file LICENSE.rst or https://cmake.org/licensing for details. */23#pragma once45#include <map>6#include <string>7#include <vector>89#include "cmCPackGenerator.h"10#include "cmValue.h"1112using cmCPackInnoSetupKeyValuePairs = std::map<std::string, std::string>;1314class cmCPackComponentGroup;15class cmCPackComponent;1617/** \class cmCPackInnoSetupGenerator18* \brief A generator for Inno Setup19*20* https://jrsoftware.org/isinfo.php21*/22class cmCPackInnoSetupGenerator : public cmCPackGenerator23{24public:25cmCPackTypeMacro(cmCPackInnoSetupGenerator, cmCPackGenerator);2627/**28* Construct generator29*/30cmCPackInnoSetupGenerator();31~cmCPackInnoSetupGenerator() override;3233static bool CanGenerate();3435protected:36int InitializeInternal() override;37int PackageFiles() override;3839inline char const* GetOutputExtension() override { return ".exe"; }4041inline cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()42const override43{44return cmCPackGenerator::SETDESTDIR_UNSUPPORTED;45}4647inline bool SupportsAbsoluteDestination() const override { return false; }48inline bool SupportsComponentInstallation() const override { return true; }4950private:51enum class PathType52{53Windows,54Native,55};5657bool ProcessSetupSection();58bool ProcessFiles();59bool ProcessComponents();6061bool ConfigureISScript();62bool Compile();6364bool BuildDownloadedComponentArchive(cmCPackComponent* component,65std::string const& uploadDirectory,66std::string* hash);6768/**69* Returns the option's value or an empty string if the option isn't set.70*/71cmValue RequireOption(std::string const& key);7273std::string CustomComponentInstallDirectory(74cmCPackComponent const* component);7576/**77* Translates boolean expressions into "yes" or "no", as required in78* Inno Setup (only if "CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT" is on).79*/80std::string TranslateBool(std::string const& value);8182/**83* Creates a typical line of key and value pairs using the given map.84*85* (e.g.: Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}";86* GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked)87*/88std::string ISKeyValueLine(cmCPackInnoSetupKeyValuePairs const& params);8990std::string CreateRecursiveComponentPath(cmCPackComponentGroup* group,91std::string const& path = "");9293void CreateRecursiveComponentGroups(cmCPackComponentGroup* group);9495/**96* These functions add quotes if the given value hasn't already quotes.97* Paths are converted into the format used by Windows before.98*/99std::string Quote(std::string const& string);100std::string QuotePath(std::string const& path,101PathType type = PathType::Windows);102103/**104* This function replaces the following 5 characters with their %-encoding:105* '|' '}' ',' '%' '"'106* Required for Inno Setup constants like {cm:...}107*/108std::string PrepareForConstant(std::string const& string);109110std::vector<std::string> includeDirectives;111cmCPackInnoSetupKeyValuePairs setupDirectives;112bool toplevelProgramFolder;113std::vector<std::string> languageInstructions;114std::vector<std::string> fileInstructions;115std::vector<std::string> dirInstructions;116std::vector<std::string> typeInstructions;117std::vector<std::string> componentInstructions;118std::vector<std::string> iconInstructions;119std::vector<std::string> desktopIconComponents;120std::vector<std::string> runInstructions;121std::vector<std::string> codeIncludes;122};123124125