Started work on build system
This commit is contained in:
29
fpc/public/c.h
Normal file
29
fpc/public/c.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef C_H
|
||||
#define C_H
|
||||
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "runner.h"
|
||||
#include "ld.h"
|
||||
#include "target.h"
|
||||
#include "helper.h"
|
||||
|
||||
struct C_Macro_t
|
||||
{
|
||||
CUtlString szName;
|
||||
CUtlString szValue;
|
||||
};
|
||||
|
||||
class CCProject : public CProject
|
||||
{
|
||||
public:
|
||||
CUtlVector<CUtlString> files;
|
||||
CUtlVector<C_Macro_t> macros;
|
||||
CUtlVector<CUtlString> includeDirectories;
|
||||
CUtlVector<CUtlString> includeFiles;
|
||||
bool bFPIE;
|
||||
bool bFPIC;
|
||||
CLDProject Compile();
|
||||
};
|
||||
|
||||
#endif
|
||||
38
fpc/public/helper.h
Normal file
38
fpc/public/helper.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef HELPER_H
|
||||
#define HELPER_H
|
||||
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
#define FPC_TEMPORAL_DIRNAME ".fpc"
|
||||
|
||||
class CProject
|
||||
{
|
||||
public:
|
||||
CUtlString m_szName;
|
||||
unsigned int GenerateProjectHash( void );
|
||||
};
|
||||
|
||||
interface IFileSystem2
|
||||
{
|
||||
public:
|
||||
static void MakeDirectory( const char *psz );
|
||||
static void CopyFile( const char *szDestination, const char *szOrigin );
|
||||
static void CopyDirectory( const char *szDestination, const char *szOrigin );
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CBuildStage
|
||||
{
|
||||
public:
|
||||
CBuildStage( CUtlString sz, int(*pMainFn)() );
|
||||
CUtlString m_sz;
|
||||
int(*m_pMainFn)();
|
||||
};
|
||||
|
||||
#define DECLARE_BUILD_STAGE(sz, fn) \
|
||||
CBuildStage __##sz##_build_stage(#sz, fn);
|
||||
|
||||
CUtlVector<CBuildStage*>& BuildStages();
|
||||
|
||||
#endif
|
||||
33
fpc/public/ld.h
Normal file
33
fpc/public/ld.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef LD_H
|
||||
#define LD_H
|
||||
|
||||
|
||||
#include "runner.h"
|
||||
#include "helper.h"
|
||||
#include "obj.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
enum ELinkType
|
||||
{
|
||||
ELINK_EXECUTABLE,
|
||||
ELINK_DYNAMIC_LIBRARY,
|
||||
ELINK_STATIC_LIBRARY,
|
||||
};
|
||||
|
||||
class CLDProject: public CProject
|
||||
{
|
||||
public:
|
||||
void AddObject( CObject& object );
|
||||
void AddLibrary( CUtlString psz );
|
||||
void AddLibraryByPath( CUtlString szPath );
|
||||
void AddLibraryDirectory( CUtlString szPath );
|
||||
CUtlString Link( void );
|
||||
|
||||
ELinkType linkType;
|
||||
CUtlVector<CObject> objects;
|
||||
CUtlVector<CUtlString> libraries;
|
||||
CUtlVector<CUtlString> libraryDirectories;
|
||||
CUtlVector<CUtlString> libraryObjects;
|
||||
};
|
||||
|
||||
#endif
|
||||
13
fpc/public/obj.h
Normal file
13
fpc/public/obj.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef OBJ_H
|
||||
#define OBJ_H
|
||||
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
class CObject
|
||||
{
|
||||
public:
|
||||
CUtlString m_szObjectFile;
|
||||
CUtlString m_szSourceFile;
|
||||
};
|
||||
|
||||
#endif
|
||||
15
fpc/public/runner.h
Normal file
15
fpc/public/runner.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef RUNNER_H
|
||||
#define RUNNER_H
|
||||
|
||||
#include "tier1/utlvector.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
interface IRunner
|
||||
{
|
||||
public:
|
||||
static int Run( CUtlString szName, CUtlVector<CUtlString>& args );
|
||||
static int Run( CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args );
|
||||
static int Run( CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args, CUtlVector<CUtlString>& environment );
|
||||
};
|
||||
|
||||
#endif
|
||||
23
fpc/public/target.h
Normal file
23
fpc/public/target.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef TARGET_T
|
||||
#define TARGET_T
|
||||
|
||||
enum ETargetKernel
|
||||
{
|
||||
TARGET_KERNEL_LINUX,
|
||||
TARGET_KERNEL_WINDOWS,
|
||||
};
|
||||
|
||||
enum ETargetCPU
|
||||
{
|
||||
TARGET_CPU_AMD64,
|
||||
TARGET_CPU_I386,
|
||||
};
|
||||
|
||||
struct Target_t
|
||||
{
|
||||
ETargetKernel kernel;
|
||||
ETargetCPU cpu;
|
||||
static Target_t DefaultTarget();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user