/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying1file LICENSE.rst or https://cmake.org/licensing for details. */2#pragma once34#include "cmConfigure.h" // IWYU pragma: keep56#include <set>7#include <sstream>8#include <string>910#include <cm/string_view>1112#include "cmCPackComponentGroup.h"13#include "cmCPackGenerator.h"1415class cmXMLWriter;1617/** \class cmCPackPKGGenerator18* \brief A generator for pkg files19*20*/21class cmCPackPKGGenerator : public cmCPackGenerator22{23public:24cmCPackTypeMacro(cmCPackPKGGenerator, cmCPackGenerator);2526/**27* Construct generator28*/29cmCPackPKGGenerator();30~cmCPackPKGGenerator() override;3132bool SupportsComponentInstallation() const override;3334protected:35int InitializeInternal() override;36char const* GetOutputPostfix() override { return "darwin"; }3738// Copies or creates the resource file with the given name to the39// package or package staging directory dirName. The variable40// CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased41// version of name) specifies the input file to use for this file,42// which will be configured via ConfigureFile.43bool CopyCreateResourceFile(std::string const& name,44std::string const& dirName);45bool CopyResourcePlistFile(std::string const& name,46char const* outName = nullptr);4748int CopyInstallScript(std::string const& resdir, std::string const& script,49std::string const& name);5051// Retrieve the name of package file that will be generated for this52// component. The name is just the file name with extension, and53// does not include the subdirectory.54std::string GetPackageName(cmCPackComponent const& component);5556// Writes a distribution.dist file, which turns a metapackage into a57// full-fledged distribution. This file is used to describe58// inter-component dependencies. metapackageFile is the name of the59// metapackage for the distribution. Only valid for a60// component-based install.61void WriteDistributionFile(char const* metapackageFile, char const* genName);6263// Subroutine of WriteDistributionFile that writes out the64// dependency attributes for inter-component dependencies.65void AddDependencyAttributes(cmCPackComponent const& component,66std::set<cmCPackComponent const*>& visited,67std::ostringstream& out);6869// Subroutine of WriteDistributionFile that writes out the70// reverse dependency attributes for inter-component dependencies.71void AddReverseDependencyAttributes(72cmCPackComponent const& component,73std::set<cmCPackComponent const*>& visited, std::ostringstream& out);7475// Generates XML that encodes the hierarchy of component groups and76// their components in a form that can be used by distribution77// metapackages.78void CreateChoiceOutline(cmCPackComponentGroup const& group,79cmXMLWriter& xout);8081/// Create the "choice" XML element to describe a component group82/// for the installer GUI.83void CreateChoice(cmCPackComponentGroup const& group, cmXMLWriter& xout);8485/// Create the "choice" XML element to describe a component for the86/// installer GUI.87void CreateChoice(cmCPackComponent const& component, cmXMLWriter& xout);8889/// Creates a background in the distribution XML.90void CreateBackground(char const* themeName, char const* metapackageFile,91cm::string_view genName, cmXMLWriter& xout);9293/// Create the "domains" XML element to indicate where the product can94/// be installed95void CreateDomains(cmXMLWriter& xout);9697// The PostFlight component when creating a metapackage98cmCPackComponent PostFlightComponent;99};100101102