summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.h
diff options
context:
space:
mode:
authorNicolas Despres <nicolas.despres@gmail.com>2013-08-06 16:12:50 (GMT)
committerBrad King <brad.king@kitware.com>2013-08-06 20:17:13 (GMT)
commit2268c41a057d948ad6773c5145ee5bf6d19ea3bf (patch)
tree9f5b1b81cdcbd0d496f331bc659b542fd9e99d9f /Source/cmMakefile.h
parenteccb39d7f44f97d395b75b985b4e18178b72df8c (diff)
downloadCMake-2268c41a057d948ad6773c5145ee5bf6d19ea3bf.zip
CMake-2268c41a057d948ad6773c5145ee5bf6d19ea3bf.tar.gz
CMake-2268c41a057d948ad6773c5145ee5bf6d19ea3bf.tar.bz2
Optimize custom command full-path dependency lookup
In the common case of custom command dependencies specified via full path optimize the implementation of GetSourceFileWithOutput using a (hash) map. This is significantly faster than the existing linear search. In the non-full-path case fall back to the existing linear suffix search.
Diffstat (limited to 'Source/cmMakefile.h')
-rw-r--r--Source/cmMakefile.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 711a208..8bce9fd 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -29,6 +29,9 @@
#include <cmsys/auto_ptr.hxx>
#include <cmsys/RegularExpression.hxx>
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+# include <cmsys/hash_map.hxx>
+#endif
class cmFunctionBlocker;
class cmCommand;
@@ -1039,6 +1042,26 @@ private:
bool GeneratingBuildSystem;
+ /**
+ * Old version of GetSourceFileWithOutput(const char*) kept for
+ * backward-compatibility. It implements a linear search and support
+ * relative file paths. It is used as a fall back by
+ * GetSourceFileWithOutput(const char*).
+ */
+ cmSourceFile *LinearGetSourceFileWithOutput(const char *cname);
+
+ // A map for fast output to input look up.
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ typedef cmsys::hash_map<std::string, cmSourceFile*> OutputToSourceMap;
+#else
+ typedef std::map<std::string, cmSourceFile*> OutputToSourceMap;
+#endif
+ OutputToSourceMap OutputToSource;
+
+ void UpdateOutputToSourceMap(std::vector<std::string> const& outputs,
+ cmSourceFile* source);
+ void UpdateOutputToSourceMap(std::string const& output,
+ cmSourceFile* source);
};
//----------------------------------------------------------------------------