some work on fpc
This commit is contained in:
119
fpc/build.cpp
119
fpc/build.cpp
@@ -10,14 +10,20 @@ ADD_DEPENDENCY_BUILD_FILE(tier1, "../tier1/");
|
||||
ADD_DEPENDENCY_BUILD_FILE(tier2, "../tier2/");
|
||||
|
||||
|
||||
CUtlVector<CUtlString> g_CompiledFiles = {
|
||||
CUtlVector<CUtlString> g_fpcFiles = {
|
||||
|
||||
"main.cpp",
|
||||
"library/runner.cpp",
|
||||
"library/helper.cpp",
|
||||
"library/target.cpp",
|
||||
"library/builder.cpp",
|
||||
|
||||
};
|
||||
|
||||
CUtlVector<CUtlString> g_libFpcFiles = {
|
||||
"library/libfpc.cpp",
|
||||
"library/helper.cpp",
|
||||
"library/target.cpp",
|
||||
"library/builder.cpp",
|
||||
"library/runner.cpp",
|
||||
"library/winerunner.cpp",
|
||||
|
||||
"library/c.cpp",
|
||||
@@ -33,47 +39,108 @@ CUtlVector<CUtlString> g_CompiledFiles = {
|
||||
|
||||
};
|
||||
|
||||
CreateInterfaceFn fpcFactory;
|
||||
ILinker *linker;
|
||||
ICCompiler *ccompiler;
|
||||
IFileSystem2 *filesystem2;
|
||||
|
||||
CUtlVector<CUtlString> g_IncludeDirectories = {
|
||||
"public",
|
||||
"../public",
|
||||
};
|
||||
|
||||
|
||||
DECLARE_BUILD_STAGE(fpc)
|
||||
DECLARE_BUILD_STAGE(libfpcbuild)
|
||||
{
|
||||
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.files = g_libFpcFiles;
|
||||
compileProject.includeDirectories = g_IncludeDirectories;
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = ccompiler->Compile(&compileProject);
|
||||
ldProject.libraryObjects = {
|
||||
GET_PROJECT_LIBRARY("tier0", "tier0")
|
||||
GET_PROJECT_LIBRARY("tier1", "tier1")
|
||||
GET_PROJECT_LIBRARY("tier2", "tier2")
|
||||
};
|
||||
ldProject.linkType = ELINK_STATIC_LIBRARY;
|
||||
|
||||
if (linker->IsLibraryExists("clang"))
|
||||
ldProject.libraries.AppendTail("clang");
|
||||
|
||||
CUtlString outputProject = linker->Link(&ldProject);
|
||||
|
||||
filesystem2->MakeDirectory("../build/tools");
|
||||
filesystem2->CopyFile("fpc_temp", outputProject);
|
||||
|
||||
ADD_OUTPUT_OBJECT("fpc", outputProject)
|
||||
|
||||
return 0;
|
||||
}
|
||||
DECLARE_BUILD_STAGE(libfpc)
|
||||
{
|
||||
if (linker->IsLibraryExists("clang"))
|
||||
g_libFpcFiles.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_libFpcFiles;
|
||||
compileProject.includeDirectories = g_IncludeDirectories;
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = ccompiler->Compile(&compileProject);
|
||||
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||
ldProject.libraryObjects = {
|
||||
GET_PROJECT_LIBRARY(tier0, "tier0"),
|
||||
GET_PROJECT_LIBRARY(tier1, "tier1"),
|
||||
GET_PROJECT_LIBRARY(tier2, "tier2"),
|
||||
};
|
||||
V_printf("WHAT %s\n",GET_PROJECT_LIBRARY(tier0, "tier0").GetString());
|
||||
|
||||
if (linker->IsLibraryExists("clang"))
|
||||
ldProject.libraries.AppendTail("clang");
|
||||
|
||||
CUtlString outputProject = linker->Link(&ldProject);
|
||||
|
||||
|
||||
ADD_OUTPUT_OBJECT("fpc", outputProject)
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
DECLARE_BUILD_STAGE(fpc)
|
||||
{
|
||||
CProject_t compileProject = {};
|
||||
LinkProject_t ldProject = {};
|
||||
|
||||
compileProject.m_szName = "fpc";
|
||||
compileProject.files = g_fpcFiles;
|
||||
compileProject.includeDirectories = g_IncludeDirectories;
|
||||
ldProject = ccompiler->Compile(&compileProject);
|
||||
ldProject.libraryObjects = {
|
||||
GET_PROJECT_LIBRARY(tier0, "tier0"),
|
||||
GET_PROJECT_LIBRARY(tier1, "tier1"),
|
||||
GET_PROJECT_LIBRARY(tier2, "tier2"),
|
||||
GET_PROJECT_LIBRARY(libfpc, "fpc"),
|
||||
};
|
||||
V_printf("WHAT %s\n",GET_PROJECT_LIBRARY(tier0, "tier0").GetString());
|
||||
|
||||
if (linker->IsLibraryExists("clang"))
|
||||
ldProject.libraries.AppendTail("clang");
|
||||
|
||||
CUtlString outputProject = linker->Link(&ldProject);
|
||||
|
||||
|
||||
ADD_OUTPUT_OBJECT("fpc", outputProject)
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
DECLARE_BUILD_STAGE(install)
|
||||
{
|
||||
CUtlString szExe = GET_PROJECT_LIBRARY(fpc, "fpc");
|
||||
CUtlString szLibFpc = GET_PROJECT_LIBRARY(libfpc, "fpc");
|
||||
CUtlString szTier0 = GET_PROJECT_LIBRARY(tier0, "tier0");
|
||||
CUtlString szTier1 = GET_PROJECT_LIBRARY(tier1, "tier1");
|
||||
CUtlString szTier2 = GET_PROJECT_LIBRARY(tier2, "tier2");
|
||||
|
||||
filesystem2->CopyFile("build/fpc_temp", szExe);
|
||||
filesystem2->CopyFile("build/libfpc.so", szLibFpc);
|
||||
filesystem2->CopyFile("build/libtier0_temp.so", szTier0);
|
||||
filesystem2->CopyFile("build/libtier1.a", szTier1);
|
||||
filesystem2->CopyFile("build/libtier2.a", szTier2);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user