75 lines
1.6 KiB
C++
75 lines
1.6 KiB
C++
#include "c.h"
|
|
#include "ld.h"
|
|
#include "helper.h"
|
|
#include "tier0/platform.h"
|
|
#include "tier1/interface.h"
|
|
#include "signal.h"
|
|
|
|
ADD_DEPENDENCY_BUILD_FILE("../tier0/__build.cpp")
|
|
ADD_DEPENDENCY_BUILD_FILE("../tier1/__build.cpp")
|
|
ADD_DEPENDENCY_BUILD_FILE("../tier2/__build.cpp")
|
|
|
|
|
|
CUtlVector<CUtlString> g_CompiledFiles = {
|
|
|
|
"main.cpp",
|
|
"library/runner.cpp",
|
|
"library/helper.cpp",
|
|
"library/target.cpp",
|
|
|
|
"library/winerunner.cpp",
|
|
|
|
"library/c.cpp",
|
|
"library/ld.cpp",
|
|
|
|
"library/android/apktool.cpp",
|
|
|
|
"library/clang/c.cpp",
|
|
"library/clang/ld.cpp",
|
|
|
|
"library/windows/c.cpp",
|
|
"library/windows/ld.cpp",
|
|
|
|
};
|
|
|
|
CreateInterfaceFn fpcFactory;
|
|
ILinker *linker;
|
|
ICCompiler *ccompiler;
|
|
IFileSystem2 *filesystem2;
|
|
|
|
CUtlVector<CUtlString> g_IncludeDirectories = {
|
|
"public",
|
|
"../public",
|
|
};
|
|
|
|
|
|
DECLARE_BUILD_STAGE(fpc)
|
|
{
|
|
DEPEND_ON_PROJECT("tier0");
|
|
DEPEND_ON_PROJECT("tier1");
|
|
DEPEND_ON_PROJECT("tier2");
|
|
|
|
if (linker->IsLibraryExists("clang"))
|
|
g_CompiledFiles.AppendTail("library/clang/c_libclang.cpp");
|
|
else
|
|
V_printf("Warning: to support included files libclang must be installed.");
|
|
CProject_t compileProject = {};
|
|
LinkProject_t ldProject = {};
|
|
|
|
compileProject.m_szName = "fpc";
|
|
compileProject.files = g_CompiledFiles;
|
|
compileProject.includeDirectories = g_IncludeDirectories;
|
|
ldProject = ccompiler->Compile(&compileProject);
|
|
ldProject.libraryObjects = GET_PROJECT_LIBRARY("tier0", "tier0");
|
|
|
|
if (linker->IsLibraryExists("clang"))
|
|
ldProject.libraries.AppendTail("clang");
|
|
|
|
CUtlString outputProject = linker->Link(&ldProject);
|
|
|
|
filesystem2->MakeDirectory("../build/tools");
|
|
filesystem2->CopyFile("fpc_temp", outputProject);
|
|
|
|
return 0;
|
|
};
|