#include "c.h"
#include "ld.h"
#include "helper.h"
#include "tier0/platform.h"
#include "signal.h"

CUtlVector<CUtlString> g_CompiledFiles = {
	"main.cpp",
	"library/runner.cpp",
	"library/helper.cpp",
	"library/c.cpp",
	"library/ld.cpp",
	"library/target.cpp",
	"../tier0/lib.cpp",
	"../tier0/mem.cpp",
	"../tier0/platform.cpp",
	"../tier1/utlbuffer.cpp",
	"../tier1/utlstring.cpp",
	"../tier1/utlvector.cpp",
	"../tier1/utlmap.cpp",
	"../tier1/commandline.cpp",
};

CUtlVector<CUtlString> g_IncludeDirectories = {
	"public",
	"../public",
};


int build_fpc()
{
	CCProject compileProject = {};
	CLDProject ldProject = {};

	compileProject.m_szName = "fpc";
	compileProject.files = g_CompiledFiles;
	compileProject.includeDirectories = g_IncludeDirectories;
	ldProject = compileProject.Compile();

	CUtlString outputProject = ldProject.Link();

	IFileSystem2::MakeDirectory("../build/tools");
	IFileSystem2::CopyFile("fpc_temp", outputProject);

	return 0;
};
DECLARE_BUILD_STAGE(fpc, build_fpc);
