[cmake-commits] king committed cmDepends.cxx 1.15 1.16 cmDepends.h
1.12 1.13 cmDependsFortran.cxx 1.31 1.32 cmDependsFortran.h 1.8
1.9 cmLocalUnixMakefileGenerator3.cxx 1.225 1.226
cmake-commits at cmake.org
cmake-commits at cmake.org
Sat Dec 22 22:41:44 EST 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv11474/Source
Modified Files:
cmDepends.cxx cmDepends.h cmDependsFortran.cxx
cmDependsFortran.h cmLocalUnixMakefileGenerator3.cxx
Log Message:
ENH: Convert cmDepends object interface to scan an entire target at once.
Index: cmDependsFortran.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortran.cxx,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- cmDependsFortran.cxx 19 Dec 2007 21:35:09 -0000 1.31
+++ cmDependsFortran.cxx 23 Dec 2007 03:41:42 -0000 1.32
@@ -90,9 +90,8 @@
}
//----------------------------------------------------------------------------
-cmDependsFortran::cmDependsFortran(std::vector<std::string> const& includes,
- std::string const& targetDirectory):
- IncludePath(&includes), TargetDirectory(targetDirectory)
+cmDependsFortran::cmDependsFortran(std::vector<std::string> const& includes):
+ IncludePath(&includes)
{
}
Index: cmDepends.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDepends.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cmDepends.cxx 19 Dec 2007 21:36:29 -0000 1.15
+++ cmDepends.cxx 23 Dec 2007 03:41:42 -0000 1.16
@@ -16,6 +16,8 @@
=========================================================================*/
#include "cmDepends.h"
+#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmFileTimeComparison.h"
@@ -41,10 +43,39 @@
}
//----------------------------------------------------------------------------
-bool cmDepends::Write(const char *src, const char *obj,
- std::ostream &makeDepends, std::ostream &internalDepends)
+bool cmDepends::Write(std::ostream &makeDepends,
+ std::ostream &internalDepends)
{
- return this->WriteDependencies(src, obj, makeDepends, internalDepends);
+ // Lookup the set of sources to scan.
+ std::string srcLang = "CMAKE_DEPENDS_CHECK_";
+ srcLang += this->Language;
+ cmMakefile* mf = this->LocalGenerator->GetMakefile();
+ const char* srcStr = mf->GetSafeDefinition(srcLang.c_str());
+ std::vector<std::string> pairs;
+ cmSystemTools::ExpandListArgument(srcStr, pairs);
+
+ for(std::vector<std::string>::iterator si = pairs.begin();
+ si != pairs.end();)
+ {
+ // Get the source and object file.
+ std::string const& src = *si++;
+ if(si == pairs.end()) { break; }
+ std::string obj = *si++;
+
+ // Make sure the object file is relative to the top of the build tree.
+ obj = this->LocalGenerator->Convert(obj.c_str(),
+ cmLocalGenerator::HOME_OUTPUT,
+ cmLocalGenerator::MAKEFILE);
+
+ // Write the dependencies for this pair.
+ if(!this->WriteDependencies(src.c_str(), obj.c_str(),
+ makeDepends, internalDepends))
+ {
+ return false;
+ }
+ }
+
+ return true;
}
//----------------------------------------------------------------------------
Index: cmDepends.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDepends.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cmDepends.h 19 Dec 2007 21:36:29 -0000 1.12
+++ cmDepends.h 23 Dec 2007 03:41:42 -0000 1.13
@@ -45,6 +45,12 @@
directory. */
void SetLocalGenerator(cmLocalGenerator* lg) { this->LocalGenerator = lg; }
+ /** Set the specific language to be scanned. */
+ void SetLanguage(const char* lang) { this->Language = lang; }
+
+ /** Set the target build directory. */
+ void SetTargetDirectory(const char* dir) { this->TargetDirectory = dir; }
+
/** should this be verbose in its output */
void SetVerbose(bool verb) { this->Verbose = verb; }
@@ -52,8 +58,7 @@
virtual ~cmDepends();
/** Write dependencies for the target file. */
- bool Write(const char *src, const char *obj,
- std::ostream &makeDepends, std::ostream &internalDepends);
+ bool Write(std::ostream &makeDepends, std::ostream &internalDepends);
/** Check dependencies for the target file. Returns true if
dependencies are okay and false if they must be generated. If
@@ -90,6 +95,11 @@
bool Verbose;
cmFileTimeComparison* FileComparison;
+ std::string Language;
+
+ // The full path to the target's build directory.
+ std::string TargetDirectory;
+
size_t MaxPath;
char* Dependee;
char* Depender;
Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -d -r1.225 -r1.226
--- cmLocalUnixMakefileGenerator3.cxx 21 Dec 2007 17:22:12 -0000 1.225
+++ cmLocalUnixMakefileGenerator3.cxx 23 Dec 2007 03:41:42 -0000 1.226
@@ -1412,7 +1412,7 @@
#ifdef CMAKE_BUILD_WITH_CMAKE
else if(lang == "Fortran")
{
- scanner = new cmDependsFortran(includes, dir);
+ scanner = new cmDependsFortran(includes);
}
else if(lang == "Java")
{
@@ -1425,23 +1425,9 @@
scanner->SetLocalGenerator(this);
scanner->SetFileComparison
(this->GlobalGenerator->GetCMakeInstance()->GetFileComparison());
- // for each file we need to scan
- std::string srcLang = "CMAKE_DEPENDS_CHECK_";
- srcLang += lang;
- const char *srcStr = mf->GetSafeDefinition(srcLang.c_str());
- std::vector<std::string> srcs;
- cmSystemTools::ExpandListArgument(srcStr, srcs);
- for (std::vector<std::string>::iterator si =
- srcs.begin(); si != srcs.end(); ++si)
- {
- std::string &src = *si;
- ++si;
- // make sure the object file is relative to home output
- std::string obj = *si;
- obj = this->Convert(obj.c_str(),HOME_OUTPUT,MAKEFILE);
- scanner->Write(src.c_str(),obj.c_str(),
- ruleFileStream, internalRuleFileStream);
- }
+ scanner->SetLanguage(lang.c_str());
+ scanner->SetTargetDirectory(dir.c_str());
+ scanner->Write(ruleFileStream, internalRuleFileStream);
// free the scanner for this language
delete scanner;
Index: cmDependsFortran.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortran.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cmDependsFortran.h 19 Dec 2007 19:28:46 -0000 1.8
+++ cmDependsFortran.h 23 Dec 2007 03:41:42 -0000 1.9
@@ -33,8 +33,7 @@
path from the build directory to the target file, the source
file from which to start scanning, the include file search
path, and the target directory. */
- cmDependsFortran(std::vector<std::string> const& includes,
- std::string const& targetDirectory);
+ cmDependsFortran(std::vector<std::string> const& includes);
/** Virtual destructor to cleanup subclasses properly. */
virtual ~cmDependsFortran();
@@ -62,9 +61,6 @@
// The include file search path.
std::vector<std::string> const* IncludePath;
- // The full path to the target's build directory.
- std::string TargetDirectory;
-
private:
cmDependsFortran(cmDependsFortran const&); // Purposely not implemented.
void operator=(cmDependsFortran const&); // Purposely not implemented.
More information about the Cmake-commits
mailing list