some work on fpc
This commit is contained in:
42
fpc/Makefile
42
fpc/Makefile
@@ -1,11 +1,11 @@
|
|||||||
# We want to build just enough to use other stuff
|
# We want to build just enough to use other stuff
|
||||||
TIER0_FILES := ../tier0/lib.cpp ../tier0/mem.cpp ../tier0/platform.cpp
|
TIER0_FILES := ../tier0/lib.cpp ../tier0/mem.cpp ../tier0/platform.cpp ../tier0/commandline.cpp
|
||||||
TIER1_FILES := ../tier1/utlbuffer.cpp ../tier1/interface.cpp ../tier1/utlstring.cpp ../tier1/utlvector.cpp ../tier1/utlmap.cpp ../tier1/commandline.cpp
|
TIER1_FILES := ../tier1/utlbuffer.cpp ../tier1/interface.cpp ../tier1/utlstring.cpp ../tier1/utlvector.cpp ../tier1/utlmap.cpp
|
||||||
TIER2_FILES := ../tier2/filesystem.cpp ../tier2/fileformats/ini.cpp
|
TIER2_FILES := ../tier2/filesystem.cpp ../tier2/fileformats/ini.cpp
|
||||||
FILESYSTEM_FILES := ../stdfilesystems/filesystem_libc.cpp
|
FILESYSTEM_FILES := ../stdfilesystems/filesystem_libc.cpp
|
||||||
TIER1_OBJS := $(TIER1_FILES:.cpp=.o)
|
TIER1_OBJS := $(TIER1_FILES:.cpp=.o)
|
||||||
TIER2_OBJS := $(TIER2_FILES:.cpp=.o)
|
TIER2_OBJS := $(TIER2_FILES:.cpp=.o)
|
||||||
FPC_FILES := library/runner.cpp library/helper.cpp library/c.cpp library/ld.cpp library/clang/c.cpp library/clang/ld.cpp library/target.cpp library/builder.cpp
|
FPC_FILES := library/helper.cpp library/target.cpp library/builder.cpp library/runner.cpp library/c.cpp library/ld.cpp library/clang/c.cpp library/clang/ld.cpp
|
||||||
CC = clang
|
CC = clang
|
||||||
CCFLAGS = -g -I../public -Ipublic
|
CCFLAGS = -g -I../public -Ipublic
|
||||||
|
|
||||||
@@ -16,14 +16,12 @@ endif
|
|||||||
ifeq ($(UNAME_S),Linux)
|
ifeq ($(UNAME_S),Linux)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
recompile: ../build/tools
|
recompile: ../build/tools/fpc
|
||||||
build/fpc build
|
build/fpc build
|
||||||
mv fpc_temp fpc
|
|
||||||
|
|
||||||
install: ../build/tools libfpcbuild.a libfpc.so libtier0.so libtier1.a libtier2.a libfilesystem_std.so builddir
|
install: ../build/tools/fpc libfpcbuild.a libfpc.so libtier0.so libtier1.a libtier2.a libfilesystem_std.so install_temp builddir
|
||||||
$(CC) main.cpp -lc -lstdc++ $(CCFLAGS) -o build/fpc build/libtier0.so build/libtier1.a build/libtier2.a build/libfpc.so build/libfilesystem_std.so
|
$(CC) -fPIC main.cpp library/helper.cpp library/target.cpp library/builder.cpp -lc -lstdc++ $(CCFLAGS) -o build/fpc build/libtier0.so build/libtier1.a build/libtier2.a -Wl,--disable-new-dtags -Wl,-rpath,'$$ORIGIN'
|
||||||
gdb --args build/fpc build
|
build/fpc build -fpcdebug
|
||||||
mv fpc_temp fpc
|
|
||||||
|
|
||||||
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)
|
||||||
@@ -31,10 +29,10 @@ libtier0.so: $(TIER0_FILES) builddir
|
|||||||
%.o: %.cpp
|
%.o: %.cpp
|
||||||
$(CC) $(CCFLAGS) -fPIC -c $< -o $@
|
$(CC) $(CCFLAGS) -fPIC -c $< -o $@
|
||||||
|
|
||||||
libtier1.a: $(TIER1_OBJS) builddir
|
libtier1.a: $(TIER1_OBJS) builddir libtier0.so
|
||||||
ar rcs build/libtier1.a $(TIER1_OBJS)
|
ar rcs build/libtier1.a $(TIER1_OBJS)
|
||||||
|
|
||||||
libtier2.a: $(TIER2_OBJS) builddir
|
libtier2.a: $(TIER2_OBJS) builddir libtier1.a
|
||||||
ar rcs build/libtier2.a $(TIER2_OBJS)
|
ar rcs build/libtier2.a $(TIER2_OBJS)
|
||||||
|
|
||||||
libfilesystem_std.so: $(FILESYSTEM_FILES) libtier1.a builddir
|
libfilesystem_std.so: $(FILESYSTEM_FILES) libtier1.a builddir
|
||||||
@@ -43,20 +41,26 @@ libfilesystem_std.so: $(FILESYSTEM_FILES) libtier1.a builddir
|
|||||||
libfpcbuild.a: buildfile/interfaces.o builddir
|
libfpcbuild.a: buildfile/interfaces.o builddir
|
||||||
ar rcs build/libfpcbuild.a buildfile/interfaces.o
|
ar rcs build/libfpcbuild.a buildfile/interfaces.o
|
||||||
|
|
||||||
libfpc.so: $(FPC_FILES) builddir libfpcbuild.a
|
libfpc.so: $(FPC_FILES) builddir libfpcbuild.a libtier1.a
|
||||||
$(CC) $(CCFLAGS) -fPIC -shared -o build/libfpc.so build/libfpcbuild.a $(FPC_FILES)
|
$(CC) $(CCFLAGS) $(FPC_FILES) library/libfpc.cpp -fPIC -shared -o build/libfpc.so build/libtier1.a
|
||||||
|
|
||||||
builddir:
|
builddir:
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
|
|
||||||
../build/tools:
|
../build/tools/fpc:
|
||||||
mkdir -p ../build/tools/fpc
|
mkdir -p ../build/tools/fpc
|
||||||
|
|
||||||
install_fpc:
|
install_fpc: ../build/tools/fpc
|
||||||
|
mv build/fpc_temp fpc
|
||||||
|
mv build/libtier0_temp.so libtier0.so
|
||||||
|
mv build/libfpc_temp.so libfpc.so
|
||||||
|
mv build/libfilesystem_std_temp.so libfilesystem_std.so
|
||||||
cp -r build/* ../build/tools/fpc
|
cp -r build/* ../build/tools/fpc
|
||||||
cp -r public ../build/tools
|
|
||||||
cp -r ../public/tier0 ../build/tools/public
|
install_temp: builddir
|
||||||
cp -r ../public/tier1 ../build/tools/public
|
cp -r public build
|
||||||
cp -r ../public/tier2 ../build/tools/public
|
cp -r ../public/tier0 build/public
|
||||||
|
cp -r ../public/tier1 build/public
|
||||||
|
cp -r ../public/tier2 build/public
|
||||||
|
|
||||||
auto: install install_fpc
|
auto: install install_fpc
|
||||||
|
|||||||
119
fpc/build.cpp
119
fpc/build.cpp
@@ -10,14 +10,20 @@ ADD_DEPENDENCY_BUILD_FILE(tier1, "../tier1/");
|
|||||||
ADD_DEPENDENCY_BUILD_FILE(tier2, "../tier2/");
|
ADD_DEPENDENCY_BUILD_FILE(tier2, "../tier2/");
|
||||||
|
|
||||||
|
|
||||||
CUtlVector<CUtlString> g_CompiledFiles = {
|
CUtlVector<CUtlString> g_fpcFiles = {
|
||||||
|
|
||||||
"main.cpp",
|
"main.cpp",
|
||||||
"library/runner.cpp",
|
|
||||||
"library/helper.cpp",
|
"library/helper.cpp",
|
||||||
"library/target.cpp",
|
"library/target.cpp",
|
||||||
"library/builder.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/winerunner.cpp",
|
||||||
|
|
||||||
"library/c.cpp",
|
"library/c.cpp",
|
||||||
@@ -33,47 +39,108 @@ CUtlVector<CUtlString> g_CompiledFiles = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CreateInterfaceFn fpcFactory;
|
|
||||||
ILinker *linker;
|
|
||||||
ICCompiler *ccompiler;
|
|
||||||
IFileSystem2 *filesystem2;
|
|
||||||
|
|
||||||
CUtlVector<CUtlString> g_IncludeDirectories = {
|
CUtlVector<CUtlString> g_IncludeDirectories = {
|
||||||
"public",
|
"public",
|
||||||
"../public",
|
"../public",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DECLARE_BUILD_STAGE(libfpcbuild)
|
||||||
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 = {};
|
CProject_t compileProject = {};
|
||||||
LinkProject_t ldProject = {};
|
LinkProject_t ldProject = {};
|
||||||
|
|
||||||
compileProject.m_szName = "fpc";
|
compileProject.m_szName = "fpc";
|
||||||
compileProject.files = g_CompiledFiles;
|
compileProject.files = g_libFpcFiles;
|
||||||
compileProject.includeDirectories = g_IncludeDirectories;
|
compileProject.includeDirectories = g_IncludeDirectories;
|
||||||
|
compileProject.bFPIC = true;
|
||||||
ldProject = ccompiler->Compile(&compileProject);
|
ldProject = ccompiler->Compile(&compileProject);
|
||||||
ldProject.libraryObjects = {
|
ldProject.linkType = ELINK_STATIC_LIBRARY;
|
||||||
GET_PROJECT_LIBRARY("tier0", "tier0")
|
|
||||||
GET_PROJECT_LIBRARY("tier1", "tier1")
|
|
||||||
GET_PROJECT_LIBRARY("tier2", "tier2")
|
|
||||||
};
|
|
||||||
|
|
||||||
if (linker->IsLibraryExists("clang"))
|
if (linker->IsLibraryExists("clang"))
|
||||||
ldProject.libraries.AppendTail("clang");
|
ldProject.libraries.AppendTail("clang");
|
||||||
|
|
||||||
CUtlString outputProject = linker->Link(&ldProject);
|
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;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
|
|
||||||
static BuildFileInfo_t buildfileinfo = {};
|
static BuildFileInfo_t buildfileinfo = {};
|
||||||
|
CBuildStage *g_pCurrentStage = NULL;
|
||||||
|
GetProjectObjectFn g_pfnGetProjectObject = NULL;
|
||||||
|
|
||||||
BuildFileInfo_t *GetBuildFileInfo()
|
BuildFileInfo_t *GetBuildFileInfo()
|
||||||
{
|
{
|
||||||
return &buildfileinfo;
|
return &buildfileinfo;
|
||||||
@@ -12,6 +15,7 @@ CBuildStage::CBuildStage( const char *psz, int(*pMainFn)() )
|
|||||||
{
|
{
|
||||||
m_psz = psz;
|
m_psz = psz;
|
||||||
m_pMainFn = pMainFn;
|
m_pMainFn = pMainFn;
|
||||||
|
printf("%p\n",m_pMainFn);
|
||||||
if (psz == 0 || pMainFn == 0)
|
if (psz == 0 || pMainFn == 0)
|
||||||
Plat_FatalErrorFunc("Name and function pointer must be set\n");
|
Plat_FatalErrorFunc("Name and function pointer must be set\n");
|
||||||
|
|
||||||
@@ -20,7 +24,19 @@ CBuildStage::CBuildStage( const char *psz, int(*pMainFn)() )
|
|||||||
|
|
||||||
CBuildDependentFile::CBuildDependentFile( const char *psz )
|
CBuildDependentFile::CBuildDependentFile( const char *psz )
|
||||||
{
|
{
|
||||||
|
// TODO: This doesn't affect recursion, which is bad
|
||||||
|
|
||||||
GetBuildFileInfo()->m_dependantFiles.AppendTail(psz);
|
GetBuildFileInfo()->m_dependantFiles.AppendTail(psz);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPOSE_INTERFACE_GLOBALVAR(BuildFileInfo_t, BuildFileInfo_t, BUILD_FILE_INFO_INTERFACE_NAME, buildfileinfo);
|
CUtlString FPC_GetProjectObject( const char *szName, const char *szObjectName )
|
||||||
|
{
|
||||||
|
CUtlString szOutputString;
|
||||||
|
szOutputString = g_pfnGetProjectObject(szName, szObjectName);
|
||||||
|
return szOutputString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EXPOSE_INTERFACE_GLOBALVAR(BuildFileInfo_t, BuildFileInfo_t, BUILD_FILE_INFO_INTERFACE_VERSION, buildfileinfo);
|
||||||
|
EXPOSE_INTERFACE_GLOBALVAR(CBuildStage, CBuildStage, BUILD_CURRENT_STAGE_INTERFACE_VERSION, g_pCurrentStage);
|
||||||
|
EXPOSE_INTERFACE_GLOBALVAR(GetProjectObjectFn, GetProjectObjectFn, BUILD_GET_PROJECT_OBJECT_INTERFACE_VERSION, g_pfnGetProjectObject);
|
||||||
|
|||||||
Binary file not shown.
BIN
fpc/fpc_temp
Normal file
BIN
fpc/fpc_temp
Normal file
Binary file not shown.
@@ -2,6 +2,9 @@
|
|||||||
#include "ld.h"
|
#include "ld.h"
|
||||||
#include "c.h"
|
#include "c.h"
|
||||||
|
|
||||||
|
CUtlVector<BuildFileInfo_t> buildFileInfos = {};
|
||||||
|
|
||||||
|
|
||||||
class CProjectBuilder : public IProjectBuilder
|
class CProjectBuilder : public IProjectBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -20,6 +23,26 @@ IProjectBuilder *ProjectBuilder()
|
|||||||
return &s_projectBuilder;
|
return &s_projectBuilder;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CUtlString FPC_GetProjectObject( const char *szName, const char *szObjectName )
|
||||||
|
{
|
||||||
|
for (auto b: buildFileInfos)
|
||||||
|
{
|
||||||
|
for (auto s: b.m_stages)
|
||||||
|
{
|
||||||
|
if (strcmp(s->m_psz, szName))
|
||||||
|
continue;
|
||||||
|
for (auto o: s->m_outputs)
|
||||||
|
{
|
||||||
|
if (strcmp(o.m_szName, szObjectName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return o.m_szPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
BuildFile_t *CProjectBuilder::BuildProject( const char *szProjectName, const char *szPath )
|
BuildFile_t *CProjectBuilder::BuildProject( const char *szProjectName, const char *szPath )
|
||||||
{
|
{
|
||||||
CProject_t stCompileProject = {};
|
CProject_t stCompileProject = {};
|
||||||
@@ -30,7 +53,8 @@ BuildFile_t *CProjectBuilder::BuildProject( const char *szProjectName, const cha
|
|||||||
BuildFileInfo_t *pBuildFileInfo;
|
BuildFileInfo_t *pBuildFileInfo;
|
||||||
BuildFileInfo_t stBuildFileInfo;
|
BuildFileInfo_t stBuildFileInfo;
|
||||||
BuildFile_t *pBuildFile = NULL;
|
BuildFile_t *pBuildFile = NULL;
|
||||||
|
CBuildStage **ppExecutedBuildStage = NULL;
|
||||||
|
GetProjectObjectFn *pfnGetProjectObject = NULL;
|
||||||
CUtlString szWd = CUtlString(szPath).GetDirectory();
|
CUtlString szWd = CUtlString(szPath).GetDirectory();
|
||||||
|
|
||||||
Plat_SetWorkingDir(szWd);
|
Plat_SetWorkingDir(szWd);
|
||||||
@@ -40,16 +64,17 @@ BuildFile_t *CProjectBuilder::BuildProject( const char *szProjectName, const cha
|
|||||||
stCompileProject.files = {
|
stCompileProject.files = {
|
||||||
szPath,
|
szPath,
|
||||||
};
|
};
|
||||||
stCompileProject.includeDirectories = {CUtlString("%s/public",filesystem2->OwnDirectory()),CUtlString("%s/public", filesystem2->BuildDirectory()), CUtlString("%s/../public",filesystem2->OwnDirectory()),CUtlString("%s/../public", filesystem2->BuildDirectory())};
|
stCompileProject.includeDirectories = {CUtlString("%s/public",filesystem2->OwnDirectory())};
|
||||||
stCompileProject.bFPIC = true;
|
stCompileProject.bFPIC = true;
|
||||||
stCompileProject.m_target = Target_t::HostTarget();
|
stCompileProject.m_target = Target_t::HostTarget();
|
||||||
|
|
||||||
stLinkProject = ccompiler->Compile(&stCompileProject);
|
stLinkProject = ccompiler->Compile(&stCompileProject);
|
||||||
stLinkProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
stLinkProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||||
stLinkProject.m_target = Target_t::HostTarget();
|
stLinkProject.m_target = Target_t::HostTarget();
|
||||||
stLinkProject.objects.AppendHead({CUtlString("%s/libfpcbuild.a",filesystem2->OwnDirectory())});
|
stLinkProject.libraryObjects.AppendHead({CUtlString("%s/libfpcbuild.a",filesystem2->OwnDirectory())});
|
||||||
stLinkProject.objects.AppendHead({CUtlString("%s/libtier2.a",filesystem2->OwnDirectory())});
|
stLinkProject.libraryObjects.AppendHead({CUtlString("%s/libfpc.so",filesystem2->OwnDirectory())});
|
||||||
stLinkProject.objects.AppendHead({CUtlString("%s/libtier1.a",filesystem2->OwnDirectory())});
|
stLinkProject.libraryObjects.AppendHead({CUtlString("%s/libtier2.a",filesystem2->OwnDirectory())});
|
||||||
|
stLinkProject.libraryObjects.AppendHead({CUtlString("%s/libtier1.a",filesystem2->OwnDirectory())});
|
||||||
szBuildLibrary = linker->Link(&stLinkProject);
|
szBuildLibrary = linker->Link(&stLinkProject);
|
||||||
|
|
||||||
pLibrary = Plat_LoadLibrary(szBuildLibrary);
|
pLibrary = Plat_LoadLibrary(szBuildLibrary);
|
||||||
@@ -64,17 +89,21 @@ BuildFile_t *CProjectBuilder::BuildProject( const char *szProjectName, const cha
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pBuildFileInfo = (BuildFileInfo_t*)pBuildFactory(BUILD_FILE_INFO_INTERFACE_NAME, NULL);
|
pBuildFileInfo = (BuildFileInfo_t*)pBuildFactory(BUILD_FILE_INFO_INTERFACE_VERSION, NULL);
|
||||||
if (!pBuildFileInfo)
|
ppExecutedBuildStage = (CBuildStage**)pBuildFactory(BUILD_CURRENT_STAGE_INTERFACE_VERSION, NULL);
|
||||||
|
pfnGetProjectObject = (GetProjectObjectFn*)pBuildFactory(BUILD_GET_PROJECT_OBJECT_INTERFACE_VERSION, NULL);
|
||||||
|
if (!pBuildFileInfo || !ppExecutedBuildStage || !pfnGetProjectObject)
|
||||||
{
|
{
|
||||||
V_printf("Failed to find build file info interface\n");
|
V_printf("Required interfaces are not present\n");
|
||||||
Plat_UnloadLibrary(szBuildLibrary);
|
Plat_UnloadLibrary(szBuildLibrary);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
stBuildFileInfo = *pBuildFileInfo;
|
stBuildFileInfo = *pBuildFileInfo;
|
||||||
|
buildFileInfos.AppendTail(stBuildFileInfo);
|
||||||
|
*pfnGetProjectObject = FPC_GetProjectObject;
|
||||||
for (auto a: stBuildFileInfo.m_dependantFiles)
|
for (auto a: stBuildFileInfo.m_dependantFiles)
|
||||||
{
|
{
|
||||||
BuildProject("something", CUtlString("%s/build.cpp",a));
|
BuildProject("something", CUtlString("%s/%s/build.cpp",szWd.GetString(),a));
|
||||||
}
|
}
|
||||||
|
|
||||||
Plat_SetWorkingDir(szWd);
|
Plat_SetWorkingDir(szWd);
|
||||||
@@ -82,7 +111,14 @@ BuildFile_t *CProjectBuilder::BuildProject( const char *szProjectName, const cha
|
|||||||
|
|
||||||
for (auto &build: stBuildFileInfo.m_stages)
|
for (auto &build: stBuildFileInfo.m_stages)
|
||||||
{
|
{
|
||||||
|
*ppExecutedBuildStage = build;
|
||||||
build->m_pMainFn();
|
build->m_pMainFn();
|
||||||
|
for ( auto &o: build->m_outputs)
|
||||||
|
{
|
||||||
|
o.m_szPath.AppendHead("/");
|
||||||
|
o.m_szPath.AppendHead(Plat_GetWorkingDir());
|
||||||
|
printf("%s: %s = %s\n",build->m_psz,o.m_szName, o.m_szPath.GetString());
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
pBuildFile = new BuildFile_t;
|
pBuildFile = new BuildFile_t;
|
||||||
|
|||||||
@@ -7,7 +7,16 @@ ICCompiler *ccompiler;
|
|||||||
CUtlString ICCompiler::GetOutputObjectName( CProject_t *pProject, unsigned int hash, CUtlString szFileName )
|
CUtlString ICCompiler::GetOutputObjectName( CProject_t *pProject, unsigned int hash, CUtlString szFileName )
|
||||||
{
|
{
|
||||||
CUtlString szTarget = pProject->m_target.GetTriplet();
|
CUtlString szTarget = pProject->m_target.GetTriplet();
|
||||||
return CUtlString("%s/%s/cc/%u_%s/%s/%s%s",FPC_TEMPORAL_DIRNAME, szTarget.GetString(), hash, pProject->m_szName.GetString(), filesystem2->BuildDirectory(), szFileName.GetString(), GetOutputObjectFormat());
|
|
||||||
|
return CUtlString(
|
||||||
|
"%s/%s/cc/%u_%s/%s/%s%s",
|
||||||
|
FPC_TEMPORAL_DIRNAME,
|
||||||
|
szTarget.GetString(),
|
||||||
|
hash,
|
||||||
|
pProject->m_szName.GetString(),
|
||||||
|
filesystem2->BuildDirectory(),
|
||||||
|
szFileName.GetString(),
|
||||||
|
GetOutputObjectFormat());
|
||||||
};
|
};
|
||||||
|
|
||||||
CUtlVector<CUtlString> ICCompiler::BuildCommandLine( CProject_t *pProject, const char *szFileName, const char *szOutputFileName )
|
CUtlVector<CUtlString> ICCompiler::BuildCommandLine( CProject_t *pProject, const char *szFileName, const char *szOutputFileName )
|
||||||
@@ -44,6 +53,7 @@ LinkProject_t ICCompiler::Compile( CProject_t *pProject )
|
|||||||
proj.m_androidmanifest = pProject->m_androidmanifest;
|
proj.m_androidmanifest = pProject->m_androidmanifest;
|
||||||
unsigned int hash = pProject->GenerateProjectHash();
|
unsigned int hash = pProject->GenerateProjectHash();
|
||||||
|
|
||||||
|
|
||||||
// Get output directories
|
// Get output directories
|
||||||
for (auto &file: pProject->files)
|
for (auto &file: pProject->files)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ CUtlString CClangLinker::Link( LinkProject_t *pProject )
|
|||||||
}
|
}
|
||||||
if (pProject->m_target.kernel == TARGET_KERNEL_LINUX || pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
if (pProject->m_target.kernel == TARGET_KERNEL_LINUX || pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||||
{
|
{
|
||||||
//args.AppendTail("-rdynamic");
|
args.AppendTail("-Wl,--disable-new-dtags");
|
||||||
args.AppendTail("-Wl,-rpath,$ORIGIN");
|
args.AppendTail("-Wl,-rpath,$ORIGIN");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +174,8 @@ CUtlString CClangLinker::Link( LinkProject_t *pProject )
|
|||||||
args.AppendTail(object.m_szObjectFile);
|
args.AppendTail(object.m_szObjectFile);
|
||||||
if (pProject->m_target.kernel == TARGET_KERNEL_WINDOWS || pProject->m_target.kernel == TARGET_KERNEL_LINUX || pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
if (pProject->m_target.kernel == TARGET_KERNEL_WINDOWS || pProject->m_target.kernel == TARGET_KERNEL_LINUX || pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||||
args.AppendTail("-Wl,--no-whole-archive");
|
args.AppendTail("-Wl,--no-whole-archive");
|
||||||
|
for (auto object: pProject->libraryObjects)
|
||||||
|
args.AppendTail(object);
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
for (auto lib: pProject->libraries)
|
for (auto lib: pProject->libraries)
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ static uint32_t pathSize = sizeof(path);
|
|||||||
static int pathResult = _NSGetExecutablePath(path, &pathSize);
|
static int pathResult = _NSGetExecutablePath(path, &pathSize);
|
||||||
#endif
|
#endif
|
||||||
static char *szPathDir = dirname(path);
|
static char *szPathDir = dirname(path);
|
||||||
char *g_szBuildDir = 0;
|
static char *s_szBuildDir = 0;
|
||||||
|
EXPOSE_INTERFACE_GLOBALVAR(szBuildDir, char*, FILE_SYSTEM_2_BUILD_DIRECTORY_INTERFACE_VERSION, s_szBuildDir);
|
||||||
|
|
||||||
class CPOSIXFileSystem2: public IFileSystem2
|
class CPOSIXFileSystem2: public IFileSystem2
|
||||||
{
|
{
|
||||||
@@ -87,24 +88,26 @@ char *CPOSIXFileSystem2::OwnDirectory()
|
|||||||
};
|
};
|
||||||
char *CPOSIXFileSystem2::BuildDirectory()
|
char *CPOSIXFileSystem2::BuildDirectory()
|
||||||
{
|
{
|
||||||
return g_szBuildDir;
|
return s_szBuildDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
void CPOSIXFileSystem2::CopyFile( const char *szDestination, const char *szOrigin )
|
void CPOSIXFileSystem2::CopyFile( const char *szDestination, const char *szOrigin )
|
||||||
{
|
{
|
||||||
CUtlVector<CUtlString> args = {
|
CUtlVector<CUtlString> args = {
|
||||||
CUtlString(szOrigin),
|
szOrigin,
|
||||||
CUtlString(szDestination),
|
szDestination,
|
||||||
};
|
};
|
||||||
runner->Run("cp", args);
|
printf("runner: %p\n",runner);
|
||||||
|
runner->Run(CUtlString("cp"), args);
|
||||||
|
printf("runner: %p\n",runner);
|
||||||
runner->Wait();
|
runner->Wait();
|
||||||
}
|
}
|
||||||
void CPOSIXFileSystem2::CopyDirectory( const char *szDestination, const char *szOrigin )
|
void CPOSIXFileSystem2::CopyDirectory( const char *szDestination, const char *szOrigin )
|
||||||
{
|
{
|
||||||
CUtlVector<CUtlString> args = {
|
CUtlVector<CUtlString> args = {
|
||||||
"-r",
|
"-r",
|
||||||
CUtlString(szOrigin),
|
szOrigin,
|
||||||
CUtlString(szDestination),
|
szDestination,
|
||||||
};
|
};
|
||||||
runner->Run("cp", args);
|
runner->Run("cp", args);
|
||||||
runner->Wait();
|
runner->Wait();
|
||||||
@@ -133,4 +136,5 @@ bool CPOSIXFileSystem2::ShouldRecompile(const char *szSource, const char *szOutp
|
|||||||
return outbuf.st_mtime < srcbuf.st_mtime;
|
return outbuf.st_mtime < srcbuf.st_mtime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IINIFile *g_pConfig;
|
IINIFile *g_pConfig;
|
||||||
|
|||||||
15
fpc/library/libfpc.cpp
Normal file
15
fpc/library/libfpc.cpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include "helper.h"
|
||||||
|
#include "runner.h"
|
||||||
|
#include "c.h"
|
||||||
|
#include "ld.h"
|
||||||
|
|
||||||
|
void *LibFpcInit()
|
||||||
|
{
|
||||||
|
filesystem2 = (IFileSystem2*)CreateInterface(FILE_SYSTEM_2_INTERFACE_NAME, NULL);
|
||||||
|
runner = (IRunner*)CreateInterface(RUNNER_INTERFACE_NAME, NULL);
|
||||||
|
ccompiler = (ICCompiler*)CreateInterface(CLANG_C_COMPILER_INTERFACE_NAME, NULL);
|
||||||
|
linker = (ILinker*)CreateInterface(CLANG_LINKER_INTERFACE_NAME, NULL);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPOSE_INTERFACE_FN(LibFpcInit, LibFpcInit, LIBFPC_INIT_INTERFACE_VERSION);
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
#include "winerunner.h"
|
#include "winerunner.h"
|
||||||
|
|
||||||
CUtlVector<pid_t> g_processes;
|
|
||||||
|
|
||||||
|
CUtlVector<pid_t> m_processes;
|
||||||
class CPOSIXRunner: public IRunner
|
class CPOSIXRunner: public IRunner
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -51,7 +51,9 @@ int CPOSIXRunner::Run(CUtlString szName, CUtlVector<CUtlString>& args)
|
|||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_processes.AppendTail(pid);
|
printf("%i %p\n",m_processes.GetSize(),m_processes.GetData());
|
||||||
|
m_processes.AppendTail(pid);
|
||||||
|
printf("%i %p\n",m_processes.GetSize(),m_processes.GetData());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +85,9 @@ int CPOSIXRunner::Run(CUtlString szName, CUtlString szDirectory, CUtlVector<CUtl
|
|||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_processes.AppendTail(pid);
|
printf("%i %p\n",m_processes.GetSize(),m_processes.GetData());
|
||||||
|
m_processes.AppendTail(pid);
|
||||||
|
printf("%i %p\n",m_processes.GetSize(),m_processes.GetData());
|
||||||
/* parent */
|
/* parent */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -95,11 +99,17 @@ int CPOSIXRunner::Run(CUtlString szName, CUtlString szDirectory, CUtlVector<CUtl
|
|||||||
|
|
||||||
int CPOSIXRunner::Wait( void )
|
int CPOSIXRunner::Wait( void )
|
||||||
{
|
{
|
||||||
for (auto &process: g_processes)
|
printf("%i %p\n",m_processes.GetSize(),m_processes.GetData());
|
||||||
|
if (m_processes.GetSize())
|
||||||
|
printf("%i\n",m_processes[0]);
|
||||||
|
|
||||||
|
printf("%i %p\n",m_processes.GetSize(),m_processes.GetData());
|
||||||
|
for (int i = 0; i<m_processes.GetSize(); i++)
|
||||||
{
|
{
|
||||||
|
printf("p %i\n",m_processes[i]);
|
||||||
int status;
|
int status;
|
||||||
pid_t wpid = waitpid(process, &status, 0);
|
pid_t wpid = waitpid(m_processes[i], &status, 0);
|
||||||
}
|
}
|
||||||
g_processes = {};
|
m_processes = {};
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "tier1/commandline.h"
|
#include "tier1/commandline.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
CUtlVector<pid_t> g_processes;
|
|
||||||
|
|
||||||
class CWindowsRunner: public IRunner
|
class CWindowsRunner: public IRunner
|
||||||
{
|
{
|
||||||
@@ -15,6 +14,7 @@ public:
|
|||||||
virtual int Run( CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args ) override;
|
virtual int Run( CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args ) override;
|
||||||
virtual int Run( CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args, CUtlVector<CUtlString>& environment ) override;
|
virtual int Run( CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args, CUtlVector<CUtlString>& environment ) override;
|
||||||
virtual int Wait( void ) override;
|
virtual int Wait( void ) override;
|
||||||
|
CUtlVector<pid_t> s_processes = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
EXPOSE_INTERFACE(CWindowsRunner, IRunner, POSIX_RUNNER_INTERFACE_NAME);
|
EXPOSE_INTERFACE(CWindowsRunner, IRunner, POSIX_RUNNER_INTERFACE_NAME);
|
||||||
@@ -47,7 +47,7 @@ int CWindowsRunner::Run(CUtlString szName, CUtlVector<CUtlString>& args)
|
|||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_processes.AppendTail(pid);
|
s_processes.AppendTail(pid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ int CWindowsRunner::Run(CUtlString szName, CUtlString szDirectory, CUtlVector<CU
|
|||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_processes.AppendTail(pid);
|
s_processes.AppendTail(pid);
|
||||||
/* parent */
|
/* parent */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -91,11 +91,11 @@ int CWindowsRunner::Run(CUtlString szName, CUtlString szDirectory, CUtlVector<CU
|
|||||||
|
|
||||||
int CWindowsRunner::Wait( void )
|
int CWindowsRunner::Wait( void )
|
||||||
{
|
{
|
||||||
for (auto &process: g_processes)
|
for (auto &process: s_processes)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
pid_t wpid = waitpid(process, &status, 0);
|
pid_t wpid = waitpid(process, &status, 0);
|
||||||
}
|
}
|
||||||
g_processes = {};
|
s_processes = {};
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
BIN
fpc/libtier0.so
Normal file
BIN
fpc/libtier0.so
Normal file
Binary file not shown.
38
fpc/main.cpp
38
fpc/main.cpp
@@ -16,7 +16,7 @@
|
|||||||
#include "builder.h"
|
#include "builder.h"
|
||||||
|
|
||||||
CUtlString owndir;
|
CUtlString owndir;
|
||||||
extern char *g_szBuildDir;
|
static char **pszBuildDir;
|
||||||
|
|
||||||
void build_tier0()
|
void build_tier0()
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,7 @@ void build_tier0()
|
|||||||
|
|
||||||
int build()
|
int build()
|
||||||
{
|
{
|
||||||
BuildFile_t *pBuildFile = ProjectBuilder()->BuildProject("main",CUtlString("%s/build.cpp",g_szBuildDir));
|
BuildFile_t *pBuildFile = ProjectBuilder()->BuildProject("main",CUtlString("%s/build.cpp",*pszBuildDir));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -80,6 +80,12 @@ void IEngine_Signal(int sig)
|
|||||||
Plat_Exit(0);
|
Plat_Exit(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IRunner *runner;
|
||||||
|
IWineRunner *winerunner;
|
||||||
|
ICCompiler *ccompiler;
|
||||||
|
ILinker *linker;
|
||||||
|
|
||||||
|
|
||||||
int main(int c, char **v)
|
int main(int c, char **v)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -104,7 +110,6 @@ findbuild:
|
|||||||
} else {
|
} else {
|
||||||
V_fclose(file);
|
V_fclose(file);
|
||||||
}
|
}
|
||||||
g_szBuildDir = szBuildcppDir;
|
|
||||||
|
|
||||||
#ifdef __linux
|
#ifdef __linux
|
||||||
signal(SIGHUP, IEngine_Signal);
|
signal(SIGHUP, IEngine_Signal);
|
||||||
@@ -118,17 +123,28 @@ findbuild:
|
|||||||
signal(SIGSEGV, IEngine_Signal);
|
signal(SIGSEGV, IEngine_Signal);
|
||||||
signal(SIGTERM, IEngine_Signal);
|
signal(SIGTERM, IEngine_Signal);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
runner = (IRunner*)CreateInterface(RUNNER_INTERFACE_NAME, NULL);
|
|
||||||
winerunner = (IWineRunner*)CreateInterface(WINE_RUNNER_INTERFACE_NAME, NULL);
|
|
||||||
filesystem2 = (IFileSystem2*)CreateInterface(FILE_SYSTEM_2_INTERFACE_NAME, NULL);
|
|
||||||
ccompiler = (ICCompiler*)CreateInterface(CLANG_C_COMPILER_INTERFACE_NAME, NULL);
|
|
||||||
linker = (ILinker*)CreateInterface(CLANG_LINKER_INTERFACE_NAME, NULL);
|
|
||||||
|
|
||||||
void *pFilesystem = Plat_LoadLibrary(CUtlString("%s/libfilesystem_std.so",filesystem2->OwnDirectory()));
|
|
||||||
|
void *pLibFPC = Plat_LoadLibrary("libfpc.so");
|
||||||
|
CreateInterfaceFn pLibFPCFactory = Sys_GetFactory(pLibFPC);
|
||||||
|
|
||||||
|
filesystem2 = (IFileSystem2*)pLibFPCFactory(FILE_SYSTEM_2_INTERFACE_NAME, NULL);
|
||||||
|
pszBuildDir = (char**)pLibFPCFactory(FILE_SYSTEM_2_BUILD_DIRECTORY_INTERFACE_VERSION, NULL);
|
||||||
|
*pszBuildDir = szBuildcppDir;
|
||||||
|
runner = (IRunner*)pLibFPCFactory(RUNNER_INTERFACE_NAME, NULL);
|
||||||
|
winerunner = (IWineRunner*)pLibFPCFactory(WINE_RUNNER_INTERFACE_NAME, NULL);
|
||||||
|
ccompiler = (ICCompiler*)pLibFPCFactory(CLANG_C_COMPILER_INTERFACE_NAME, NULL);
|
||||||
|
linker = (ILinker*)pLibFPCFactory(CLANG_LINKER_INTERFACE_NAME, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pLibFPCFactory(LIBFPC_INIT_INTERFACE_VERSION, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
void *pFilesystem = Plat_LoadLibrary("libfilesystem_std.so");
|
||||||
CreateInterfaceFn pFilesystemFactory = Sys_GetFactory(pFilesystem);
|
CreateInterfaceFn pFilesystemFactory = Sys_GetFactory(pFilesystem);
|
||||||
|
|
||||||
filesystem = (IFileSystem*)CreateInterface(FILESYSTEM_INTERFACE_VERSION, NULL);
|
filesystem = (IFileSystem*)pFilesystemFactory(FILESYSTEM_INTERFACE_VERSION, NULL);
|
||||||
filesystem->Init();
|
filesystem->Init();
|
||||||
|
|
||||||
g_pConfig = INIManager()->ReadFile(".fpccfg");
|
g_pConfig = INIManager()->ReadFile(".fpccfg");
|
||||||
|
|||||||
0
fpc/public/generator.h
Normal file
0
fpc/public/generator.h
Normal file
@@ -47,6 +47,7 @@ public:
|
|||||||
// File system manager.
|
// File system manager.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#define FILE_SYSTEM_2_INTERFACE_NAME "FileSystem2_001"
|
#define FILE_SYSTEM_2_INTERFACE_NAME "FileSystem2_001"
|
||||||
|
#define FILE_SYSTEM_2_BUILD_DIRECTORY_INTERFACE_VERSION "FileSystem2BuildDirectory_001"
|
||||||
|
|
||||||
abstract_class IFileSystem2
|
abstract_class IFileSystem2
|
||||||
{
|
{
|
||||||
@@ -75,6 +76,11 @@ public:
|
|||||||
|
|
||||||
extern IFileSystem2 *filesystem2;
|
extern IFileSystem2 *filesystem2;
|
||||||
|
|
||||||
|
struct StageOutput_t
|
||||||
|
{
|
||||||
|
const char *m_szName;
|
||||||
|
CUtlString m_szPath;
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Build stage.
|
// Build stage.
|
||||||
@@ -84,6 +90,8 @@ class CBuildStage
|
|||||||
public:
|
public:
|
||||||
CBuildStage( const char *psz, int(*pMainFn)() );
|
CBuildStage( const char *psz, int(*pMainFn)() );
|
||||||
const char *m_psz;
|
const char *m_psz;
|
||||||
|
CUtlString m_szPath;
|
||||||
|
CUtlVector<StageOutput_t> m_outputs;
|
||||||
int(*m_pMainFn)();
|
int(*m_pMainFn)();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -110,11 +118,14 @@ static int __build_stage_##sz()
|
|||||||
#define ADD_DEPENDENCY_BUILD_FILE(name, path) \
|
#define ADD_DEPENDENCY_BUILD_FILE(name, path) \
|
||||||
static CBuildDependentFile __##name##DependencyFile(path);
|
static CBuildDependentFile __##name##DependencyFile(path);
|
||||||
|
|
||||||
#define ADD_OUTPUT_LIBRARY(sz) \
|
#define ADD_OUTPUT_OBJECT(sz, path) \
|
||||||
|
g_pCurrentStage->m_outputs.AppendTail((StageOutput_t){sz, path});
|
||||||
|
|
||||||
#define DEPEND_ON_PROJECT(sz) \
|
#define DEPEND_ON_PROJECT(sz) \
|
||||||
|
|
||||||
#define GET_PROJECT_LIBRARY(sz, szLib) \
|
#define GET_PROJECT_LIBRARY(sz, szLib) \
|
||||||
|
FPC_GetProjectObject(#sz, szLib)
|
||||||
|
|
||||||
|
|
||||||
struct BuildFileInfo_t
|
struct BuildFileInfo_t
|
||||||
{
|
{
|
||||||
@@ -123,8 +134,18 @@ struct BuildFileInfo_t
|
|||||||
};
|
};
|
||||||
|
|
||||||
BuildFileInfo_t *GetBuildFileInfo();
|
BuildFileInfo_t *GetBuildFileInfo();
|
||||||
|
extern CBuildStage *g_pCurrentStage;
|
||||||
|
|
||||||
#define BUILD_FILE_INFO_INTERFACE_NAME "BuildFileInfo001"
|
CUtlString FPC_GetProjectObject( const char *szName, const char *szObjectName );
|
||||||
|
|
||||||
|
|
||||||
|
#define BUILD_FILE_INFO_INTERFACE_VERSION "BuildFileInfo001"
|
||||||
|
#define BUILD_CURRENT_STAGE_INTERFACE_VERSION "BuildCurrentStage001"
|
||||||
|
|
||||||
|
typedef CUtlString(*GetProjectObjectFn)( const char *szName, const char *szObjectName );
|
||||||
|
#define BUILD_GET_PROJECT_OBJECT_INTERFACE_VERSION "GetProjectObject001"
|
||||||
|
|
||||||
|
#define LIBFPC_INIT_INTERFACE_VERSION "LibFPCInit001"
|
||||||
|
|
||||||
|
|
||||||
extern IINIFile *g_pConfig;
|
extern IINIFile *g_pConfig;
|
||||||
|
|||||||
0
fpc/public/temporalmgr.h
Normal file
0
fpc/public/temporalmgr.h
Normal file
0
fpc/public/watchmgr.h
Normal file
0
fpc/public/watchmgr.h
Normal file
@@ -27,7 +27,7 @@ public:
|
|||||||
|
|
||||||
#define EXPOSE_INTERFACE_GLOBALVAR( className, interfaceName, versionName, globalVarName ) \
|
#define EXPOSE_INTERFACE_GLOBALVAR( className, interfaceName, versionName, globalVarName ) \
|
||||||
static void *__Create##className##_interface() { return ( interfaceName* )( &globalVarName ); }; \
|
static void *__Create##className##_interface() { return ( interfaceName* )( &globalVarName ); }; \
|
||||||
static CInterfaceRegistry __Create##interfaceName##_registry( __Create##className##_interface, versionName );
|
static CInterfaceRegistry __Create##className##_registry( __Create##className##_interface, versionName );
|
||||||
|
|
||||||
|
|
||||||
DLL_EXPORT void *CreateInterface( const char *szName, int *pReturnCode );
|
DLL_EXPORT void *CreateInterface( const char *szName, int *pReturnCode );
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ CUtlVector<CUtlString> tier0_CompiledFiles = {
|
|||||||
"mem.cpp",
|
"mem.cpp",
|
||||||
"platform.cpp",
|
"platform.cpp",
|
||||||
"network.cpp",
|
"network.cpp",
|
||||||
|
"commandline.cpp"
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_BUILD_STAGE(tier0)
|
DECLARE_BUILD_STAGE(tier0)
|
||||||
@@ -26,7 +27,7 @@ DECLARE_BUILD_STAGE(tier0)
|
|||||||
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||||
szOutputProject = linker->Link(&ldProject);
|
szOutputProject = linker->Link(&ldProject);
|
||||||
|
|
||||||
ADD_OUTPUT_LIBRARY(szOutputProject);
|
ADD_OUTPUT_OBJECT("tier0", szOutputProject);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ CUtlVector<CUtlString> tier1_CompiledFiles = {
|
|||||||
"tier1/utlstring.cpp",
|
"tier1/utlstring.cpp",
|
||||||
"tier1/utlvector.cpp",
|
"tier1/utlvector.cpp",
|
||||||
};
|
};
|
||||||
|
CUtlString tier1_lib;
|
||||||
|
|
||||||
DECLARE_BUILD_STAGE(tier1)
|
DECLARE_BUILD_STAGE(tier1)
|
||||||
{
|
{
|
||||||
@@ -21,15 +22,13 @@ DECLARE_BUILD_STAGE(tier1)
|
|||||||
|
|
||||||
compileProject.m_szName = "tier1";
|
compileProject.m_szName = "tier1";
|
||||||
compileProject.files = tier1_CompiledFiles;
|
compileProject.files = tier1_CompiledFiles;
|
||||||
compileProject.includeDirectories = {"../public"};
|
compileProject.includeDirectories = all_IncludeDirectories;
|
||||||
compileProject.bFPIC = true;
|
compileProject.bFPIC = true;
|
||||||
ldProject = ccompiler->Compile(&compileProject);
|
ldProject = ccompiler->Compile(&compileProject);
|
||||||
ldProject.linkType = ELINK_STATIC_LIBRARY;
|
ldProject.linkType = ELINK_STATIC_LIBRARY;
|
||||||
|
|
||||||
CUtlString szOutputDir = linker->Link(&ldProject);
|
CUtlString outputProject = linker->Link(&ldProject);
|
||||||
|
tier1_lib = outputProject;
|
||||||
ADD_OUTPUT_LIBRARY(szOutputDir)
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
CUtlVector<CUtlString> tier1_CompiledFiles = {
|
CUtlVector<CUtlString> tier1_CompiledFiles = {
|
||||||
"interface.cpp",
|
"interface.cpp",
|
||||||
"appinit.cpp",
|
"appinit.cpp",
|
||||||
"commandline.cpp",
|
|
||||||
"utlbuffer.cpp",
|
"utlbuffer.cpp",
|
||||||
"utlmap.cpp",
|
"utlmap.cpp",
|
||||||
"utlstring.cpp",
|
"utlstring.cpp",
|
||||||
@@ -28,7 +27,7 @@ DECLARE_BUILD_STAGE(tier1)
|
|||||||
|
|
||||||
CUtlString szOutputDir = linker->Link(&ldProject);
|
CUtlString szOutputDir = linker->Link(&ldProject);
|
||||||
|
|
||||||
ADD_OUTPUT_LIBRARY(szOutputDir)
|
ADD_OUTPUT_OBJECT("tier1", szOutputDir)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,8 +35,5 @@ DLL_EXPORT void *CreateInterface( const char *szName, int *pReturnCode )
|
|||||||
|
|
||||||
CreateInterfaceFn Sys_GetFactory( void *lib )
|
CreateInterfaceFn Sys_GetFactory( void *lib )
|
||||||
{
|
{
|
||||||
#ifdef POSIX
|
|
||||||
return CreateInterface;
|
|
||||||
#endif
|
|
||||||
return (CreateInterfaceFn)Plat_GetProc(lib, "CreateInterface");
|
return (CreateInterfaceFn)Plat_GetProc(lib, "CreateInterface");
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -26,7 +26,7 @@ DECLARE_BUILD_STAGE(tier2)
|
|||||||
|
|
||||||
CUtlString szOutputProject = linker->Link(&ldProject);
|
CUtlString szOutputProject = linker->Link(&ldProject);
|
||||||
|
|
||||||
ADD_OUTPUT_LIBRARY(szOutputProject)
|
ADD_OUTPUT_OBJECT("tier2", szOutputProject)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user