2009-09-28 15:43:28 +00:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2005-01-18 22:09:05 +00:00
|
|
|
|
2009-09-28 15:43:28 +00:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2005-01-18 22:09:05 +00:00
|
|
|
|
2009-09-28 15:43:28 +00:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2005-01-18 22:09:05 +00:00
|
|
|
#ifndef cmDepends_h
|
|
|
|
#define cmDepends_h
|
|
|
|
|
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
|
2005-10-12 17:52:29 +00:00
|
|
|
class cmFileTimeComparison;
|
2006-05-25 13:47:30 +00:00
|
|
|
class cmLocalGenerator;
|
2005-10-12 17:52:29 +00:00
|
|
|
|
2005-01-18 22:09:05 +00:00
|
|
|
/** \class cmDepends
|
|
|
|
* \brief Dependency scanner superclass.
|
|
|
|
*
|
|
|
|
* This class is responsible for maintaining a .depends.make file in
|
|
|
|
* the build tree corresponding to an object file. Subclasses help it
|
|
|
|
* maintain dependencies for particular languages.
|
|
|
|
*/
|
|
|
|
class cmDepends
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Instances need to know the build directory name and the relative
|
|
|
|
path from the build directory to the target file. */
|
2008-05-08 14:09:14 +00:00
|
|
|
cmDepends(cmLocalGenerator* lg=0, const char* targetDir="");
|
2012-08-13 17:42:58 +00:00
|
|
|
|
2005-05-25 16:22:32 +00:00
|
|
|
/** at what level will the compile be done from */
|
2006-03-15 16:02:08 +00:00
|
|
|
void SetCompileDirectory(const char *dir) {this->CompileDirectory = dir;};
|
2006-05-25 13:47:30 +00:00
|
|
|
|
|
|
|
/** Set the local generator for the directory in which we are
|
|
|
|
scanning dependencies. This is not a full local generator; it
|
|
|
|
has been setup to do relative path conversions for the current
|
|
|
|
directory. */
|
|
|
|
void SetLocalGenerator(cmLocalGenerator* lg) { this->LocalGenerator = lg; }
|
|
|
|
|
2007-12-23 03:41:42 +00:00
|
|
|
/** 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; }
|
|
|
|
|
2005-05-11 17:16:45 +00:00
|
|
|
/** should this be verbose in its output */
|
2006-03-15 16:02:08 +00:00
|
|
|
void SetVerbose(bool verb) { this->Verbose = verb; }
|
2012-08-13 17:42:58 +00:00
|
|
|
|
2005-01-18 22:09:05 +00:00
|
|
|
/** Virtual destructor to cleanup subclasses properly. */
|
|
|
|
virtual ~cmDepends();
|
|
|
|
|
|
|
|
/** Write dependencies for the target file. */
|
2007-12-23 03:41:42 +00:00
|
|
|
bool Write(std::ostream &makeDepends, std::ostream &internalDepends);
|
2009-09-23 18:02:05 +00:00
|
|
|
|
|
|
|
class DependencyVector: public std::vector<std::string> {};
|
|
|
|
|
2007-12-19 21:36:30 +00:00
|
|
|
/** Check dependencies for the target file. Returns true if
|
|
|
|
dependencies are okay and false if they must be generated. If
|
|
|
|
they must be generated Clear has already been called to wipe out
|
2009-09-23 18:02:05 +00:00
|
|
|
the old dependencies.
|
|
|
|
Dependencies which are still valid will be stored in validDeps. */
|
|
|
|
bool Check(const char *makeFile, const char* internalFile,
|
|
|
|
std::map<std::string, DependencyVector>& validDeps);
|
2005-01-18 22:09:05 +00:00
|
|
|
|
|
|
|
/** Clear dependencies for the target file so they will be regenerated. */
|
2005-07-27 13:49:37 +00:00
|
|
|
void Clear(const char *file);
|
2005-01-18 22:09:05 +00:00
|
|
|
|
2005-10-12 17:52:29 +00:00
|
|
|
/** Set the file comparison object */
|
2012-08-13 17:42:58 +00:00
|
|
|
void SetFileComparison(cmFileTimeComparison* fc) {
|
2006-03-15 16:02:08 +00:00
|
|
|
this->FileComparison = fc; }
|
2005-10-12 17:52:29 +00:00
|
|
|
|
2005-01-18 22:09:05 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// Write dependencies for the target file to the given stream.
|
|
|
|
// Return true for success and false for failure.
|
2005-10-12 17:52:29 +00:00
|
|
|
virtual bool WriteDependencies(const char *src, const char* obj,
|
2007-12-19 21:36:30 +00:00
|
|
|
std::ostream& makeDepends, std::ostream& internalDepends);
|
2005-01-18 22:09:05 +00:00
|
|
|
|
|
|
|
// Check dependencies for the target file in the given stream.
|
|
|
|
// Return false if dependencies must be regenerated and true
|
|
|
|
// otherwise.
|
2009-09-23 18:02:05 +00:00
|
|
|
virtual bool CheckDependencies(std::istream& internalDepends,
|
2012-08-16 20:46:33 +00:00
|
|
|
const char* internalDependsFileName,
|
2009-09-23 18:02:05 +00:00
|
|
|
std::map<std::string, DependencyVector>& validDeps);
|
2005-01-18 22:09:05 +00:00
|
|
|
|
2007-12-28 16:49:59 +00:00
|
|
|
// Finalize the dependency information for the target.
|
|
|
|
virtual bool Finalize(std::ostream& makeDepends,
|
|
|
|
std::ostream& internalDepends);
|
|
|
|
|
2005-01-18 22:09:05 +00:00
|
|
|
// The directory in which the build rule for the target file is executed.
|
2006-03-15 16:02:08 +00:00
|
|
|
std::string CompileDirectory;
|
2005-01-18 22:09:05 +00:00
|
|
|
|
2006-05-25 13:47:30 +00:00
|
|
|
// The local generator.
|
|
|
|
cmLocalGenerator* LocalGenerator;
|
2006-05-03 14:07:08 +00:00
|
|
|
|
2005-05-06 13:58:58 +00:00
|
|
|
// Flag for verbose output.
|
2006-03-15 16:02:08 +00:00
|
|
|
bool Verbose;
|
|
|
|
cmFileTimeComparison* FileComparison;
|
2005-10-12 17:52:29 +00:00
|
|
|
|
2007-12-23 03:41:42 +00:00
|
|
|
std::string Language;
|
|
|
|
|
|
|
|
// The full path to the target's build directory.
|
|
|
|
std::string TargetDirectory;
|
|
|
|
|
2006-03-15 16:02:08 +00:00
|
|
|
size_t MaxPath;
|
|
|
|
char* Dependee;
|
|
|
|
char* Depender;
|
2005-05-06 13:58:58 +00:00
|
|
|
|
2008-05-08 14:09:14 +00:00
|
|
|
// The include file search path.
|
|
|
|
std::vector<std::string> IncludePath;
|
|
|
|
|
|
|
|
void SetIncludePathFromLanguage(const char* lang);
|
|
|
|
|
2005-01-18 22:09:05 +00:00
|
|
|
private:
|
|
|
|
cmDepends(cmDepends const&); // Purposely not implemented.
|
|
|
|
void operator=(cmDepends const&); // Purposely not implemented.
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|