documented fpc

This commit is contained in:
2025-07-31 18:07:25 +03:00
parent 395ced9e28
commit 817ed344b4
11 changed files with 154 additions and 25 deletions

View File

@@ -1,3 +1,7 @@
//================= Copyright kotofyt, All rights reserved ==================//
// Purpose: Helper functions for compilers, filesystem2 and build stages.
//===========================================================================//
#ifndef HELPER_H
#define HELPER_H
@@ -7,15 +11,20 @@
#define FPC_TEMPORAL_DIRNAME ".fpc"
//-----------------------------------------------------------------------------
// A base for all projects
//-----------------------------------------------------------------------------
struct BaseProject_t
{
public:
CUtlString m_szName;
// Creates a hash for the project
unsigned int GenerateProjectHash( void );
};
//-----------------------------------------------------------------------------
// A base for cpu projects
//-----------------------------------------------------------------------------
struct CPUProject_t : public BaseProject_t
{
public:
@@ -23,7 +32,9 @@ public:
};
//-----------------------------------------------------------------------------
// A base for shader projects
//-----------------------------------------------------------------------------
struct ShaderProject_t : public BaseProject_t
{
public:
@@ -31,9 +42,8 @@ public:
};
//-----------------------------------------------------------------------------
// File system.
// File system manager.
//-----------------------------------------------------------------------------
#define FILE_SYSTEM_2_INTERFACE_NAME "FileSystem2_001"
abstract_class IFileSystem2
@@ -45,9 +55,16 @@ public:
// Returns directory of build.cpp
virtual char *BuildDirectory() = 0;
// Creates new directory at path
virtual void MakeDirectory( const char *psz ) = 0;
// UNIX-style file copy
virtual void CopyFile( const char *szDestination, const char *szOrigin ) = 0;
// UNIX-style recursive directory copy
virtual void CopyDirectory( const char *szDestination, const char *szOrigin ) = 0;
// Compares timestamps of 2 files
virtual bool ShouldRecompile( const char *szSource, const char *szOutput ) = 0;
};
@@ -65,11 +82,21 @@ public:
int(*m_pMainFn)();
};
//-----------------------------------------------------------------------------
// Declares new build stage.
// example:
// DECLARE_BUILD_STAGE(your_build_stage_name)
// {
// return 0;
// }
//-----------------------------------------------------------------------------
#define DECLARE_BUILD_STAGE(sz) \
int __build_stage_##sz(); \
CBuildStage __##sz##_build_stage(#sz, __build_stage_##sz); \
int __build_stage_##sz()
// Returns all available build stages
// Used internally
CUtlVector<CBuildStage*>& BuildStages();
#endif