documented fpc
This commit is contained in:
@@ -36,6 +36,10 @@ CUtlString Target_t::GetTriplet()
|
||||
|
||||
return triplet;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Returns target on which fpc is being run
|
||||
//----------------------------------------------------------------------------
|
||||
Target_t Target_t::HostTarget()
|
||||
{
|
||||
ETargetKernel kernel =
|
||||
@@ -54,7 +58,7 @@ Target_t Target_t::HostTarget()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Returns default target for build
|
||||
// Returns default target for build, by default it will be host target
|
||||
//-----------------------------------------------------------------------------
|
||||
Target_t Target_t::DefaultTarget()
|
||||
{
|
||||
@@ -62,14 +66,9 @@ Target_t Target_t::DefaultTarget()
|
||||
CUtlString szOS = CommandLine()->ParamValue("-os");
|
||||
CUtlString szArch = CommandLine()->ParamValue("-arch");
|
||||
|
||||
ETargetKernel kernel =
|
||||
#if defined(__linux__)
|
||||
TARGET_KERNEL_LINUX
|
||||
#elif defined(__APPLE__)
|
||||
TARGET_KERNEL_DARWIN
|
||||
#endif
|
||||
;
|
||||
ETargetCPU cpu = TARGET_CPU_AMD64;
|
||||
ETargetKernel kernel = HostTarget().kernel;
|
||||
ETargetCPU cpu = HostTarget().cpu;
|
||||
|
||||
if ( szArch == "x86_64" )
|
||||
cpu = TARGET_CPU_AMD64;
|
||||
else if ( szArch == "aarch64" )
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Set Android metadata aboth the package.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef APK_TOOL_H
|
||||
#define APK_TOOL_H
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Linker interface.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef LD_H
|
||||
#define LD_H
|
||||
|
||||
@@ -15,29 +19,64 @@ enum ELinkType
|
||||
ELINK_STATIC_LIBRARY,
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// C project settings used in compilation
|
||||
// Example usage:
|
||||
// CProject_t compileProject = {};
|
||||
// LinkProject_t ldProject = {};
|
||||
// CUtlString szOutputFile;
|
||||
//
|
||||
// compileProject.m_szName = "your_project_name";
|
||||
// compileProject.files = g_CompiledFiles;
|
||||
// compileProject.includeDirectories = g_IncludeDirectories;
|
||||
//
|
||||
// ldProject = ccompiler->Compile(&compileProject);
|
||||
// ldProject.linkType = ELINK_EXECUTABLE
|
||||
// szOutputFile = linker->Link(&ldProject);
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
struct LinkProject_t: public CPUProject_t
|
||||
{
|
||||
public:
|
||||
void AddObject( Object_t& object );
|
||||
|
||||
// output file
|
||||
ELinkType linkType;
|
||||
CUtlVector<Object_t> objects = {};
|
||||
CUtlVector<CUtlString> libraries ={};
|
||||
CUtlVector<CUtlString> libraryDirectories = {};
|
||||
CUtlVector<CUtlString> libraryObjects = {};
|
||||
CUtlVector<CUtlString> frameworkDirectories = {};
|
||||
CUtlVector<CUtlString> frameworks = {};
|
||||
AndroidManifest_t m_androidmanifest;
|
||||
|
||||
// objects, they could be libraries and compiled files
|
||||
CUtlVector<Object_t> objects = {};
|
||||
|
||||
// system libraries
|
||||
CUtlVector<CUtlString> libraries ={};
|
||||
|
||||
// directories for libraries
|
||||
CUtlVector<CUtlString> libraryDirectories = {};
|
||||
|
||||
// not used
|
||||
CUtlVector<CUtlString> libraryObjects = {};
|
||||
|
||||
// Apple framework directories
|
||||
CUtlVector<CUtlString> frameworkDirectories = {};
|
||||
|
||||
// Disables C standart library
|
||||
bool bNoStdLib;
|
||||
|
||||
// Apple frameworks
|
||||
CUtlVector<CUtlString> frameworks = {};
|
||||
|
||||
// Android manifest
|
||||
AndroidManifest_t m_androidmanifest;
|
||||
};
|
||||
|
||||
// Basic interface name
|
||||
#define LINKER_INTERFACE_NAME "Linker001"
|
||||
#define CLANG_LINKER_INTERFACE_NAME "ClangLinker001"
|
||||
#define CLANG_LINKER_INTERFACE_NAME "Clang" LINKER_INTERFACE_NAME
|
||||
|
||||
abstract_class ILinker
|
||||
{
|
||||
public:
|
||||
|
||||
// Links project
|
||||
virtual CUtlString Link( LinkProject_t *pProject ) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Object handler.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef OBJ_H
|
||||
#define OBJ_H
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Executable runner. It is mainly used to run compilers and linkers,
|
||||
// but can be used to run anything with given executable name
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef RUNNER_H
|
||||
#define RUNNER_H
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Automatic signature generator for iOS, Android and other devices,
|
||||
// which require signed executables, files etc.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef SIGN_TOOL_H
|
||||
#define SIGN_TOOL_H
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Target manager for compilers.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TARGET_T
|
||||
#define TARGET_T
|
||||
|
||||
|
||||
Reference in New Issue
Block a user