mirror of
https://github.com/Kitware/CMake.git
synced 2025-05-09 14:57:08 +08:00

#pragma once is a widely supported compiler pragma, even though it is not part of the C++ standard. Many of the issues keeping #pragma once from being standardized (distributed filesystems, build farms, hard links, etc.) do not apply to CMake - it is easy to build CMake on a single machine. CMake also does not install any header files which can be consumed by other projects (though cmCPluginAPI.h has been deliberately omitted from this conversion in case anyone is still using it.) Finally, #pragma once has been required to build CMake since at least August 2017 (7f29bbe6 enabled server mode unconditionally, which had been using #pragma once since September 2016 (b13d3e0d)). The fact that we now require C++11 filters out old compilers, and it is unlikely that there is a compiler which supports C++11 but does not support #pragma once.
96 lines
3.5 KiB
C++
96 lines
3.5 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
#pragma once
|
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
|
|
|
#include <set>
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
#include <cm/string_view>
|
|
|
|
#include "cmCPackComponentGroup.h"
|
|
#include "cmCPackGenerator.h"
|
|
|
|
class cmXMLWriter;
|
|
|
|
/** \class cmCPackPKGGenerator
|
|
* \brief A generator for pkg files
|
|
*
|
|
*/
|
|
class cmCPackPKGGenerator : public cmCPackGenerator
|
|
{
|
|
public:
|
|
cmCPackTypeMacro(cmCPackPKGGenerator, cmCPackGenerator);
|
|
|
|
/**
|
|
* Construct generator
|
|
*/
|
|
cmCPackPKGGenerator();
|
|
~cmCPackPKGGenerator() override;
|
|
|
|
bool SupportsComponentInstallation() const override;
|
|
|
|
protected:
|
|
int InitializeInternal() override;
|
|
const char* GetOutputPostfix() override { 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, const char* genName);
|
|
|
|
// 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,
|
|
cmXMLWriter& xout);
|
|
|
|
/// Create the "choice" XML element to describe a component group
|
|
/// for the installer GUI.
|
|
void CreateChoice(const cmCPackComponentGroup& group, cmXMLWriter& xout);
|
|
|
|
/// Create the "choice" XML element to describe a component for the
|
|
/// installer GUI.
|
|
void CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout);
|
|
|
|
/// Creates a background in the distribution XML.
|
|
void CreateBackground(const char* themeName, const char* metapackageFile,
|
|
cm::string_view genName, cmXMLWriter& xout);
|
|
|
|
// The PostFlight component when creating a metapackage
|
|
cmCPackComponent PostFlightComponent;
|
|
};
|