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: C, C++, Objective-C and Objective-C++ compiler interface.
//===========================================================================//
#ifndef C_H
#define C_H
@@ -15,6 +19,8 @@ struct C_Macro_t
CUtlString szValue;
};
// Target C version
enum ECVersion
{
CVERSION_89,
@@ -25,6 +31,7 @@ enum ECVersion
CVERSION_2Y,
};
// Target C++ version
enum ECPPVersion
{
CPPVERSION_98 = 1,
@@ -36,32 +43,66 @@ enum ECPPVersion
CPPVERSION_2C = 6,
};
//----------------------------------------------------------------------------
// C project settings used in compilation
// Example usage:
// CProject_t compileProject = {};
// LinkProject_t ldProject = {};
//
// compileProject.m_szName = "your project name";
// compileProject.files = g_CompiledFiles;
// compileProject.includeDirectories = g_IncludeDirectories;
// ldProject = ccompiler->Compile(&compileProject);
//----------------------------------------------------------------------------
struct CProject_t : public CPUProject_t
{
public:
// Compiled files
CUtlVector<CUtlString> files = {};
// Included directories
CUtlVector<CUtlString> includeDirectories = {};
// Included files
// They are included on top of the file
CUtlVector<CUtlString> includeFiles = {};
// Defined macros
CUtlVector<C_Macro_t> macros = {};
// Is compiled as position independent executable
bool bFPIE = false;
// Is compiled as position independent code
// Use for shared libraries
bool bFPIC = false;
// Target C version
ECVersion cVersion;
// Target C++ version
ECPPVersion cppVersion;
// Android manifest
AndroidManifest_t m_androidmanifest;
};
// Basic interface name
#define C_COMPILER_INTERFACE_NAME "CCompiler001"
#define CLANG_C_COMPILER_INTERFACE_NAME "ClangCCompiler001"
#define GCC_C_COMPILER_INTERFACE_NAME "GCCCCompiler001"
#define MSVC_C_COMPILER_INTERFACE_NAME "MSVCCCompiler001"
#define CLANG_C_COMPILER_INTERFACE_NAME "Clang" C_COMPILER_INTERFACE_NAME
#define GNU_C_COMPILER_INTERFACE_NAME "GNU" C_COMPILER_INTERFACE_NAME
#define MSVC_C_COMPILER_INTERFACE_NAME "MSVC" C_COMPILER_INTERFACE_NAME
abstract_class ICCompiler
{
public:
// Compiles all files into objects, returns linker project,
// which can be linked into executable or library.
virtual LinkProject_t Compile( CProject_t *pProject ) = 0;
// Generates linter data
// Handled by the fpc automatically
virtual void GenerateLinterData( void ) = 0;
};