work on implementing xtool
This commit is contained in:
0
appleadi/build.cpp
Normal file
0
appleadi/build.cpp
Normal file
@@ -21,7 +21,12 @@ recompile: ../build/tools/fpc
|
|||||||
|
|
||||||
install: ../build/tools/fpc libfpcbuild.a libfpc.so libtier0.so libtier1.a libtier2.a libfilesystem_std.so install_temp builddir
|
install: ../build/tools/fpc libfpcbuild.a libfpc.so libtier0.so libtier1.a libtier2.a libfilesystem_std.so install_temp builddir
|
||||||
$(CC) -fPIC main.cpp library/helper.cpp library/target.cpp library/builder.cpp -lc -lstdc++ $(CCFLAGS) -o build/fpc libtier0.so build/libtier1.a build/libtier2.a -Wl,--disable-new-dtags -Wl,-rpath,'$$ORIGIN'
|
$(CC) -fPIC main.cpp library/helper.cpp library/target.cpp library/builder.cpp -lc -lstdc++ $(CCFLAGS) -o build/fpc libtier0.so build/libtier1.a build/libtier2.a -Wl,--disable-new-dtags -Wl,-rpath,'$$ORIGIN'
|
||||||
build/fpc build -fpcdebug
|
build/fpc build
|
||||||
|
mv build/fpc_temp build/fpc
|
||||||
|
mv build/libfpc_temp.so build/libfpc.so
|
||||||
|
build/fpc build
|
||||||
|
mv build/fpc_temp build/fpc
|
||||||
|
mv build/libfpc_temp.so build/libfpc.so
|
||||||
|
|
||||||
libtier0.so: $(TIER0_FILES) builddir
|
libtier0.so: $(TIER0_FILES) builddir
|
||||||
$(CC) $(CCFLAGS) -fPIC -shared -o build/libtier0.so $(TIER0_FILES)
|
$(CC) $(CCFLAGS) -fPIC -shared -o build/libtier0.so $(TIER0_FILES)
|
||||||
|
|||||||
47
fpc/apple/build.cpp
Normal file
47
fpc/apple/build.cpp
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#include "c.h"
|
||||||
|
#include "swift.h"
|
||||||
|
#include "ld.h"
|
||||||
|
#include "helper.h"
|
||||||
|
#include "tier0/platform.h"
|
||||||
|
#include "tier1/interface.h"
|
||||||
|
|
||||||
|
ADD_DEPENDENCY_BUILD_FILE(tier1, "../../tier1/build.cpp");
|
||||||
|
|
||||||
|
DECLARE_BUILD_STAGE(xtool_backend)
|
||||||
|
{
|
||||||
|
if (!linker->IsLibraryExists("swiftCore"))
|
||||||
|
{
|
||||||
|
V_printf("Swift is not installed\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ISwiftCompiler *swiftcompiler = NULL;
|
||||||
|
if (swiftcompiler == NULL)
|
||||||
|
{
|
||||||
|
CreateInterfaceFn pLibFPCFactory = Sys_GetFactory("fpc");
|
||||||
|
swiftcompiler = (ISwiftCompiler*)pLibFPCFactory(SWIFT_COMPILER_INTERFACE_VERSION, NULL);
|
||||||
|
|
||||||
|
if (swiftcompiler == NULL)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SwiftProject_t compileProject = {};
|
||||||
|
LinkProject_t ldProject = {};
|
||||||
|
|
||||||
|
compileProject.m_szName = "xtool";
|
||||||
|
compileProject.files = {
|
||||||
|
"xtool/sign.swift"
|
||||||
|
};
|
||||||
|
|
||||||
|
ldProject = swiftcompiler->Compile(&compileProject);
|
||||||
|
ldProject.linkType = ELINK_STATIC_LIBRARY;
|
||||||
|
|
||||||
|
CUtlString outputProject = linker->Link(&ldProject);
|
||||||
|
|
||||||
|
|
||||||
|
ADD_OUTPUT_OBJECT("xtool", outputProject)
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
0
fpc/apple/xtool/sign.cpp
Normal file
0
fpc/apple/xtool/sign.cpp
Normal file
0
fpc/apple/xtool/sign.swift
Normal file
0
fpc/apple/xtool/sign.swift
Normal file
@@ -7,7 +7,7 @@
|
|||||||
ADD_DEPENDENCY_BUILD_FILE(tier0, "../tier0/build.cpp");
|
ADD_DEPENDENCY_BUILD_FILE(tier0, "../tier0/build.cpp");
|
||||||
ADD_DEPENDENCY_BUILD_FILE(tier1, "../tier1/build.cpp");
|
ADD_DEPENDENCY_BUILD_FILE(tier1, "../tier1/build.cpp");
|
||||||
ADD_DEPENDENCY_BUILD_FILE(tier2, "../tier2/build.cpp");
|
ADD_DEPENDENCY_BUILD_FILE(tier2, "../tier2/build.cpp");
|
||||||
ADD_DEPENDENCY_BUILD_FILE(signers, "signers/build.cpp");
|
ADD_DEPENDENCY_BUILD_FILE(apple, "apple/build.cpp");
|
||||||
|
|
||||||
|
|
||||||
CUtlVector<CUtlString> g_fpcFiles = {
|
CUtlVector<CUtlString> g_fpcFiles = {
|
||||||
@@ -28,6 +28,7 @@ CUtlVector<CUtlString> g_libFpcFiles = {
|
|||||||
|
|
||||||
"library/c.cpp",
|
"library/c.cpp",
|
||||||
"library/ld.cpp",
|
"library/ld.cpp",
|
||||||
|
"library/swift.cpp",
|
||||||
|
|
||||||
"library/android/apktool.cpp",
|
"library/android/apktool.cpp",
|
||||||
"library/apple/appletool.cpp",
|
"library/apple/appletool.cpp",
|
||||||
@@ -38,6 +39,8 @@ CUtlVector<CUtlString> g_libFpcFiles = {
|
|||||||
"library/windows/c.cpp",
|
"library/windows/c.cpp",
|
||||||
"library/windows/ld.cpp",
|
"library/windows/ld.cpp",
|
||||||
|
|
||||||
|
"library/apple/swift.cpp",
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CUtlVector<CUtlString> g_IncludeDirectories = {
|
CUtlVector<CUtlString> g_IncludeDirectories = {
|
||||||
|
|||||||
135
fpc/library/apple/swift.cpp
Normal file
135
fpc/library/apple/swift.cpp
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
#include "swift.h"
|
||||||
|
|
||||||
|
class CSwiftCompiler: public ISwiftCompiler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Compiles all files into objects, returns linker project,
|
||||||
|
// which can be linked into executable or library.
|
||||||
|
//virtual LinkProject_t Compile( SwiftProject_t *pProject );
|
||||||
|
|
||||||
|
//virtual void GenerateLinterData() ;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Compiler internals
|
||||||
|
|
||||||
|
virtual CUtlVector<CUtlString> BuildCommandLine( SwiftProject_t *pProject, const char *szFileName, const char *szOutputFileName ) override;
|
||||||
|
|
||||||
|
// Returns executable which should the OS run
|
||||||
|
virtual const char *GetCompilerExecutable( SwiftProject_t *pProject ) override;
|
||||||
|
|
||||||
|
// returns object file format, eg .obj or .o
|
||||||
|
virtual const char *GetOutputObjectFormat() override;
|
||||||
|
|
||||||
|
virtual void IncludeDirectory( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
||||||
|
virtual void IncludeFile( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
||||||
|
virtual void Macro( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
||||||
|
virtual void Macro( CUtlVector<CUtlString> &cmd, const char *szName, const char *szValue ) override;
|
||||||
|
|
||||||
|
virtual void SetTarget( CUtlVector<CUtlString> &cmd, SwiftProject_t *pProject ) override;
|
||||||
|
virtual void SetSysroot( CUtlVector<CUtlString> &cmd, SwiftProject_t *pProject , const char *szSysroot ) override;
|
||||||
|
virtual void SetOutputFile( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
||||||
|
|
||||||
|
virtual void CompileFile( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
||||||
|
|
||||||
|
virtual void EnableDebugSymbols( CUtlVector<CUtlString> &cmd ) override;
|
||||||
|
virtual void EnablePIE( CUtlVector<CUtlString> &cmd ) override;
|
||||||
|
virtual void EnablePIC( CUtlVector<CUtlString> &cmd ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *CSwiftCompiler::GetOutputObjectFormat()
|
||||||
|
{
|
||||||
|
return ".o";
|
||||||
|
}
|
||||||
|
|
||||||
|
CUtlVector<CUtlString> CSwiftCompiler::BuildCommandLine( SwiftProject_t *pProject, const char *szFileName, const char *szOutputFileName )
|
||||||
|
{
|
||||||
|
CUtlVector<CUtlString> cmd;
|
||||||
|
cmd = ISwiftCompiler::BuildCommandLine(pProject, szFileName, szOutputFileName);
|
||||||
|
cmd.AppendHead("-c");
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *CSwiftCompiler::GetCompilerExecutable( SwiftProject_t *pProject )
|
||||||
|
{
|
||||||
|
return "swiftc";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CSwiftCompiler::IncludeDirectory( CUtlVector<CUtlString> &cmd, const char *szName )
|
||||||
|
{
|
||||||
|
cmd.AppendTail("-I");
|
||||||
|
cmd.AppendTail(szName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSwiftCompiler::IncludeFile( CUtlVector<CUtlString> &cmd, const char *szName )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSwiftCompiler::Macro( CUtlVector<CUtlString> &cmd, const char *szName )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSwiftCompiler::Macro( CUtlVector<CUtlString> &cmd, const char *szName, const char *szValue )
|
||||||
|
{
|
||||||
|
cmd.AppendTail("-D");
|
||||||
|
cmd.AppendTail(CUtlString("%s=%s", (char*)szName, (char*)szValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSwiftCompiler::EnableDebugSymbols( CUtlVector<CUtlString> &cmd )
|
||||||
|
{
|
||||||
|
cmd.AppendTail("-g");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSwiftCompiler::SetTarget( CUtlVector<CUtlString> &cmd, SwiftProject_t *pProject )
|
||||||
|
{
|
||||||
|
cmd.AppendTail("-target");
|
||||||
|
cmd.AppendTail(pProject->m_target.GetTriplet());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSwiftCompiler::CompileFile( CUtlVector<CUtlString> &cmd, const char *szName )
|
||||||
|
{
|
||||||
|
cmd.AppendTail(szName);
|
||||||
|
}
|
||||||
|
void CSwiftCompiler::SetOutputFile( CUtlVector<CUtlString> &cmd, const char *szName )
|
||||||
|
{
|
||||||
|
cmd.AppendTail("-o");
|
||||||
|
cmd.AppendTail(szName);
|
||||||
|
}
|
||||||
|
void CSwiftCompiler::EnablePIE( CUtlVector<CUtlString> &cmd )
|
||||||
|
{
|
||||||
|
cmd.AppendTail("-fPIE");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSwiftCompiler::EnablePIC( CUtlVector<CUtlString> &cmd )
|
||||||
|
{
|
||||||
|
cmd.AppendTail("-fPIC");
|
||||||
|
}
|
||||||
|
void CSwiftCompiler::SetSysroot( CUtlVector<CUtlString> &cmd, SwiftProject_t *pProject, const char *szName )
|
||||||
|
{
|
||||||
|
if (szName != NULL)
|
||||||
|
{
|
||||||
|
cmd.AppendTail("--sysroot");
|
||||||
|
cmd.AppendTail(szName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!g_pConfig)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
IINISection *pSection = g_pConfig->GetSection(pProject->m_target.GetTriplet());
|
||||||
|
if (!pSection)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const char *szSysroot = pSection->GetStringValue("sysroot");
|
||||||
|
if (szSysroot)
|
||||||
|
{
|
||||||
|
cmd.AppendTail("--sysroot");
|
||||||
|
cmd.AppendTail(szSysroot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPOSE_INTERFACE(CSwiftCompiler, ISwiftCompiler, SWIFT_COMPILER_INTERFACE_VERSION)
|
||||||
|
|
||||||
@@ -17,7 +17,6 @@ void *LibFpcInit()
|
|||||||
CreateInterfaceFn pFilesystemFactory = Sys_GetFactory(pFilesystem);
|
CreateInterfaceFn pFilesystemFactory = Sys_GetFactory(pFilesystem);
|
||||||
filesystem = (IFileSystem*)pFilesystemFactory(FILESYSTEM_INTERFACE_VERSION, NULL);
|
filesystem = (IFileSystem*)pFilesystemFactory(FILESYSTEM_INTERFACE_VERSION, NULL);
|
||||||
filesystem->Init();
|
filesystem->Init();
|
||||||
V_printf("----- %p\n",filesystem);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
81
fpc/library/swift.cpp
Normal file
81
fpc/library/swift.cpp
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
#include "swift.h"
|
||||||
|
|
||||||
|
CUtlString ISwiftCompiler::GetOutputObjectName( SwiftProject_t *pProject, unsigned int hash, CUtlString szFileName )
|
||||||
|
{
|
||||||
|
CUtlString szTarget = pProject->m_target.GetTriplet();
|
||||||
|
|
||||||
|
return CUtlString(
|
||||||
|
"%s/%s/swift/%u_%s/%s/%s%s",
|
||||||
|
FPC_TEMPORAL_DIRNAME,
|
||||||
|
szTarget.GetString(),
|
||||||
|
hash,
|
||||||
|
pProject->m_szName.GetString(),
|
||||||
|
filesystem2->BuildDirectory(),
|
||||||
|
szFileName.GetString(),
|
||||||
|
GetOutputObjectFormat());
|
||||||
|
};
|
||||||
|
|
||||||
|
CUtlVector<CUtlString> ISwiftCompiler::BuildCommandLine( SwiftProject_t *pProject, const char *szFileName, const char *szOutputFileName )
|
||||||
|
{
|
||||||
|
|
||||||
|
CUtlVector<CUtlString> cmd;
|
||||||
|
|
||||||
|
EnableDebugSymbols(cmd);
|
||||||
|
if (pProject->bFPIC)
|
||||||
|
EnablePIC(cmd);
|
||||||
|
if (pProject->bFPIE)
|
||||||
|
EnablePIE(cmd);
|
||||||
|
SetTarget(cmd, pProject);
|
||||||
|
SetOutputFile(cmd, szOutputFileName);
|
||||||
|
SetSysroot(cmd, pProject, NULL);
|
||||||
|
CompileFile(cmd, szFileName);
|
||||||
|
for (auto ¯o: pProject->macros)
|
||||||
|
Macro(cmd, macro.szName, macro.szValue.GetString());
|
||||||
|
for (auto &dir: pProject->includeDirectories)
|
||||||
|
IncludeDirectory(cmd, dir);
|
||||||
|
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkProject_t ISwiftCompiler::Compile( SwiftProject_t *pProject )
|
||||||
|
{
|
||||||
|
if (pProject->m_szName == 0)
|
||||||
|
{
|
||||||
|
Plat_FatalErrorFunc("m_szName must be present\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkProject_t proj = {};
|
||||||
|
proj.m_szName = pProject->m_szName;
|
||||||
|
proj.m_target = pProject->m_target;
|
||||||
|
proj.m_androidmanifest = pProject->m_androidmanifest;
|
||||||
|
unsigned int hash = pProject->GenerateProjectHash();
|
||||||
|
|
||||||
|
|
||||||
|
// Get output directories
|
||||||
|
for (auto &file: pProject->files)
|
||||||
|
{
|
||||||
|
CUtlString szOutputFile = GetOutputObjectName(pProject, hash, file);
|
||||||
|
CUtlString szOutputDir = szOutputFile.GetDirectory();
|
||||||
|
filesystem2->MakeDirectory(szOutputDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run CC
|
||||||
|
for (auto &file: pProject->files)
|
||||||
|
{
|
||||||
|
CUtlString szOutputFile = GetOutputObjectName(pProject, hash, file);
|
||||||
|
CUtlVector<CUtlString> args;
|
||||||
|
|
||||||
|
args = BuildCommandLine(pProject, file, szOutputFile);
|
||||||
|
if (!filesystem2->ShouldRecompile(file, szOutputFile))
|
||||||
|
goto skipcompile;
|
||||||
|
else
|
||||||
|
V_printf(" SWIFT %s\n", file.GetString());
|
||||||
|
runner->Run(GetCompilerExecutable(pProject), args);
|
||||||
|
skipcompile:
|
||||||
|
proj.objects.AppendTail((Object_t){szOutputFile});
|
||||||
|
}
|
||||||
|
runner->Wait();
|
||||||
|
return proj;
|
||||||
|
}
|
||||||
|
|
||||||
|
ISwiftCompiler *swiftcompiler = NULL;
|
||||||
@@ -70,22 +70,11 @@ public:
|
|||||||
// Defined macros
|
// Defined macros
|
||||||
CUtlVector<C_Macro_t> 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
|
// Target C version
|
||||||
ECVersion cVersion;
|
ECVersion cVersion;
|
||||||
|
|
||||||
// Target C++ version
|
// Target C++ version
|
||||||
ECPPVersion cppVersion;
|
ECPPVersion cppVersion;
|
||||||
|
|
||||||
// TODO: rework manifests
|
|
||||||
// Android manifest
|
|
||||||
AndroidManifest_t m_androidmanifest;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Basic interface name
|
// Basic interface name
|
||||||
|
|||||||
@@ -32,6 +32,16 @@ struct CPUProject_t : public BaseProject_t
|
|||||||
public:
|
public:
|
||||||
Target_t m_target = Target_t::DefaultTarget();
|
Target_t m_target = Target_t::DefaultTarget();
|
||||||
|
|
||||||
|
// Is compiled as position independent executable
|
||||||
|
bool bFPIE = false;
|
||||||
|
|
||||||
|
// Is compiled as position independent code
|
||||||
|
// Use for shared libraries
|
||||||
|
bool bFPIC = false;
|
||||||
|
|
||||||
|
// TODO: rework manifests
|
||||||
|
// Android manifest
|
||||||
|
AndroidManifest_t m_androidmanifest = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -74,9 +74,6 @@ public:
|
|||||||
// Apple frameworks
|
// Apple frameworks
|
||||||
CUtlVector<CUtlString> frameworks = {};
|
CUtlVector<CUtlString> frameworks = {};
|
||||||
|
|
||||||
// Android manifest
|
|
||||||
AndroidManifest_t m_androidmanifest;
|
|
||||||
|
|
||||||
// Windows subsystem
|
// Windows subsystem
|
||||||
EWindowsSubsystem m_eWindowsSubsystem;
|
EWindowsSubsystem m_eWindowsSubsystem;
|
||||||
};
|
};
|
||||||
|
|||||||
87
fpc/public/swift.h
Normal file
87
fpc/public/swift.h
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#ifndef SWIFT_H
|
||||||
|
#define SWIFT_H
|
||||||
|
|
||||||
|
#include "tier0/platform.h"
|
||||||
|
#include "tier1/utlstring.h"
|
||||||
|
#include "tier1/utlvector.h"
|
||||||
|
#include "runner.h"
|
||||||
|
#include "ld.h"
|
||||||
|
#include "c.h"
|
||||||
|
#include "target.h"
|
||||||
|
#include "helper.h"
|
||||||
|
|
||||||
|
struct SwiftProject_t : public CPUProject_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Compiled files
|
||||||
|
CUtlVector<CUtlString> files = {};
|
||||||
|
|
||||||
|
// Included directories
|
||||||
|
CUtlVector<CUtlString> includeDirectories = {};
|
||||||
|
|
||||||
|
// Included files
|
||||||
|
CUtlVector<CUtlString> includeObjcFiles = {};
|
||||||
|
|
||||||
|
// Stuff for embedded objc
|
||||||
|
// Included files
|
||||||
|
// They are included on top of the file
|
||||||
|
CUtlVector<CUtlString> includeFiles = {};
|
||||||
|
|
||||||
|
// Stuff for embedded objc
|
||||||
|
// Defined macros
|
||||||
|
CUtlVector<C_Macro_t> macros = {};
|
||||||
|
|
||||||
|
// Stuff for embedded objc
|
||||||
|
// Target C version
|
||||||
|
ECVersion cVersion;
|
||||||
|
|
||||||
|
// Stuff for embedded objc
|
||||||
|
// Target C++ version
|
||||||
|
ECPPVersion cppVersion;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SWIFT_COMPILER_INTERFACE_VERSION "SwiftCompiler001"
|
||||||
|
|
||||||
|
class ISwiftCompiler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Compiles all files into objects, returns linker project,
|
||||||
|
// which can be linked into executable or library.
|
||||||
|
virtual LinkProject_t Compile( SwiftProject_t *pProject );
|
||||||
|
|
||||||
|
//virtual void GenerateLinterData() = 0;
|
||||||
|
protected:
|
||||||
|
// Compiler internals
|
||||||
|
|
||||||
|
// Returns file name of the
|
||||||
|
CUtlString GetOutputObjectName( SwiftProject_t *pProject, unsigned int hash, CUtlString szFileName );
|
||||||
|
|
||||||
|
virtual CUtlVector<CUtlString> BuildCommandLine( SwiftProject_t *pProject, const char *szFileName, const char *szOutputFileName );
|
||||||
|
|
||||||
|
// Returns executable which should the OS run
|
||||||
|
virtual const char *GetCompilerExecutable( SwiftProject_t *pProject ) = 0;
|
||||||
|
|
||||||
|
// returns object file format, eg .obj or .o
|
||||||
|
virtual const char *GetOutputObjectFormat() = 0;
|
||||||
|
|
||||||
|
virtual void IncludeDirectory( CUtlVector<CUtlString> &cmd, const char *szName ) = 0;
|
||||||
|
virtual void IncludeFile( CUtlVector<CUtlString> &cmd, const char *szName ) = 0;
|
||||||
|
virtual void Macro( CUtlVector<CUtlString> &cmd, const char *szName ) = 0;
|
||||||
|
virtual void Macro( CUtlVector<CUtlString> &cmd, const char *szName, const char *szValue ) = 0;
|
||||||
|
|
||||||
|
virtual void SetTarget( CUtlVector<CUtlString> &cmd, SwiftProject_t *pProject ) = 0;
|
||||||
|
virtual void SetSysroot( CUtlVector<CUtlString> &cmd, SwiftProject_t *pProject , const char *szSysroot ) = 0;
|
||||||
|
virtual void SetOutputFile( CUtlVector<CUtlString> &cmd, const char *szName ) = 0;
|
||||||
|
|
||||||
|
virtual void CompileFile( CUtlVector<CUtlString> &cmd, const char *szName ) = 0;
|
||||||
|
|
||||||
|
virtual void EnableDebugSymbols( CUtlVector<CUtlString> &cmd ) = 0;
|
||||||
|
virtual void EnablePIE( CUtlVector<CUtlString> &cmd ) = 0;
|
||||||
|
virtual void EnablePIC( CUtlVector<CUtlString> &cmd ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
extern ISwiftCompiler *swiftcompiler;
|
||||||
|
|
||||||
|
#endif
|
||||||
0
http/client.cpp
Normal file
0
http/client.cpp
Normal file
@@ -33,5 +33,6 @@ public:
|
|||||||
DLL_EXPORT void *CreateInterface( const char *szName, int *pReturnCode );
|
DLL_EXPORT void *CreateInterface( const char *szName, int *pReturnCode );
|
||||||
|
|
||||||
CreateInterfaceFn Sys_GetFactory( void *pLibrary );
|
CreateInterfaceFn Sys_GetFactory( void *pLibrary );
|
||||||
|
CreateInterfaceFn Sys_GetFactory( const char *szLibrary );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "tier1/interface.h"
|
#include "tier1/interface.h"
|
||||||
#include "tier1/utlvector.h"
|
#include "tier1/utlvector.h"
|
||||||
|
#include "tier1/utlstring.h"
|
||||||
#include "dlfcn.h"
|
#include "dlfcn.h"
|
||||||
|
|
||||||
static CInterfaceRegistry *s_pInterfaceRegistries;
|
static CInterfaceRegistry *s_pInterfaceRegistries;
|
||||||
@@ -12,7 +13,7 @@ CInterfaceRegistry::CInterfaceRegistry( InstantiateInterfaceFn fn, const char *s
|
|||||||
s_pInterfaceRegistries = this;
|
s_pInterfaceRegistries = this;
|
||||||
Dl_info info = {};
|
Dl_info info = {};
|
||||||
dladdr((void *)&s_pInterfaceRegistries, &info);
|
dladdr((void *)&s_pInterfaceRegistries, &info);
|
||||||
printf("%p: %s in %s\n",&s_pInterfaceRegistries, m_szName, info.dli_fname);
|
//printf("%p: %s in %s\n",&s_pInterfaceRegistries, m_szName, info.dli_fname);
|
||||||
};
|
};
|
||||||
|
|
||||||
DLL_EXPORT void *CreateInterface( const char *szName, int *pReturnCode )
|
DLL_EXPORT void *CreateInterface( const char *szName, int *pReturnCode )
|
||||||
@@ -37,3 +38,13 @@ CreateInterfaceFn Sys_GetFactory( void *lib )
|
|||||||
{
|
{
|
||||||
return (CreateInterfaceFn)Plat_GetProc(lib, "CreateInterface");
|
return (CreateInterfaceFn)Plat_GetProc(lib, "CreateInterface");
|
||||||
}
|
}
|
||||||
|
CreateInterfaceFn Sys_GetFactory( const char *szLibrary )
|
||||||
|
{
|
||||||
|
void *pLib = NULL;
|
||||||
|
CUtlString szLib = szLibrary;
|
||||||
|
#if defined(__linux)
|
||||||
|
szLib = CUtlString("lib%s.so", szLib.GetFileName().GetString());
|
||||||
|
pLib = Plat_LoadLibrary(szLib);
|
||||||
|
#endif
|
||||||
|
return Sys_GetFactory(pLib);
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ CUtlVector<CUtlString> tier2_CompiledFiles = {
|
|||||||
|
|
||||||
DECLARE_BUILD_STAGE(tier2)
|
DECLARE_BUILD_STAGE(tier2)
|
||||||
{
|
{
|
||||||
V_printf("%s\n", Plat_GetWorkingDir());
|
|
||||||
CProject_t compileProject = {};
|
CProject_t compileProject = {};
|
||||||
LinkProject_t ldProject = {};
|
LinkProject_t ldProject = {};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user