Add cmake support, bug1363.

Signed-off-by: Wilson Snyder <[email protected]>
This commit is contained in:
Patrick Stewart
2019-10-17 19:44:10 -04:00
committed by Wilson Snyder
parent 1232746395
commit 1e4f471049
41 changed files with 1987 additions and 65 deletions
+19 -1
View File
@@ -65,17 +65,19 @@ class V3FileDependImp {
class DependFile {
// A single file
bool m_target; // True if write, else read
bool m_exists;
string m_filename; // Filename
struct stat m_stat; // Stat information
public:
DependFile(const string& filename, bool target)
: m_target(target), m_filename(filename) {
: m_target(target), m_exists(true), m_filename(filename) {
m_stat.st_ctime = 0;
m_stat.st_mtime = 0;
}
~DependFile() {}
const string& filename() const { return m_filename; }
bool target() const { return m_target; }
bool exists() const { return m_exists; }
off_t size() const { return m_stat.st_size; }
ino_t ino() const { return m_stat.st_ino; }
time_t cstime() const { return m_stat.st_ctime; } // Seconds
@@ -89,6 +91,7 @@ class V3FileDependImp {
if (err!=0) {
memset(&m_stat, 0, sizeof(m_stat));
m_stat.st_mtime = 1;
m_exists = false;
// Not an error... This can occur due to `line directives in the .vpp files
UINFO(1,"-Info: File not statable: "<<filename()<<endl);
}
@@ -125,6 +128,7 @@ public:
}
}
void writeDepend(const string& filename);
std::vector<string> getAllDeps() const;
void writeTimes(const string& filename, const string& cmdlineIn);
bool checkTimes(const string& filename, const string& cmdlineIn);
};
@@ -168,6 +172,17 @@ inline void V3FileDependImp::writeDepend(const string& filename) {
}
}
inline std::vector<string> V3FileDependImp::getAllDeps() const {
std::vector<string> r;
for (std::set<DependFile>::const_iterator iter=m_filenameList.begin();
iter!=m_filenameList.end(); ++iter) {
if (!iter->target() && iter->exists()) {
r.push_back(iter->filename());
}
}
return r;
}
inline void V3FileDependImp::writeTimes(const string& filename, const string& cmdlineIn) {
const vl_unique_ptr<std::ofstream> ofp (V3File::new_ofstream(filename));
if (ofp->fail()) v3fatal("Can't write "<<filename);
@@ -283,6 +298,9 @@ void V3File::addTgtDepend(const string& filename) {
void V3File::writeDepend(const string& filename) {
dependImp.writeDepend(filename);
}
std::vector<string> V3File::getAllDeps() {
return dependImp.getAllDeps();
}
void V3File::writeTimes(const string& filename, const string& cmdlineIn) {
dependImp.writeTimes(filename, cmdlineIn);
}