diff options
Diffstat (limited to 'Source/cmGeneratorTarget.h')
-rw-r--r-- | Source/cmGeneratorTarget.h | 204 |
1 files changed, 150 insertions, 54 deletions
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index f568699..ae12f97 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -3,7 +3,7 @@ #ifndef cmGeneratorTarget_h #define cmGeneratorTarget_h -#include <cmConfigure.h> +#include "cmConfigure.h" #include "cmLinkItem.h" #include "cmListFileCache.h" @@ -12,6 +12,7 @@ #include <map> #include <set> +#include <stddef.h> #include <string> #include <utility> #include <vector> @@ -69,18 +70,69 @@ public: bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector<cmSourceFile*>& files, const std::string& config) const; + void GetSourceFilesWithoutObjectLibraries(std::vector<cmSourceFile*>& files, + const std::string& config) const; + + /** Source file kinds (classifications). + Generators use this to decide how to treat a source file. */ + enum SourceKind + { + SourceKindAppManifest, + SourceKindCertificate, + SourceKindCustomCommand, + SourceKindExternalObject, + SourceKindExtra, + SourceKindHeader, + SourceKindIDL, + SourceKindManifest, + SourceKindModuleDefinition, + SourceKindObjectSource, + SourceKindResx, + SourceKindXaml + }; + + /** A source file paired with a kind (classification). */ + struct SourceAndKind + { + cmSourceFile* Source; + SourceKind Kind; + }; + + /** All sources needed for a configuration with kinds assigned. */ + struct KindedSources + { + std::vector<SourceAndKind> Sources; + std::set<std::string> ExpectedResxHeaders; + std::set<std::string> ExpectedXamlHeaders; + std::set<std::string> ExpectedXamlSources; + }; + + /** Get all sources needed for a configuration with kinds assigned. */ + KindedSources const& GetKindedSources(std::string const& config) const; + + struct AllConfigSource + { + cmSourceFile const* Source; + cmGeneratorTarget::SourceKind Kind; + std::vector<size_t> Configs; + }; + + /** Get all sources needed for all configurations with kinds and + per-source configurations assigned. */ + std::vector<AllConfigSource> const& GetAllConfigSources() const; void GetObjectSources(std::vector<cmSourceFile const*>&, const std::string& config) const; const std::string& GetObjectName(cmSourceFile const* file); + const char* GetCustomObjectExtension() const; bool HasExplicitObjectName(cmSourceFile const* file) const; void AddExplicitObjectName(cmSourceFile const* sf); + void GetModuleDefinitionSources(std::vector<cmSourceFile const*>&, + const std::string& config) const; void GetResxSources(std::vector<cmSourceFile const*>&, const std::string& config) const; - void GetIDLSources(std::vector<cmSourceFile const*>&, - const std::string& config) const; void GetExternalObjects(std::vector<cmSourceFile const*>&, const std::string& config) const; void GetHeaderSources(std::vector<cmSourceFile const*>&, @@ -110,8 +162,8 @@ public: const char* GetFeature(const std::string& feature, const std::string& config) const; - bool GetFeatureAsBool(const std::string& feature, - const std::string& config) const; + + bool IsIPOEnabled(const std::string& config) const; bool IsLinkInterfaceDependentBoolProperty(const std::string& p, const std::string& config) const; @@ -152,15 +204,31 @@ public: /** Get the full path to the target according to the settings in its makefile and the configuration type. */ - std::string GetFullPath(const std::string& config = "", bool implib = false, - bool realname = false) const; - std::string NormalGetFullPath(const std::string& config, bool implib, + std::string GetFullPath( + const std::string& config = "", + cmStateEnums::ArtifactType artifact = cmStateEnums::RuntimeBinaryArtifact, + bool realname = false) const; + std::string NormalGetFullPath(const std::string& config, + cmStateEnums::ArtifactType artifact, bool realname) const; std::string NormalGetRealName(const std::string& config) const; + /** Get the names of an object library's object files underneath + its object file directory. */ + void GetTargetObjectNames(std::string const& config, + std::vector<std::string>& objects) const; + + /** What hierarchy level should the reported directory contain */ + enum BundleDirectoryLevel + { + BundleDirLevel, + ContentLevel, + FullLevel + }; + /** @return the Mac App directory without the base */ std::string GetAppBundleDirectory(const std::string& config, - bool contentOnly) const; + BundleDirectoryLevel level) const; /** Return whether this target is an executable Bundle, a framework or CFBundle on Apple. */ @@ -169,11 +237,12 @@ public: /** Get the full name of the target according to the settings in its makefile. */ std::string GetFullName(const std::string& config = "", - bool implib = false) const; + cmStateEnums::ArtifactType artifact = + cmStateEnums::RuntimeBinaryArtifact) const; /** @return the Mac framework directory without the base. */ std::string GetFrameworkDirectory(const std::string& config, - bool rootDir) const; + BundleDirectoryLevel level) const; /** Return the framework version string. Undefined if IsFrameworkOnApple returns false. */ @@ -181,7 +250,7 @@ public: /** @return the Mac CFBundle directory without the base */ std::string GetCFBundleDirectory(const std::string& config, - bool contentOnly) const; + BundleDirectoryLevel level) const; /** Return the install name directory for the target in the * build tree. For example: "\@rpath/", "\@loader_path/", @@ -214,16 +283,18 @@ public: void GetFullNameComponents(std::string& prefix, std::string& base, std::string& suffix, const std::string& config = "", - bool implib = false) const; + cmStateEnums::ArtifactType artifact = + cmStateEnums::RuntimeBinaryArtifact) const; - /** Append to @a base the mac content directory and return it. */ - std::string BuildMacContentDirectory(const std::string& base, - const std::string& config = "", - bool contentOnly = true) const; + /** Append to @a base the bundle directory hierarchy up to a certain @a level + * and return it. */ + std::string BuildBundleDirectory(const std::string& base, + const std::string& config, + BundleDirectoryLevel level) const; /** @return the mac content directory for this target. */ - std::string GetMacContentDirectory(const std::string& config = CM_NULLPTR, - bool implib = false) const; + std::string GetMacContentDirectory( + const std::string& config, cmStateEnums::ArtifactType artifact) const; /** @return folder prefix for IDEs. */ std::string GetEffectiveFolderName() const; @@ -233,7 +304,15 @@ public: cmLocalGenerator* LocalGenerator; cmGlobalGenerator const* GlobalGenerator; - cmSourceFile const* GetModuleDefinitionFile(const std::string& config) const; + struct ModuleDefinitionInfo + { + std::string DefFile; + bool DefFileGenerated; + bool WindowsExportAllSymbols; + std::vector<cmSourceFile const*> Sources; + }; + ModuleDefinitionInfo const* GetModuleDefinitionInfo( + std::string const& config) const; /** Return whether or not the target is for a DLL platform. */ bool IsDLLPlatform() const; @@ -282,8 +361,11 @@ public: std::vector<cmGeneratorTarget*>& objlibs) const; std::string GetFullNameImported(const std::string& config, - bool implib) const; + cmStateEnums::ArtifactType artifact) const; + /** Get source files common to all configurations and diagnose cases + with per-config sources. Excludes sources added by a TARGET_OBJECTS + generator expression. */ bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const; bool HaveBuildTreeRPATH(const std::string& config) const; @@ -293,12 +375,16 @@ public: time config name placeholder if needed for the generator. */ std::string ObjectDirectory; - void UseObjectLibraries(std::vector<std::string>& objs, - const std::string& config) const; + /** Full path with trailing slash to the top-level directory + holding object files for the given configuration. */ + std::string GetObjectDirectory(std::string const& config) const; void GetAppleArchs(const std::string& config, std::vector<std::string>& archVec) const; + std::string GetFeatureSpecificLinkRuleVariable( + std::string const& var, std::string const& config) const; + /** Return the rule variable used to create this type of target. */ std::string GetCreateRuleVariable(std::string const& lang, std::string const& config) const; @@ -335,7 +421,8 @@ public: subdirectory for that configuration. Otherwise just the canonical output directory is given. */ std::string GetDirectory(const std::string& config = "", - bool implib = false) const; + cmStateEnums::ArtifactType artifact = + cmStateEnums::RuntimeBinaryArtifact) const; /** Get the directory in which to place the target compiler .pdb file. If the configuration name is given then the generator will add its @@ -349,7 +436,8 @@ public: /** Return whether this target uses the default value for its output directory. */ - bool UsesDefaultOutputDir(const std::string& config, bool implib) const; + bool UsesDefaultOutputDir(const std::string& config, + cmStateEnums::ArtifactType artifact) const; // Cache target output paths for each configuration. struct OutputInfo @@ -390,7 +478,8 @@ public: std::string GetCompilePDBPath(const std::string& config = "") const; // Get the target base name. - std::string GetOutputName(const std::string& config, bool implib) const; + std::string GetOutputName(const std::string& config, + cmStateEnums::ArtifactType artifact) const; void AddSource(const std::string& src); void AddTracedSources(std::vector<std::string> const& srcs); @@ -412,7 +501,9 @@ public: SourceFileTypePublicHeader, // is in "PUBLIC_HEADER" target property SourceFileTypeResource, // is in "RESOURCE" target property *or* // has MACOSX_PACKAGE_LOCATION=="Resources" - SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources" + SourceFileTypeDeepResource, // MACOSX_PACKAGE_LOCATION starts with + // "Resources/" + SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources[/]" }; struct SourceFileFlags { @@ -421,11 +512,6 @@ public: , MacFolder(CM_NULLPTR) { } - SourceFileFlags(SourceFileFlags const& r) - : Type(r.Type) - , MacFolder(r.MacFolder) - { - } SourceFileType Type; const char* MacFolder; // location inside Mac content folders }; @@ -461,7 +547,7 @@ public: std::string GetPDBDirectory(const std::string& config) const; ///! Return the preferred linker language for this target - std::string GetLinkerLanguage(const std::string& config = "") const; + std::string GetLinkerLanguage(const std::string& config) const; /** Does this target have a GNU implib to convert to MS format? */ bool HasImplibGNUtoMS() const; @@ -498,19 +584,6 @@ public: struct SourceFileFlags GetTargetSourceFileFlags( const cmSourceFile* sf) const; - struct ResxData - { - mutable std::set<std::string> ExpectedResxHeaders; - mutable std::vector<cmSourceFile const*> ResxSources; - }; - - struct XamlData - { - std::set<std::string> ExpectedXamlHeaders; - std::set<std::string> ExpectedXamlSources; - std::vector<cmSourceFile const*> XamlSources; - }; - void ReportPropertyOrigin(const std::string& p, const std::string& result, const std::string& report, const std::string& compatibilityType) const; @@ -525,6 +598,16 @@ public: /** Whether this library defaults to \@rpath. */ bool MacOSXRpathInstallNameDirDefault() const; + enum InstallNameType + { + INSTALL_NAME_FOR_BUILD, + INSTALL_NAME_FOR_INSTALL + }; + /** Whether to use INSTALL_NAME_DIR. */ + bool MacOSXUseInstallNameDir() const; + /** Whether to generate an install_name. */ + bool CanGenerateInstallNameDir(InstallNameType t) const; + /** Test for special case of a third-party shared library that has no soname at all. */ bool IsImportedSharedLibWithoutSOName(const std::string& config) const; @@ -574,8 +657,9 @@ private: mutable std::map<std::string, bool> DebugCompatiblePropertiesDone; std::string GetFullNameInternal(const std::string& config, - bool implib) const; - void GetFullNameInternal(const std::string& config, bool implib, + cmStateEnums::ArtifactType artifact) const; + void GetFullNameInternal(const std::string& config, + cmStateEnums::ArtifactType artifact, std::string& outPrefix, std::string& outBase, std::string& outSuffix) const; @@ -583,7 +667,7 @@ private: mutable LinkClosureMapType LinkClosureMap; // Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type. - const char* GetOutputTargetType(bool implib) const; + const char* GetOutputTargetType(cmStateEnums::ArtifactType artifact) const; void ComputeVersionedName(std::string& vName, std::string const& prefix, std::string const& base, std::string const& suffix, @@ -673,9 +757,13 @@ private: const std::string& config, const cmGeneratorTarget* head, bool usage_requirements_only) const; - typedef std::map<std::string, std::vector<cmSourceFile*> > - SourceFilesMapType; - mutable SourceFilesMapType SourceFilesMap; + typedef std::map<std::string, KindedSources> KindedSourcesMapType; + mutable KindedSourcesMapType KindedSourcesMap; + void ComputeKindedSources(KindedSources& files, + std::string const& config) const; + + mutable std::vector<AllConfigSource> AllConfigSources; + void ComputeAllConfigSources() const; std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries; std::vector<TargetPropertyEntry*> CompileOptionsEntries; @@ -705,18 +793,26 @@ private: cmLinkImplementationLibraries const* GetLinkImplementationLibrariesInternal( const std::string& config, const cmGeneratorTarget* head) const; - bool ComputeOutputDir(const std::string& config, bool implib, + bool ComputeOutputDir(const std::string& config, + cmStateEnums::ArtifactType artifact, std::string& out) const; typedef std::map<std::string, OutputInfo> OutputInfoMapType; mutable OutputInfoMapType OutputInfoMap; - typedef std::pair<std::string, bool> OutputNameKey; + typedef std::map<std::string, ModuleDefinitionInfo> + ModuleDefinitionInfoMapType; + mutable ModuleDefinitionInfoMapType ModuleDefinitionInfoMap; + void ComputeModuleDefinitionInfo(std::string const& config, + ModuleDefinitionInfo& info) const; + + typedef std::pair<std::string, cmStateEnums::ArtifactType> OutputNameKey; typedef std::map<OutputNameKey, std::string> OutputNameMapType; mutable OutputNameMapType OutputNameMap; mutable std::set<cmLinkItem> UtilityItems; cmPolicies::PolicyMap PolicyMap; mutable bool PolicyWarnedCMP0022; + mutable bool PolicyReportedCMP0069; mutable bool DebugIncludesDone; mutable bool DebugCompileOptionsDone; mutable bool DebugCompileFeaturesDone; |