diff --git a/src/deptool.cpp b/src/deptool.cpp
index 7abeb89250cfc1f82b0c5f8992ae4c81011a4025..45a01c4e7517e5e619dd9376fc605c700870d119 100644 (file)
--- a/src/deptool.cpp
+++ b/src/deptool.cpp
std::map<String, FileRec *> files;
+ bool checked;
+
private:
void init()
{
+ type = UNKNOWN;
+ checked = false;
}
void assign(const FileRec &other)
baseName = other.baseName;
suffix = other.suffix;
files = other.files;
+ checked = other.checked;
}
};
*/
bool saveDepFile(bool doXml);
+ /**
+ *
+ */
+ bool saveCmakeFile();
+
/**
*
*/
char *fileBuf;
int fileSize;
+
+ static const int readBufLen = 8192;
+ char readBuf[8193];
};
if (fullname.size() < 2)
return;
- unsigned int pos = fullname.find_last_of('/');
+ String::size_type pos = fullname.find_last_of('/');
if (pos != fullname.npos && pos<fullname.size()-1)
{
path = fullname.substr(0, pos);
{
if (fname.size() < 2)
return "";
- unsigned int pos = fname.find_last_of('.');
+ String::size_type pos = fname.find_last_of('.');
if (pos == fname.npos)
return "";
pos++;
return false;
}
String buf;
- while (true)
+ while (!feof(f))
{
- int ch = fgetc(f);
- if (ch < 0)
- break;
- buf.push_back((char)ch);
+ int len = fread(readBuf, 1, readBufLen, f);
+ readBuf[len] = '\0';
+ buf.append(readBuf);
}
fclose(f);
if (!generateDependencies())
return false;
saveDepFile(false);
+ saveCmakeFile();
//saveRefFile(true);
return true;
}
}
+/**
+ * This is a new thing. It creates a cmake file that should be able to
+ * build the entire thing.
+ */
+bool DepTool::saveCmakeFile()
+{
+ time_t tim;
+ time(&tim);
+
+ FILE *f = fopen("CMakeLists.txt", "w");
+ if (!f)
+ {
+ trace("cannot open 'CMakeLists.txt' for writing");
+ }
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## File: CMakeLists.txt\n");
+ fprintf(f, "## Generated by DepTool at :%s", ctime(&tim));
+ fprintf(f, "########################################################\n");
+
+ fprintf(f, "\n\n");
+
+ fprintf(f, "\n\n\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## P R O J E C T\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "project (INKSCAPE)\n");
+ fprintf(f, "\n\n\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## O B J E C T S\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "set (INKSCAPE_SRCS\n");
+
+ std::map<String, FileRec *>::iterator oiter;
+ for (oiter=allFiles.begin() ; oiter!=allFiles.end() ; oiter++)
+ {
+ FileRec *frec = oiter->second;
+ if (frec->type == FileRec::CFILE)
+ {
+ //fprintf(f, " \\\n");
+ String fname = frec->path;
+ if (fname.size()>0)
+ fname.append("/");
+ fname.append(frec->baseName);
+ fname.append(".");
+ fname.append(frec->suffix);
+ fprintf(f, "%s\n", fname.c_str());
+ }
+ }
+ fprintf(f, ")\n\n");
+
+ fprintf(f, "add_executable (inkscape ${INKSCAPE_SRCS})\n");
+
+ fprintf(f, "\n\n\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## E N D\n");
+ fprintf(f, "########################################################\n");
+
+ fclose(f);
+
+ return true;
+}
+
+