some work on fpc

This commit is contained in:
2025-12-30 22:13:01 +02:00
parent 842eeabbde
commit 773a541199
27 changed files with 298 additions and 101 deletions

View File

@@ -13,6 +13,7 @@ CUtlVector<CUtlString> tier1_CompiledFiles = {
"tier1/utlstring.cpp",
"tier1/utlvector.cpp",
};
CUtlString tier1_lib;
DECLARE_BUILD_STAGE(tier1)
{
@@ -21,15 +22,13 @@ DECLARE_BUILD_STAGE(tier1)
compileProject.m_szName = "tier1";
compileProject.files = tier1_CompiledFiles;
compileProject.includeDirectories = {"../public"};
compileProject.includeDirectories = all_IncludeDirectories;
compileProject.bFPIC = true;
ldProject = ccompiler->Compile(&compileProject);
ldProject.linkType = ELINK_STATIC_LIBRARY;
CUtlString szOutputDir = linker->Link(&ldProject);
ADD_OUTPUT_LIBRARY(szOutputDir)
CUtlString outputProject = linker->Link(&ldProject);
tier1_lib = outputProject;
return 0;
};

View File

@@ -7,7 +7,6 @@
CUtlVector<CUtlString> tier1_CompiledFiles = {
"interface.cpp",
"appinit.cpp",
"commandline.cpp",
"utlbuffer.cpp",
"utlmap.cpp",
"utlstring.cpp",
@@ -28,7 +27,7 @@ DECLARE_BUILD_STAGE(tier1)
CUtlString szOutputDir = linker->Link(&ldProject);
ADD_OUTPUT_LIBRARY(szOutputDir)
ADD_OUTPUT_OBJECT("tier1", szOutputDir)
return 0;
};

View File

@@ -1,85 +0,0 @@
#include "tier1/commandline.h"
#include "tier1/utlvector.h"
class CCommandLine : public ICommandLine
{
public:
virtual void CreateCommandLine( int argc, char **argv ) override;
virtual bool CheckParam( const char *psz ) override;
virtual char *ParamValue( const char* psz, const char *szDefaultValue = 0 ) override;
virtual void AddParam( char *psz ) override;
virtual void RemoveParam( char *psz ) override;
virtual int ParamCount() override;
virtual int FindParam( const char *psz ) override;
virtual const char *GetParam(int nIndex) override;
private:
CUtlVector<char*> m_params;
};
void CCommandLine::CreateCommandLine( int argc, char **argv )
{
m_params.AppendTail(argv,argc);
}
bool CCommandLine::CheckParam( const char *psz )
{
for (auto szParam: m_params) {
if (!V_strcmp(szParam, psz))
{
return true;
}
}
return false;
}
char *CCommandLine::ParamValue( const char *psz, const char *szDefaultValue )
{
int i = 0;
for (auto szParam: m_params) {
i++;
if (i>=m_params.GetSize())
break;
if (!V_strcmp(szParam, psz))
return m_params[i];
}
return (char*)szDefaultValue;
}
void CCommandLine::AddParam( char *psz )
{
m_params.AppendTail(psz);
}
void CCommandLine::RemoveParam( char *psz )
{
}
int CCommandLine::ParamCount()
{
return m_params.GetSize();
}
int CCommandLine::FindParam( const char *psz )
{
int i = 0;
for (auto szParam: m_params) {
if (!V_strcmp(szParam, psz))
return i;
i++;
}
return 0;
}
const char *CCommandLine::GetParam(int nIndex)
{
return m_params[nIndex];
}
ICommandLine *CommandLine()
{
static CCommandLine s_CommandLine;
return &s_CommandLine;
}

View File

@@ -35,8 +35,5 @@ DLL_EXPORT void *CreateInterface( const char *szName, int *pReturnCode )
CreateInterfaceFn Sys_GetFactory( void *lib )
{
#ifdef POSIX
return CreateInterface;
#endif
return (CreateInterfaceFn)Plat_GetProc(lib, "CreateInterface");
}

Binary file not shown.