48 lines
968 B
C++
48 lines
968 B
C++
#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;
|
|
};
|
|
|