diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2016-04-05 00:53:05 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2016-06-02 03:56:50 (GMT) |
commit | 50a3d34005ec923db3d76d0a5d118437a7632617 (patch) | |
tree | 76b0252c51ae9071b5e83d05e5e03512d65d6a7b /Source/CPack/cmCPackPKGGenerator.h | |
parent | d6754d37d593a0189809dcf98bc4fdf3a609f0a3 (diff) | |
download | CMake-50a3d34005ec923db3d76d0a5d118437a7632617.zip CMake-50a3d34005ec923db3d76d0a5d118437a7632617.tar.gz CMake-50a3d34005ec923db3d76d0a5d118437a7632617.tar.bz2 |
PackageMaker: factor out common code for creating pkg files.
Diffstat (limited to 'Source/CPack/cmCPackPKGGenerator.h')
-rw-r--r-- | Source/CPack/cmCPackPKGGenerator.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h new file mode 100644 index 0000000..3011f78 --- /dev/null +++ b/Source/CPack/cmCPackPKGGenerator.h @@ -0,0 +1,103 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 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 cmCPackPKGGenerator_h +#define cmCPackPKGGenerator_h + + +#include "cmCPackGenerator.h" + +class cmCPackComponent; + +/** \class cmCPackPKGGenerator + * \brief A generator for pkg files + * + */ +class cmCPackPKGGenerator : public cmCPackGenerator +{ +public: + cmCPackTypeMacro(cmCPackPKGGenerator, cmCPackGenerator); + + /** + * Construct generator + */ + cmCPackPKGGenerator(); + virtual ~cmCPackPKGGenerator(); + + virtual bool SupportsComponentInstallation() const; + +protected: + virtual int InitializeInternal(); + virtual const char* GetOutputPostfix() { return "darwin"; } + + // Copies or creates the resource file with the given name to the + // package or package staging directory dirName. The variable + // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased + // version of name) specifies the input file to use for this file, + // which will be configured via ConfigureFile. + bool CopyCreateResourceFile(const std::string& name, + const std::string& dirName); + bool CopyResourcePlistFile(const std::string& name, const char* outName = 0); + + int CopyInstallScript(const std::string& resdir, const std::string& script, + const std::string& name); + + // Retrieve the name of package file that will be generated for this + // component. The name is just the file name with extension, and + // does not include the subdirectory. + std::string GetPackageName(const cmCPackComponent& component); + + // Writes a distribution.dist file, which turns a metapackage into a + // full-fledged distribution. This file is used to describe + // inter-component dependencies. metapackageFile is the name of the + // metapackage for the distribution. Only valid for a + // component-based install. + void WriteDistributionFile(const char* metapackageFile); + + // Subroutine of WriteDistributionFile that writes out the + // dependency attributes for inter-component dependencies. + void AddDependencyAttributes(const cmCPackComponent& component, + std::set<const cmCPackComponent*>& visited, + std::ostringstream& out); + + // Subroutine of WriteDistributionFile that writes out the + // reverse dependency attributes for inter-component dependencies. + void AddReverseDependencyAttributes( + const cmCPackComponent& component, + std::set<const cmCPackComponent*>& visited, std::ostringstream& out); + + // Generates XML that encodes the hierarchy of component groups and + // their components in a form that can be used by distribution + // metapackages. + void CreateChoiceOutline(const cmCPackComponentGroup& group, + std::ostringstream& out); + + /// Create the "choice" XML element to describe a component group + /// for the installer GUI. + void CreateChoice(const cmCPackComponentGroup& group, + std::ostringstream& out); + + /// Create the "choice" XML element to describe a component for the + /// installer GUI. + void CreateChoice(const cmCPackComponent& component, + std::ostringstream& out); + + // Escape the given string to make it usable as an XML attribute + // value. + std::string EscapeForXML(std::string str); + + // The PostFlight component when creating a metapackage + cmCPackComponent PostFlightComponent; + +}; + +#endif |