2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2005-01-19 01:09:05 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2005-01-19 01:09:05 +03:00
|
|
|
|
2009-09-28 19:43:28 +04: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-19 01:09:05 +03:00
|
|
|
#ifndef cmDepends_h
|
|
|
|
#define cmDepends_h
|
|
|
|
|
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
|
2005-10-12 21:52:29 +04:00
|
|
|
class cmFileTimeComparison;
|
2006-05-25 17:47:30 +04:00
|
|
|
class cmLocalGenerator;
|
2005-10-12 21:52:29 +04:00
|
|
|
|
2005-01-19 01:09:05 +03: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 18:09:14 +04:00
|
|
|
cmDepends(cmLocalGenerator* lg=0, const char* targetDir="");
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2005-05-25 20:22:32 +04:00
|
|
|
/** at what level will the compile be done from */
|
2014-04-03 23:35:22 +04:00
|
|
|
void SetCompileDirectory(const char *dir) {this->CompileDirectory = dir;}
|
2006-05-25 17:47:30 +04: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 06:41:42 +03:00
|
|
|
/** Set the specific language to be scanned. */
|
2014-02-04 06:20:56 +04:00
|
|
|
void SetLanguage(const std::string& lang) { this->Language = lang; }
|
2007-12-23 06:41:42 +03:00
|
|
|
|
|
|
|
/** Set the target build directory. */
|
|
|
|
void SetTargetDirectory(const char* dir) { this->TargetDirectory = dir; }
|
|
|
|
|
2005-05-11 21:16:45 +04:00
|
|
|
/** should this be verbose in its output */
|
2006-03-15 19:02:08 +03:00
|
|
|
void SetVerbose(bool verb) { this->Verbose = verb; }
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2005-01-19 01:09:05 +03:00
|
|
|
/** Virtual destructor to cleanup subclasses properly. */
|
|
|
|
virtual ~cmDepends();
|
|
|
|
|
|
|
|
/** Write dependencies for the target file. */
|
2007-12-23 06:41:42 +03:00
|
|
|
bool Write(std::ostream &makeDepends, std::ostream &internalDepends);
|
2009-09-23 22:02:05 +04:00
|
|
|
|
|
|
|
class DependencyVector: public std::vector<std::string> {};
|
|
|
|
|
2007-12-20 00:36:30 +03: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 22:02:05 +04: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-19 01:09:05 +03:00
|
|
|
|
|
|
|
/** Clear dependencies for the target file so they will be regenerated. */
|
2005-07-27 17:49:37 +04:00
|
|
|
void Clear(const char *file);
|
2005-01-19 01:09:05 +03:00
|
|
|
|
2005-10-12 21:52:29 +04:00
|
|
|
/** Set the file comparison object */
|
2012-08-13 21:42:58 +04:00
|
|
|
void SetFileComparison(cmFileTimeComparison* fc) {
|
2006-03-15 19:02:08 +03:00
|
|
|
this->FileComparison = fc; }
|
2005-10-12 21:52:29 +04:00
|
|
|
|
2005-01-19 01:09:05 +03:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// Write dependencies for the target file to the given stream.
|
|
|
|
// Return true for success and false for failure.
|
2012-09-30 19:53:01 +04:00
|
|
|
virtual bool WriteDependencies(const std::set<std::string>& sources,
|
|
|
|
const std::string& obj,
|
|
|
|
std::ostream& makeDepends,
|
|
|
|
std::ostream& internalDepends);
|
2005-01-19 01:09:05 +03:00
|
|
|
|
|
|
|
// Check dependencies for the target file in the given stream.
|
|
|
|
// Return false if dependencies must be regenerated and true
|
|
|
|
// otherwise.
|
2009-09-23 22:02:05 +04:00
|
|
|
virtual bool CheckDependencies(std::istream& internalDepends,
|
2012-08-17 00:46:33 +04:00
|
|
|
const char* internalDependsFileName,
|
2009-09-23 22:02:05 +04:00
|
|
|
std::map<std::string, DependencyVector>& validDeps);
|
2005-01-19 01:09:05 +03:00
|
|
|
|
2007-12-28 19:49:59 +03:00
|
|
|
// Finalize the dependency information for the target.
|
|
|
|
virtual bool Finalize(std::ostream& makeDepends,
|
|
|
|
std::ostream& internalDepends);
|
|
|
|
|
2005-01-19 01:09:05 +03:00
|
|
|
// The directory in which the build rule for the target file is executed.
|
2006-03-15 19:02:08 +03:00
|
|
|
std::string CompileDirectory;
|
2005-01-19 01:09:05 +03:00
|
|
|
|
2006-05-25 17:47:30 +04:00
|
|
|
// The local generator.
|
|
|
|
cmLocalGenerator* LocalGenerator;
|
2006-05-03 18:07:08 +04:00
|
|
|
|
2005-05-06 17:58:58 +04:00
|
|
|
// Flag for verbose output.
|
2006-03-15 19:02:08 +03:00
|
|
|
bool Verbose;
|
|
|
|
cmFileTimeComparison* FileComparison;
|
2005-10-12 21:52:29 +04:00
|
|
|
|
2007-12-23 06:41:42 +03:00
|
|
|
std::string Language;
|
|
|
|
|
|
|
|
// The full path to the target's build directory.
|
|
|
|
std::string TargetDirectory;
|
|
|
|
|
2006-03-15 19:02:08 +03:00
|
|
|
size_t MaxPath;
|
|
|
|
char* Dependee;
|
|
|
|
char* Depender;
|
2005-05-06 17:58:58 +04:00
|
|
|
|
2008-05-08 18:09:14 +04:00
|
|
|
// The include file search path.
|
|
|
|
std::vector<std::string> IncludePath;
|
|
|
|
|
2014-02-04 06:20:56 +04:00
|
|
|
void SetIncludePathFromLanguage(const std::string& lang);
|
2008-05-08 18:09:14 +04:00
|
|
|
|
2005-01-19 01:09:05 +03:00
|
|
|
private:
|
|
|
|
cmDepends(cmDepends const&); // Purposely not implemented.
|
|
|
|
void operator=(cmDepends const&); // Purposely not implemented.
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|