summaryrefslogtreecommitdiff
path: root/Source/cmGlobalGenerator.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-26 15:29:53 -0400
committerBrad King <brad.king@kitware.com>2016-09-26 15:35:39 -0400
commitcda8c782db80a1352ec6737b783558e35238bf17 (patch)
treeed394c893cd3b647fcf7c3e9c5bd1b6a553d4393 /Source/cmGlobalGenerator.h
parent1a5fddfe6d56733528ace3d15899b0739ea28054 (diff)
downloadcmake-cda8c782db80a1352ec6737b783558e35238bf17.tar.gz
cmGlobalGenerator: Optimize FindMakefile method with an index
This method is used by directory get/set APIs. With the new `SUBDIRECTORIES` and `BUILDSYSTEM_TARGETS` methods projects may now make heavy use of these APIs to traverse their directory structure and process targets. Make this faster by indexing the directory lookups.
Diffstat (limited to 'Source/cmGlobalGenerator.h')
-rw-r--r--Source/cmGlobalGenerator.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 7bc389d878..8f1d70c1a5 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -462,13 +462,16 @@ private:
typedef std::unordered_map<std::string, cmTarget*> TargetMap;
typedef std::unordered_map<std::string, cmGeneratorTarget*>
GeneratorTargetMap;
+ typedef std::unordered_map<std::string, cmMakefile*> MakefileMap;
#else
typedef cmsys::hash_map<std::string, cmTarget*> TargetMap;
typedef cmsys::hash_map<std::string, cmGeneratorTarget*> GeneratorTargetMap;
+ typedef cmsys::hash_map<std::string, cmMakefile*> MakefileMap;
#endif
#else
typedef std::map<std::string, cmTarget*> TargetMap;
typedef std::map<std::string, cmGeneratorTarget*> GeneratorTargetMap;
+ typedef std::map<std::string, cmMakefile*> MakefileMap;
#endif
// Map efficiently from target name to cmTarget instance.
// Do not use this structure for looping over all targets.
@@ -476,6 +479,11 @@ private:
TargetMap TargetSearchIndex;
GeneratorTargetMap GeneratorTargetSearchIndex;
+ // Map efficiently from source directory path to cmMakefile instance.
+ // Do not use this structure for looping over all directories.
+ // It may not contain all of them (see note in IndexMakefile method).
+ MakefileMap MakefileSearchIndex;
+
cmMakefile* TryCompileOuterMakefile;
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
@@ -528,6 +536,8 @@ private:
void ClearGeneratorMembers();
+ void IndexMakefile(cmMakefile* mf);
+
virtual const char* GetBuildIgnoreErrorsFlag() const { return CM_NULLPTR; }
// Cache directory content and target files to be built.