2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2015-08-04 20:49:49 +03:00
|
|
|
#ifndef cmLinkItem_h
|
|
|
|
#define cmLinkItem_h
|
|
|
|
|
|
|
|
#include "cmListFileCache.h"
|
2015-10-20 01:57:35 +03:00
|
|
|
#include "cmSystemTools.h"
|
2015-08-04 20:49:49 +03:00
|
|
|
|
2015-10-08 02:05:41 +03:00
|
|
|
class cmGeneratorTarget;
|
2015-08-04 20:49:49 +03:00
|
|
|
|
|
|
|
// Basic information about each link item.
|
2016-05-16 17:34:04 +03:00
|
|
|
class cmLinkItem : public std::string
|
2015-08-04 20:49:49 +03:00
|
|
|
{
|
|
|
|
typedef std::string std_string;
|
2016-05-16 17:34:04 +03:00
|
|
|
|
2015-08-04 20:49:49 +03:00
|
|
|
public:
|
2016-05-16 17:34:04 +03:00
|
|
|
cmLinkItem()
|
|
|
|
: std_string()
|
2016-06-27 23:44:16 +03:00
|
|
|
, Target(CM_NULLPTR)
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
cmLinkItem(const std_string& n, cmGeneratorTarget const* t)
|
|
|
|
: std_string(n)
|
|
|
|
, Target(t)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
cmLinkItem(cmLinkItem const& r)
|
|
|
|
: std_string(r)
|
|
|
|
, Target(r.Target)
|
|
|
|
{
|
|
|
|
}
|
2015-10-08 02:18:42 +03:00
|
|
|
cmGeneratorTarget const* Target;
|
2015-08-04 20:49:49 +03:00
|
|
|
};
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
class cmLinkImplItem : public cmLinkItem
|
2015-08-04 20:49:49 +03:00
|
|
|
{
|
|
|
|
public:
|
2016-05-16 17:34:04 +03:00
|
|
|
cmLinkImplItem()
|
|
|
|
: cmLinkItem()
|
|
|
|
, Backtrace()
|
|
|
|
, FromGenex(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
cmLinkImplItem(std::string const& n, cmGeneratorTarget const* t,
|
|
|
|
cmListFileBacktrace const& bt, bool fromGenex)
|
|
|
|
: cmLinkItem(n, t)
|
|
|
|
, Backtrace(bt)
|
|
|
|
, FromGenex(fromGenex)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
cmLinkImplItem(cmLinkImplItem const& r)
|
|
|
|
: cmLinkItem(r)
|
|
|
|
, Backtrace(r.Backtrace)
|
|
|
|
, FromGenex(r.FromGenex)
|
|
|
|
{
|
|
|
|
}
|
2015-08-04 20:49:49 +03:00
|
|
|
cmListFileBacktrace Backtrace;
|
|
|
|
bool FromGenex;
|
|
|
|
};
|
|
|
|
|
2015-08-04 20:55:46 +03:00
|
|
|
/** The link implementation specifies the direct library
|
|
|
|
dependencies needed by the object files of the target. */
|
|
|
|
struct cmLinkImplementationLibraries
|
|
|
|
{
|
|
|
|
// Libraries linked directly in this configuration.
|
|
|
|
std::vector<cmLinkImplItem> Libraries;
|
|
|
|
|
|
|
|
// Libraries linked directly in other configurations.
|
|
|
|
// Needed only for OLD behavior of CMP0003.
|
|
|
|
std::vector<cmLinkItem> WrongConfigLibraries;
|
|
|
|
};
|
|
|
|
|
2015-08-26 20:35:45 +03:00
|
|
|
struct cmLinkInterfaceLibraries
|
|
|
|
{
|
|
|
|
// Libraries listed in the interface.
|
|
|
|
std::vector<cmLinkItem> Libraries;
|
|
|
|
};
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
struct cmLinkInterface : public cmLinkInterfaceLibraries
|
2015-08-26 20:35:45 +03:00
|
|
|
{
|
|
|
|
// Languages whose runtime libraries must be linked.
|
|
|
|
std::vector<std::string> Languages;
|
|
|
|
|
|
|
|
// Shared library dependencies needed for linking on some platforms.
|
|
|
|
std::vector<cmLinkItem> SharedDeps;
|
|
|
|
|
|
|
|
// Number of repetitions of a strongly connected component of two
|
|
|
|
// or more static libraries.
|
2016-02-04 01:22:38 +03:00
|
|
|
unsigned int Multiplicity;
|
2015-08-26 20:35:45 +03:00
|
|
|
|
|
|
|
// Libraries listed for other configurations.
|
|
|
|
// Needed only for OLD behavior of CMP0003.
|
|
|
|
std::vector<cmLinkItem> WrongConfigLibraries;
|
|
|
|
|
|
|
|
bool ImplementationIsInterface;
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
cmLinkInterface()
|
|
|
|
: Multiplicity(0)
|
|
|
|
, ImplementationIsInterface(false)
|
|
|
|
{
|
|
|
|
}
|
2015-08-26 20:35:45 +03:00
|
|
|
};
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
struct cmOptionalLinkInterface : public cmLinkInterface
|
2015-08-26 20:35:45 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
cmOptionalLinkInterface()
|
|
|
|
: LibrariesDone(false)
|
|
|
|
, AllDone(false)
|
|
|
|
, Exists(false)
|
|
|
|
, HadHeadSensitiveCondition(false)
|
2016-06-27 23:44:16 +03:00
|
|
|
, ExplicitLibraries(CM_NULLPTR)
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
}
|
2015-08-26 20:35:45 +03:00
|
|
|
bool LibrariesDone;
|
|
|
|
bool AllDone;
|
|
|
|
bool Exists;
|
|
|
|
bool HadHeadSensitiveCondition;
|
|
|
|
const char* ExplicitLibraries;
|
|
|
|
};
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
struct cmHeadToLinkInterfaceMap
|
|
|
|
: public std::map<cmGeneratorTarget const*, cmOptionalLinkInterface>
|
2015-08-26 20:37:06 +03:00
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
struct cmLinkImplementation : public cmLinkImplementationLibraries
|
2015-08-05 18:37:48 +03:00
|
|
|
{
|
|
|
|
// Languages whose runtime libraries must be linked.
|
|
|
|
std::vector<std::string> Languages;
|
|
|
|
};
|
|
|
|
|
2015-08-05 18:37:48 +03:00
|
|
|
// Cache link implementation computation from each configuration.
|
2016-05-16 17:34:04 +03:00
|
|
|
struct cmOptionalLinkImplementation : public cmLinkImplementation
|
2015-08-05 18:37:48 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
cmOptionalLinkImplementation()
|
|
|
|
: LibrariesDone(false)
|
|
|
|
, LanguagesDone(false)
|
|
|
|
, HadHeadSensitiveCondition(false)
|
|
|
|
{
|
|
|
|
}
|
2015-08-05 18:37:48 +03:00
|
|
|
bool LibrariesDone;
|
|
|
|
bool LanguagesDone;
|
|
|
|
bool HadHeadSensitiveCondition;
|
|
|
|
};
|
|
|
|
|
2015-10-20 01:57:35 +03:00
|
|
|
/** Compute the link type to use for the given configuration. */
|
2016-05-16 17:34:04 +03:00
|
|
|
inline cmTargetLinkLibraryType CMP0003_ComputeLinkType(
|
|
|
|
const std::string& config, std::vector<std::string> const& debugConfigs)
|
2015-10-20 01:57:35 +03:00
|
|
|
{
|
|
|
|
// No configuration is always optimized.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (config.empty()) {
|
2015-10-20 01:57:35 +03:00
|
|
|
return OPTIMIZED_LibraryType;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-20 01:57:35 +03:00
|
|
|
|
|
|
|
// Check if any entry in the list matches this configuration.
|
|
|
|
std::string configUpper = cmSystemTools::UpperCase(config);
|
|
|
|
if (std::find(debugConfigs.begin(), debugConfigs.end(), configUpper) !=
|
2016-05-16 17:34:04 +03:00
|
|
|
debugConfigs.end()) {
|
2015-10-20 01:57:35 +03:00
|
|
|
return DEBUG_LibraryType;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-20 01:57:35 +03:00
|
|
|
// The current configuration is not a debug configuration.
|
|
|
|
return OPTIMIZED_LibraryType;
|
|
|
|
}
|
|
|
|
|
2015-08-04 20:49:49 +03:00
|
|
|
#endif
|