use pch on the project. Removed all include that are now not necessary

This commit is contained in:
2026-08-04 19:31:31 -04:00
parent aabe585696
commit 5eb8fb7e9d
56 changed files with 131 additions and 1825 deletions
+19 -2
View File
@@ -844,8 +844,9 @@ static int CommandRunPlan(int argc, char* argv[])
return 0;
}
static void GenerateProject(const char* projectName, const char* projectDir, const char* guid, const char* includeSearchPath, const char* extraDefs, const char* debuggerCommandArgs, const char Srcs[64][256], int SrcCount, const char* defCommon, const char* defDebug, const char* defProfile, const char* defRelease)
static void GenerateProject(const char* projectName, const char* projectDir, const char* guid, const char* includeSearchPath, const char* extraDefs, const char* debuggerCommandArgs, const char Srcs[64][256], int SrcCount, const char* defCommon, const char* defDebug, const char* defProfile, const char* defRelease, const char* pchHeader, const char* pchSrc)
{
(void)pchSrc; // Unused for NMake projects
FilePathList* srcFiles = CreateFilePathList();
if (SrcCount > 0) {
for (int i = 0; i < SrcCount; i++) {
@@ -912,6 +913,11 @@ static void GenerateProject(const char* projectName, const char* projectDir, con
" <IncludePath>%s$(IncludePath)</IncludePath>\n",
cfg, cfg, cfg, cfg, cfg, projectName, includeSearchPath, includeSearchPath);
if (pchHeader && pchHeader[0]) {
offset += sprintf_s(buf + offset, (4 * 1024 * 1024) - offset,
" <NMakeForcedIncludes>%s;$(NMakeForcedIncludes)</NMakeForcedIncludes>\n", pchHeader);
}
offset += sprintf_s(buf + offset, (4 * 1024 * 1024) - offset,
" <NMakePreprocessorDefinitions>");
if (defCommon && defCommon[0]) offset += sprintf_s(buf + offset, (4 * 1024 * 1024) - offset, "%s", defCommon);
@@ -1122,6 +1128,8 @@ typedef struct {
char ExtraDef[1024];
char IncludeSearch[1024];
char DebugCmd[1024];
char PchHeader[256];
char PchSrc[256];
char Srcs[64][256];
int SrcCount;
} VSProject;
@@ -1259,6 +1267,15 @@ static int CommandGenVS(int argc, char* argv[])
memcpy(p->DebugCmd, lineStart + 10, nLen);
p->DebugCmd[nLen] = '\0';
}
else if (lineLen > 4 && memcmp(lineStart, "PCH ", 4) == 0 && projCount > 0) {
VSProject* p = &projects[projCount - 1];
char lineBuf[1024];
int nLen = lineLen - 4;
if (nLen >= 1024) nLen = 1023;
memcpy(lineBuf, lineStart + 4, nLen);
lineBuf[nLen] = '\0';
sscanf_s(lineBuf, "%s %s", p->PchHeader, (unsigned)_countof(p->PchHeader), p->PchSrc, (unsigned)_countof(p->PchSrc));
}
else if (lineLen > 9 && memcmp(lineStart, "SOLUTION ", 9) == 0) {
if (slnCount < 8) {
VSSolution* s = &solutions[slnCount++];
@@ -1286,7 +1303,7 @@ static int CommandGenVS(int argc, char* argv[])
for (int i = 0; i < projCount; i++) {
VSProject* p = &projects[i];
const char* incs = p->IncludeSearch[0] != '\0' ? p->IncludeSearch : globalInclude;
GenerateProject(p->Name, p->Dir, p->Guid, incs, p->ExtraDef, p->DebugCmd, p->Srcs, p->SrcCount, globalDefCommon, globalDefDebug, globalDefProfile, globalDefRelease);
GenerateProject(p->Name, p->Dir, p->Guid, incs, p->ExtraDef, p->DebugCmd, p->Srcs, p->SrcCount, globalDefCommon, globalDefDebug, globalDefProfile, globalDefRelease, p->PchHeader, p->PchSrc);
}
for (int i = 0; i < slnCount; i++) {