#include "helper.h"
#include "c.h"
#include "ld.h"
#include "tier1/utlstring.h"
#include "tier1/commandline.h"

CUtlVector<CUtlString> server_CompiledFiles = {
	"game/server/game.cpp",
	"game/server/milmoba/player.cpp",
};

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

	compileProject.m_szName = "server";
	compileProject.files = server_CompiledFiles;
	compileProject.includeDirectories = all_IncludeDirectories;
	compileProject.bFPIC = true;
	ldProject = compileProject.Compile();
	if (bStaticBuild)
		ldProject.linkType = ELINK_STATIC_LIBRARY;
	else
		ldProject.linkType = ELINK_DYNAMIC_LIBRARY;

	CUtlString outputProject = ldProject.Link();
	
	if (!bStaticBuild)
	{
		IFileSystem2::MakeDirectory(CUtlString("%s/funnygame/bin",szOutputDir.GetString()));
		IFileSystem2::CopyFile(CUtlString("%s/funnygame/bin", szOutputDir.GetString()), outputProject);
	} else {
		server_lib = outputProject;
	}

	return 0;
};
DECLARE_BUILD_STAGE(server, server_build);
