improved physics, added better caching
This commit is contained in:
@@ -19,6 +19,7 @@ CLDProject CCProject::Compile()
|
||||
unsigned int hash = GenerateProjectHash();
|
||||
for (auto &file: files)
|
||||
{
|
||||
V_printf(" CC %s\n", file.GetString());
|
||||
CUtlString szOutputFile = CUtlString("%s/cc/%u_%s/%s/%s.o",FPC_TEMPORAL_DIRNAME, hash, m_szName.GetString(), IFileSystem2::OwnDirectory(), file.GetString());
|
||||
CUtlString szOutputDir;
|
||||
CUtlVector<CUtlString> args;
|
||||
@@ -83,7 +84,7 @@ void CCProject::GenerateCompileCommands()
|
||||
V_fseek(f, -2, SEEK_CUR);
|
||||
V_fprintf(f, "\n\t\t],\n");
|
||||
V_fprintf(f, "\t\t\"file\": \"%s\",\n", file.m_szName.GetString());
|
||||
V_fprintf(f, "\t\t\"directory\": \"%s\"\n", IFileSystem2::OwnDirectory());
|
||||
V_fprintf(f, "\t\t\"directory\": \"%s\"\n", IFileSystem2::BuildDirectory());
|
||||
V_fprintf(f, "\t},\n");
|
||||
};
|
||||
V_fseek(f, -2, SEEK_CUR);
|
||||
|
||||
@@ -43,6 +43,15 @@ void IFileSystem2::CopyFile( const char *szDestination, const char *szOrigin )
|
||||
};
|
||||
IRunner::Run("cp", args);
|
||||
}
|
||||
void IFileSystem2::CopyDirectory( const char *szDestination, const char *szOrigin )
|
||||
{
|
||||
CUtlVector<CUtlString> args = {
|
||||
"-r",
|
||||
CUtlString(szOrigin),
|
||||
CUtlString(szDestination),
|
||||
};
|
||||
IRunner::Run("cp", args);
|
||||
}
|
||||
|
||||
void IFileSystem2::MakeDirectory( const char *psz )
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ld.h"
|
||||
#include "helper.h"
|
||||
#include "libgen.h"
|
||||
|
||||
CUtlString CLDProject::Link( void )
|
||||
@@ -23,7 +24,20 @@ CUtlString CLDProject::Link( void )
|
||||
IFileSystem2::MakeDirectory(szOutputDir);
|
||||
if (linkType == ELINK_STATIC_LIBRARY)
|
||||
{
|
||||
CUtlVector<CUtlString> args = {
|
||||
V_printf(" AR %s\n", m_szName.GetString());
|
||||
bool shouldRecompile = false;
|
||||
CUtlVector<CUtlString> args;
|
||||
for (auto object: objects)
|
||||
{
|
||||
if (IFileSystem2::ShouldRecompile(object.m_szObjectFile,szOutputFile))
|
||||
{
|
||||
shouldRecompile = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!shouldRecompile)
|
||||
goto compiled;
|
||||
args = {
|
||||
"rcs",
|
||||
szOutputFile
|
||||
};
|
||||
@@ -31,7 +45,20 @@ CUtlString CLDProject::Link( void )
|
||||
args.AppendTail(object.m_szObjectFile);
|
||||
IRunner::Run("ar", args);
|
||||
} else {
|
||||
CUtlVector<CUtlString> args = {
|
||||
V_printf(" LINK %s\n", m_szName.GetString());
|
||||
bool shouldRecompile = false;
|
||||
CUtlVector<CUtlString> args;
|
||||
for (auto object: objects)
|
||||
{
|
||||
if (IFileSystem2::ShouldRecompile(object.m_szObjectFile,szOutputFile))
|
||||
{
|
||||
shouldRecompile = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!shouldRecompile)
|
||||
goto compiled;
|
||||
args = {
|
||||
"-rdynamic",
|
||||
"-o",
|
||||
szOutputFile,
|
||||
@@ -47,5 +74,6 @@ CUtlString CLDProject::Link( void )
|
||||
}
|
||||
IRunner::Run("clang++", args);
|
||||
}
|
||||
compiled:
|
||||
return szOutputFile;
|
||||
};
|
||||
|
||||
@@ -16,7 +16,6 @@ int IRunner::Run(CUtlString szName, CUtlVector<CUtlString>& args)
|
||||
execargs.AppendTail(szName);
|
||||
for (auto &arg: args)
|
||||
{
|
||||
V_printf("%s\n",arg.GetString());
|
||||
execargs.AppendTail(arg);
|
||||
}
|
||||
execargs.AppendTail(0);
|
||||
|
||||
Reference in New Issue
Block a user