diff options
author | Brad King <brad.king@kitware.com> | 2017-04-07 19:05:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-04-07 19:35:48 (GMT) |
commit | 60307c5056476962d7656ea9122ada79a07aa58f (patch) | |
tree | 61acba598b4876e9216c60c5649512f673cccf95 /Source/cmGeneratorTarget.h | |
parent | a9784d0e26a9d9c881248326b2385cefbb732de7 (diff) | |
download | CMake-60307c5056476962d7656ea9122ada79a07aa58f.zip CMake-60307c5056476962d7656ea9122ada79a07aa58f.tar.gz CMake-60307c5056476962d7656ea9122ada79a07aa58f.tar.bz2 |
cmGeneratorTarget: Replace source classifier implementation
Compute and memoize the list of sources with their kinds for each
configuration just once.
Diffstat (limited to 'Source/cmGeneratorTarget.h')
-rw-r--r-- | Source/cmGeneratorTarget.h | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 255b89b..00df14b 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -70,6 +70,43 @@ public: void GetSourceFiles(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; + void GetObjectSources(std::vector<cmSourceFile const*>&, const std::string& config) const; const std::string& GetObjectName(cmSourceFile const* file); @@ -522,19 +559,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; @@ -707,9 +731,10 @@ 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; std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries; std::vector<TargetPropertyEntry*> CompileOptionsEntries; @@ -770,10 +795,6 @@ private: bool ComputePDBOutputDir(const std::string& kind, const std::string& config, std::string& out) const; - typedef std::map<std::string, std::set<std::string> > HeadersCacheType; - mutable HeadersCacheType ResxHeadersCache; - mutable HeadersCacheType XamlHeadersCache; - public: const std::vector<const cmGeneratorTarget*>& GetLinkImplementationClosure( const std::string& config) const; |