Migrated
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include "helper.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "libgen.h"
|
||||
#include <cstdio>
|
||||
|
||||
struct ClangFile_t
|
||||
{
|
||||
@@ -21,11 +20,10 @@ CLDProject CCProject::Compile()
|
||||
for (auto &file: files)
|
||||
{
|
||||
CUtlString szOutputFile = CUtlString("%s/cc/%u_%s/%s/%s.o",FPC_TEMPORAL_DIRNAME, hash, m_szName.GetString(), IFileSystem2::OwnDirectory(), file.GetString());
|
||||
CUtlString szOutputDir = szOutputFile;
|
||||
szOutputDir = dirname(szOutputDir);
|
||||
IFileSystem2::MakeDirectory(szOutputDir);
|
||||
CUtlString szOutputDir;
|
||||
CUtlVector<CUtlString> args;
|
||||
|
||||
CUtlVector<CUtlString> args = {
|
||||
args = {
|
||||
"-g",
|
||||
"-c",
|
||||
"-o",
|
||||
@@ -51,7 +49,14 @@ CLDProject CCProject::Compile()
|
||||
args.AppendTail("-include");
|
||||
args.AppendTail(include);
|
||||
}
|
||||
if (!IFileSystem2::ShouldRecompile(file, szOutputFile))
|
||||
goto skipcompile;
|
||||
szOutputDir = szOutputFile;
|
||||
szOutputDir = dirname(szOutputDir);
|
||||
IFileSystem2::MakeDirectory(szOutputDir);
|
||||
IRunner::Run("clang", args);
|
||||
|
||||
skipcompile:
|
||||
proj.objects.AppendTail((CObject){szOutputFile});
|
||||
|
||||
ClangFile_t cfile = {};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "tier1/utlstring.h"
|
||||
#include "unistd.h"
|
||||
#include "libgen.h"
|
||||
#include "sys/stat.h"
|
||||
|
||||
unsigned int g_hashState = 102851263;
|
||||
unsigned int CProject::GenerateProjectHash( void )
|
||||
@@ -52,6 +53,19 @@ void IFileSystem2::MakeDirectory( const char *psz )
|
||||
IRunner::Run("mkdir", args);
|
||||
};
|
||||
|
||||
bool IFileSystem2::ShouldRecompile(const char *szSource, const char *szOutput)
|
||||
{
|
||||
struct stat srcbuf;
|
||||
struct stat outbuf;
|
||||
if (stat(szSource, &srcbuf) != 0) {
|
||||
return true;
|
||||
}
|
||||
if (stat(szOutput, &outbuf) != 0) {
|
||||
return true;
|
||||
}
|
||||
return outbuf.st_mtime < srcbuf.st_mtime;
|
||||
};
|
||||
|
||||
CUtlVector<CBuildStage*> g_buildStages;
|
||||
|
||||
CBuildStage::CBuildStage( CUtlString sz, int(*pMainFn)() )
|
||||
|
||||
@@ -40,6 +40,11 @@ CUtlString CLDProject::Link( void )
|
||||
args.AppendTail("-shared");
|
||||
for (auto object: objects)
|
||||
args.AppendTail(object.m_szObjectFile);
|
||||
for (auto lib: libraries)
|
||||
{
|
||||
args.AppendTail("-l");
|
||||
args.AppendTail(lib);
|
||||
}
|
||||
IRunner::Run("clang++", args);
|
||||
}
|
||||
return szOutputFile;
|
||||
|
||||
@@ -16,6 +16,7 @@ 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);
|
||||
|
||||
16
fpc/library/target.cpp
Normal file
16
fpc/library/target.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "target.h"
|
||||
#include <god/build.h>
|
||||
|
||||
Target_t Target_t::DefaultTarget()
|
||||
{
|
||||
return {
|
||||
.kernel = TARGET_KERNEL_LINUX,
|
||||
#ifdef __x86_64__
|
||||
.cpu = TARGET_CPU_AMD64,
|
||||
#endif
|
||||
#ifdef __x86__
|
||||
.cpu = TARGET_CPU_I386,
|
||||
#endif
|
||||
.optimization = TARGET_DEBUG,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user