[Cmake-commits] [cmake-commits] king committed cmDepends.cxx 1.17 1.18 cmDepends.h 1.14 1.15 cmDependsC.cxx 1.33 1.34 cmDependsC.h 1.20 1.21 cmDependsFortran.cxx 1.47 1.48 cmDependsFortran.h 1.14 1.15 cmLocalUnixMakefileGenerator3.cxx 1.248 1.249
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu May 8 10:09:16 EDT 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv6804/Source
Modified Files:
cmDepends.cxx cmDepends.h cmDependsC.cxx cmDependsC.h
cmDependsFortran.cxx cmDependsFortran.h
cmLocalUnixMakefileGenerator3.cxx
Log Message:
ENH: Light refactoring of implicit dependency scanning configuration implementation.
- Move lookup of config variables from cmLocalUnixMakefileGenerator3 to cmDepends hierarchy.
Index: cmDependsFortran.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortran.cxx,v
retrieving revision 1.47
retrieving revision 1.48
diff -C 2 -d -r1.47 -r1.48
*** cmDependsFortran.cxx 21 Apr 2008 15:15:55 -0000 1.47
--- cmDependsFortran.cxx 8 May 2008 14:09:14 -0000 1.48
***************
*** 132,136 ****
//----------------------------------------------------------------------------
cmDependsFortran::cmDependsFortran():
! IncludePath(0), PPDefinitions(0), Internal(0)
{
}
--- 132,136 ----
//----------------------------------------------------------------------------
cmDependsFortran::cmDependsFortran():
! PPDefinitions(0), Internal(0)
{
}
***************
*** 138,146 ****
//----------------------------------------------------------------------------
cmDependsFortran
! ::cmDependsFortran(std::vector<std::string> const& includes,
! std::vector<std::string> const& definitions):
! IncludePath(&includes),
Internal(new cmDependsFortranInternals)
{
// translate i.e. FOO=BAR to FOO and add it to the list of defined
// preprocessor symbols
--- 138,154 ----
//----------------------------------------------------------------------------
cmDependsFortran
! ::cmDependsFortran(cmLocalGenerator* lg):
! cmDepends(lg),
Internal(new cmDependsFortranInternals)
{
+ // Get the list of definitions.
+ std::vector<std::string> definitions;
+ cmMakefile* mf = this->LocalGenerator->GetMakefile();
+ if(const char* c_defines =
+ mf->GetDefinition("CMAKE_TARGET_DEFINITIONS"))
+ {
+ cmSystemTools::ExpandListArgument(c_defines, definitions);
+ }
+
// translate i.e. FOO=BAR to FOO and add it to the list of defined
// preprocessor symbols
***************
*** 179,187 ****
return false;
}
- if(!this->IncludePath)
- {
- cmSystemTools::Error("Cannot scan dependencies without an include path.");
- return false;
- }
// Get the information object for this source.
--- 187,190 ----
***************
*** 596,600 ****
std::string fullName;
for(std::vector<std::string>::const_iterator i =
! this->IncludePath->begin(); i != this->IncludePath->end(); ++i)
{
// Try the lower-case name.
--- 599,603 ----
std::string fullName;
for(std::vector<std::string>::const_iterator i =
! this->IncludePath.begin(); i != this->IncludePath.end(); ++i)
{
// Try the lower-case name.
***************
*** 888,892 ****
// Search the include path for the file.
for(std::vector<std::string>::const_iterator i =
! this->IncludePath->begin(); i != this->IncludePath->end(); ++i)
{
fullName = *i;
--- 891,895 ----
// Search the include path for the file.
for(std::vector<std::string>::const_iterator i =
! this->IncludePath.begin(); i != this->IncludePath.end(); ++i)
{
fullName = *i;
Index: cmDependsFortran.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortran.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C 2 -d -r1.14 -r1.15
*** cmDependsFortran.h 9 Jan 2008 15:30:10 -0000 1.14
--- cmDependsFortran.h 8 May 2008 14:09:14 -0000 1.15
***************
*** 37,42 ****
file from which to start scanning, the include file search
path, and the target directory. */
! cmDependsFortran(std::vector<std::string> const& includes,
! std::vector<std::string> const& defines);
/** Virtual destructor to cleanup subclasses properly. */
--- 37,41 ----
file from which to start scanning, the include file search
path, and the target directory. */
! cmDependsFortran(cmLocalGenerator* lg);
/** Virtual destructor to cleanup subclasses properly. */
***************
*** 86,91 ****
std::string SourceFile;
- // The include file search path.
- std::vector<std::string> const* IncludePath;
std::vector<std::string> PPDefinitions;
--- 85,88 ----
Index: cmDepends.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDepends.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -C 2 -d -r1.17 -r1.18
*** cmDepends.cxx 28 Dec 2007 16:49:59 -0000 1.17
--- cmDepends.cxx 8 May 2008 14:09:14 -0000 1.18
***************
*** 25,33 ****
//----------------------------------------------------------------------------
! cmDepends::cmDepends():
CompileDirectory(),
! LocalGenerator(0),
Verbose(false),
FileComparison(0),
MaxPath(cmSystemTools::GetMaximumFilePathLength()),
Dependee(new char[MaxPath]),
--- 25,34 ----
//----------------------------------------------------------------------------
! cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir):
CompileDirectory(),
! LocalGenerator(lg),
Verbose(false),
FileComparison(0),
+ TargetDirectory(targetDir),
MaxPath(cmSystemTools::GetMaximumFilePathLength()),
Dependee(new char[MaxPath]),
***************
*** 232,234 ****
}
!
--- 233,246 ----
}
! //----------------------------------------------------------------------------
! void cmDepends::SetIncludePathFromLanguage(const char* lang)
! {
! std::string includePathVar = "CMAKE_";
! includePathVar += lang;
! includePathVar += "_INCLUDE_PATH";
! cmMakefile* mf = this->LocalGenerator->GetMakefile();
! if(const char* includePath = mf->GetDefinition(includePathVar.c_str()))
! {
! cmSystemTools::ExpandListArgument(includePath, this->IncludePath);
! }
! }
Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.248
retrieving revision 1.249
diff -C 2 -d -r1.248 -r1.249
*** cmLocalUnixMakefileGenerator3.cxx 7 May 2008 21:25:05 -0000 1.248
--- cmLocalUnixMakefileGenerator3.cxx 8 May 2008 14:09:14 -0000 1.249
***************
*** 1474,1512 ****
// construct the checker
std::string lang = li->c_str();
-
- // Get the set of include directories.
- std::vector<std::string> includes;
- if(haveDirectoryInfo)
- {
- std::string includePathVar = "CMAKE_";
- includePathVar += lang;
- includePathVar += "_INCLUDE_PATH";
- if(const char* includePath = mf->GetDefinition(includePathVar.c_str()))
- {
- cmSystemTools::ExpandListArgument(includePath, includes);
- }
- }
-
- // Get the include file regular expression.
- std::string includeRegexScan = "^.*$";
- std::string includeRegexComplain = "^$";
- if(haveDirectoryInfo)
- {
- std::string scanRegexVar = "CMAKE_";
- scanRegexVar += lang;
- scanRegexVar += "_INCLUDE_REGEX_SCAN";
- if(const char* scanRegex = mf->GetDefinition(scanRegexVar.c_str()))
- {
- includeRegexScan = scanRegex;
- }
- std::string complainRegexVar = "CMAKE_";
- complainRegexVar += lang;
- complainRegexVar += "_INCLUDE_REGEX_COMPLAIN";
- if(const char* complainRegex =
- mf->GetDefinition(complainRegexVar.c_str()))
- {
- includeRegexComplain = complainRegex;
- }
- }
// Create the scanner for this language
--- 1474,1477 ----
***************
*** 1514,1539 ****
if(lang == "C" || lang == "CXX" || lang == "RC")
{
- std::string includeCacheFileName = dir;
- includeCacheFileName += "/";
- includeCacheFileName += lang;
- includeCacheFileName += ".includecache";
-
// TODO: Handle RC (resource files) dependencies correctly.
! scanner = new cmDependsC(includes,
! includeRegexScan.c_str(),
! includeRegexComplain.c_str(),
! includeCacheFileName);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
else if(lang == "Fortran")
{
! std::vector<std::string> defines;
! if(const char* c_defines =
! mf->GetDefinition("CMAKE_TARGET_DEFINITIONS"))
! {
! cmSystemTools::ExpandListArgument(c_defines, defines);
! }
!
! scanner = new cmDependsFortran(includes, defines);
}
else if(lang == "Java")
--- 1479,1489 ----
if(lang == "C" || lang == "CXX" || lang == "RC")
{
// TODO: Handle RC (resource files) dependencies correctly.
! scanner = new cmDependsC(this, targetDir, lang.c_str());
}
#ifdef CMAKE_BUILD_WITH_CMAKE
else if(lang == "Fortran")
{
! scanner = new cmDependsFortran(this);
}
else if(lang == "Java")
Index: cmDependsC.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsC.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C 2 -d -r1.20 -r1.21
*** cmDependsC.h 5 Feb 2007 14:48:38 -0000 1.20
--- cmDependsC.h 8 May 2008 14:09:14 -0000 1.21
***************
*** 31,37 ****
relative path from the build directory to the target file. */
cmDependsC();
! cmDependsC(std::vector<std::string> const& includes,
! const char* scanRegex, const char* complainRegex,
! const cmStdString& cachFileName);
/** Virtual destructor to cleanup subclasses properly. */
--- 31,35 ----
relative path from the build directory to the target file. */
cmDependsC();
! cmDependsC(cmLocalGenerator* lg, const char* targetDir, const char* lang);
/** Virtual destructor to cleanup subclasses properly. */
***************
*** 51,57 ****
const cmStdString& fullName);
- // The include file search path.
- std::vector<std::string> const* IncludePath;
-
// Regular expression to identify C preprocessor include directives.
cmsys::RegularExpression IncludeRegexLine;
--- 49,52 ----
***************
*** 61,67 ****
cmsys::RegularExpression IncludeRegexScan;
cmsys::RegularExpression IncludeRegexComplain;
! const std::string IncludeRegexLineString;
! const std::string IncludeRegexScanString;
! const std::string IncludeRegexComplainString;
public:
--- 56,62 ----
cmsys::RegularExpression IncludeRegexScan;
cmsys::RegularExpression IncludeRegexComplain;
! std::string IncludeRegexLineString;
! std::string IncludeRegexScanString;
! std::string IncludeRegexComplainString;
public:
Index: cmDependsC.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsC.cxx,v
retrieving revision 1.33
retrieving revision 1.34
diff -C 2 -d -r1.33 -r1.34
*** cmDependsC.cxx 15 Dec 2007 01:31:27 -0000 1.33
--- cmDependsC.cxx 8 May 2008 14:09:14 -0000 1.34
***************
*** 19,22 ****
--- 19,23 ----
#include "cmFileTimeComparison.h"
#include "cmLocalGenerator.h"
+ #include "cmMakefile.h"
#include "cmSystemTools.h"
***************
*** 32,54 ****
//----------------------------------------------------------------------------
! cmDependsC::cmDependsC():
! IncludePath(0)
{
}
//----------------------------------------------------------------------------
! // yummy look at all those constructor arguments
! cmDependsC::cmDependsC(std::vector<std::string> const& includes,
! const char* scanRegex, const char* complainRegex,
! const cmStdString& cacheFileName):
! IncludePath(&includes),
! IncludeRegexLine(INCLUDE_REGEX_LINE),
! IncludeRegexScan(scanRegex),
! IncludeRegexComplain(complainRegex),
! IncludeRegexLineString(INCLUDE_REGEX_LINE_MARKER INCLUDE_REGEX_LINE),
! IncludeRegexScanString(std::string(INCLUDE_REGEX_SCAN_MARKER)+scanRegex),
! IncludeRegexComplainString(
! std::string(INCLUDE_REGEX_COMPLAIN_MARKER)+complainRegex),
! CacheFileName(cacheFileName)
{
this->ReadCacheFile();
}
--- 33,83 ----
//----------------------------------------------------------------------------
! cmDependsC::cmDependsC()
{
}
+
//----------------------------------------------------------------------------
! cmDependsC::cmDependsC(cmLocalGenerator* lg, const char* targetDir,
! const char* lang): cmDepends(lg, targetDir)
{
+ cmMakefile* mf = lg->GetMakefile();
+
+ // Configure the include file search path.
+ this->SetIncludePathFromLanguage(lang);
+
+ // Configure regular expressions.
+ std::string scanRegex = "^.*$";
+ std::string complainRegex = "^$";
+ {
+ std::string scanRegexVar = "CMAKE_";
+ scanRegexVar += lang;
+ scanRegexVar += "_INCLUDE_REGEX_SCAN";
+ if(const char* sr = mf->GetDefinition(scanRegexVar.c_str()))
+ {
+ scanRegex = sr;
+ }
+ std::string complainRegexVar = "CMAKE_";
+ complainRegexVar += lang;
+ complainRegexVar += "_INCLUDE_REGEX_COMPLAIN";
+ if(const char* cr = mf->GetDefinition(complainRegexVar.c_str()))
+ {
+ complainRegex = cr;
+ }
+ }
+
+ this->IncludeRegexLine.compile(INCLUDE_REGEX_LINE);
+ this->IncludeRegexScan.compile(scanRegex.c_str());
+ this->IncludeRegexComplain.compile(complainRegex.c_str());
+ this->IncludeRegexLineString = INCLUDE_REGEX_LINE_MARKER INCLUDE_REGEX_LINE;
+ this->IncludeRegexScanString = INCLUDE_REGEX_SCAN_MARKER;
+ this->IncludeRegexScanString += scanRegex;
+ this->IncludeRegexComplainString = INCLUDE_REGEX_COMPLAIN_MARKER;
+ this->IncludeRegexComplainString += complainRegex;
+
+ this->CacheFileName = this->TargetDirectory;
+ this->CacheFileName += "/";
+ this->CacheFileName += lang;
+ this->CacheFileName += ".includecache";
+
this->ReadCacheFile();
}
***************
*** 81,89 ****
return false;
}
- if(!this->IncludePath)
- {
- cmSystemTools::Error("Cannot scan dependencies without an include path.");
- return false;
- }
// Walk the dependency graph starting with the source file.
--- 110,113 ----
***************
*** 139,143 ****
for(std::vector<std::string>::const_iterator i =
! this->IncludePath->begin(); i != this->IncludePath->end(); ++i)
{
cacheKey+=*i;
--- 163,167 ----
for(std::vector<std::string>::const_iterator i =
! this->IncludePath.begin(); i != this->IncludePath.end(); ++i)
{
cacheKey+=*i;
***************
*** 150,154 ****
}
else for(std::vector<std::string>::const_iterator i =
! this->IncludePath->begin(); i != this->IncludePath->end(); ++i)
{
// Construct the name of the file as if it were in the current
--- 174,178 ----
}
else for(std::vector<std::string>::const_iterator i =
! this->IncludePath.begin(); i != this->IncludePath.end(); ++i)
{
// Construct the name of the file as if it were in the current
Index: cmDepends.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDepends.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C 2 -d -r1.14 -r1.15
*** cmDepends.h 28 Dec 2007 16:49:59 -0000 1.14
--- cmDepends.h 8 May 2008 14:09:14 -0000 1.15
***************
*** 35,39 ****
/** Instances need to know the build directory name and the relative
path from the build directory to the target file. */
! cmDepends();
/** at what level will the compile be done from */
--- 35,39 ----
/** Instances need to know the build directory name and the relative
path from the build directory to the target file. */
! cmDepends(cmLocalGenerator* lg=0, const char* targetDir="");
/** at what level will the compile be done from */
***************
*** 109,112 ****
--- 109,117 ----
char* Depender;
+ // The include file search path.
+ std::vector<std::string> IncludePath;
+
+ void SetIncludePathFromLanguage(const char* lang);
+
private:
cmDepends(cmDepends const&); // Purposely not implemented.
More information about the Cmake-commits
mailing list