From 34e54fdc0d729141342d378c0026e483229eb8f6 Mon Sep 17 00:00:00 2001 From: kotofyt Date: Wed, 29 Oct 2025 13:41:59 +0200 Subject: [PATCH] started to improve compiler --- fpc/library/clang/c.cpp | 1 - fpc/library/clang/c_clang_cl.cpp | 0 fpc/library/windows/c.cpp | 3 +-- fpc/library/windows/c.h | 0 fpc/public/c.h | 26 +++++++++++++++++++++----- 5 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 fpc/library/clang/c_clang_cl.cpp create mode 100644 fpc/library/windows/c.h diff --git a/fpc/library/clang/c.cpp b/fpc/library/clang/c.cpp index 1240e0d..207e65a 100644 --- a/fpc/library/clang/c.cpp +++ b/fpc/library/clang/c.cpp @@ -22,7 +22,6 @@ class CClangCompiler : public ICCompiler { public: virtual LinkProject_t Compile( CProject_t *pProject ) override; - virtual void GenerateLinterData( void ) override; }; EXPOSE_INTERFACE(CClangCompiler, ICCompiler, CLANG_C_COMPILER_INTERFACE_NAME); diff --git a/fpc/library/clang/c_clang_cl.cpp b/fpc/library/clang/c_clang_cl.cpp new file mode 100644 index 0000000..e69de29 diff --git a/fpc/library/windows/c.cpp b/fpc/library/windows/c.cpp index 04d3850..3f698ab 100644 --- a/fpc/library/windows/c.cpp +++ b/fpc/library/windows/c.cpp @@ -55,8 +55,7 @@ LinkProject_t CMSVCCompiler::Compile( CProject_t *pProject ) if (!pSection) Plat_FatalErrorFunc("MSVC_C_COMPILER_INTERFACE_NAME was not found in .fpccfg\n"); CUtlString szExePath = pSection->GetStringValue("exe"); - if (!pSection) - Plat_FatalErrorFunc("exe was not found in MSVC_C_COMPILER_INTERFACE_NAME\n"); + bool bUseClangCL = pSection->GetStringValue("exe"); diff --git a/fpc/library/windows/c.h b/fpc/library/windows/c.h new file mode 100644 index 0000000..e69de29 diff --git a/fpc/public/c.h b/fpc/public/c.h index 6fcce32..ea1e537 100644 --- a/fpc/public/c.h +++ b/fpc/public/c.h @@ -83,8 +83,9 @@ public: // Target C++ version ECPPVersion cppVersion; + // TODO: rework manifests // Android manifest - AndroidManifest_t m_androidmanifest; + AndroidManifest_t m_androidmanifest; }; // Basic interface name @@ -99,11 +100,26 @@ 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; + virtual LinkProject_t Compile( CProject_t *pProject ); + + +protected: + // Compiler internals + + // Returns file name of the + CUtlString GetOutputObjectName( CUtlString szFileName ); + + virtual CUtlVector BuildCommandLine( CProject_t *pProject ); + + // Returns executable which should the OS run + virtual CUtlString GetCompilerExecutable( CProject_t *pProject ) = 0; + + virtual const char *GetOutputObjectFormat() = 0; + virtual bool IncludeDirectory( CUtlVector &cmd ) = 0; + virtual bool IncludeFile( CUtlVector &cmd ) = 0; + virtual void Macro( const char *szName ) = 0; + virtual void Macro( const char *szName, const char *szValue ) = 0; - // Generates linter data - // Handled by the fpc automatically - virtual void GenerateLinterData( void ) = 0; }; extern ICCompiler *ccompiler;