diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2003-07-28 22:12:23 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2003-07-28 22:12:23 (GMT) |
commit | 2ba1c0ab062ede8b85775a97accc01da0e7fb040 (patch) | |
tree | 7c06a436fbf4658df6c750b61cf27da2c477858a /Source/cmMakeDepend.cxx | |
parent | 3d27a6a39114aa97422fb3a431262a35a6dc113d (diff) | |
download | CMake-2ba1c0ab062ede8b85775a97accc01da0e7fb040.zip CMake-2ba1c0ab062ede8b85775a97accc01da0e7fb040.tar.gz CMake-2ba1c0ab062ede8b85775a97accc01da0e7fb040.tar.bz2 |
ENH: performance fixes for network depends
Diffstat (limited to 'Source/cmMakeDepend.cxx')
-rw-r--r-- | Source/cmMakeDepend.cxx | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index e8812e7..3f6b38e 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -230,10 +230,7 @@ void cmMakeDepend::DependWalk(cmDependInformation* info) void cmMakeDepend::AddDependency(cmDependInformation* info, const char* file) { cmDependInformation* dependInfo = - this->GetDependInformation(file, - cmSystemTools::GetFilenamePath( - cmSystemTools::CollapseFullPath( - info->m_FullPath.c_str())).c_str()); + this->GetDependInformation(file, info->m_PathOnly.c_str()); this->GenerateDependInformation(dependInfo); info->AddDependencies(dependInfo); } @@ -257,6 +254,7 @@ cmDependInformation* cmMakeDepend::GetDependInformation(const char* file, // Didn't find an instance. Create a new one and save it. cmDependInformation* info = new cmDependInformation; info->m_FullPath = fullPath; + info->m_PathOnly = cmSystemTools::GetFilenamePath(fullPath.c_str()); info->m_IncludeName = file; m_DependInformationMap[fullPath] = info; return info; @@ -291,9 +289,31 @@ void cmMakeDepend::GenerateMakefileDependencies() // find the full path to fname by searching the m_IncludeDirectories array std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) { + DirectoryToFileToPathMap::iterator m; + if(extraPath) + { + m = m_DirectoryToFileToPathMap.find(extraPath); + } + else + { + m = m_DirectoryToFileToPathMap.find(""); + } + + if(m != m_DirectoryToFileToPathMap.end()) + { + FileToPathMap& map = m->second; + FileToPathMap::iterator p = map.find(fname); + if(p != map.end()) + { + return p->second; + } + } + if(cmSystemTools::FileExists(fname)) { - return std::string(cmSystemTools::CollapseFullPath(fname)); + std::string fp = cmSystemTools::CollapseFullPath(fname); + m_DirectoryToFileToPathMap[extraPath? extraPath: ""][fname] = fp; + return fp; } for(std::vector<std::string>::iterator i = m_IncludeDirectories.begin(); @@ -307,7 +327,9 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) path = path + fname; if(cmSystemTools::FileExists(path.c_str())) { - return cmSystemTools::CollapseFullPath(path.c_str()); + std::string fp = cmSystemTools::CollapseFullPath(path.c_str()); + m_DirectoryToFileToPathMap[extraPath? extraPath: ""][fname] = fp; + return fp; } } @@ -321,7 +343,9 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) path = path + fname; if(cmSystemTools::FileExists(path.c_str())) { - return cmSystemTools::CollapseFullPath(path.c_str()); + std::string fp = cmSystemTools::CollapseFullPath(path.c_str()); + m_DirectoryToFileToPathMap[extraPath][fname] = fp; + return fp; } } |