now use fpc
This commit is contained in:
20
build.cpp
20
build.cpp
@@ -1 +1,21 @@
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
CUtlVector<CUtlString> all_IncludeDirectories = {
|
||||
"public",
|
||||
"external/cglm/include",
|
||||
"external/Vulkan-Headers/include",
|
||||
"external/VulkanMemoryAllocator/include",
|
||||
"external/stb",
|
||||
};
|
||||
|
||||
#include "tier0/__build.cpp"
|
||||
#include "tier1/__build.cpp"
|
||||
|
||||
#include "rapier/__build.cpp"
|
||||
#include "engine/__build.cpp"
|
||||
|
||||
#include "launcher/__build.cpp"
|
||||
|
||||
#include "game/server/__build.cpp"
|
||||
#include "game/client/__build.cpp"
|
||||
|
||||
48
engine/__build.cpp
Normal file
48
engine/__build.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "helper.h"
|
||||
#include "c.h"
|
||||
#include "ld.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
CUtlVector<CUtlString> engine_CompiledFiles = {
|
||||
"engine/console.cpp",
|
||||
"engine/filesystem.cpp",
|
||||
"engine/server.cpp",
|
||||
"engine/engine.cpp",
|
||||
|
||||
/* rendering */
|
||||
"engine/vk_video.cpp",
|
||||
"engine/vk_mesh.cpp",
|
||||
|
||||
/* entities */
|
||||
"engine/baseentity.cpp",
|
||||
"engine/level.cpp",
|
||||
"engine/brush.cpp",
|
||||
|
||||
/* server */
|
||||
"engine/sv_worldspawn.cpp",
|
||||
"engine/sv_light.cpp",
|
||||
|
||||
/* client */
|
||||
"engine/cl_worldspawn.cpp",
|
||||
"engine/cl_light.cpp",
|
||||
|
||||
"engine/vk_videosdl.cpp",
|
||||
};
|
||||
|
||||
int engine_build()
|
||||
{
|
||||
CCProject compileProject = {};
|
||||
CLDProject ldProject = {};
|
||||
|
||||
compileProject.m_szName = "engine";
|
||||
compileProject.files = engine_CompiledFiles;
|
||||
compileProject.includeDirectories = all_IncludeDirectories;
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = compileProject.Compile();
|
||||
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||
|
||||
CUtlString outputProject = ldProject.Link();
|
||||
|
||||
return 0;
|
||||
};
|
||||
DECLARE_BUILD_STAGE(engine, engine_build);
|
||||
24
fpc/Makefile
24
fpc/Makefile
@@ -1,19 +1,25 @@
|
||||
TIER0_FILES := $(wildcard ../tier0/*.cpp)
|
||||
TIER1_FILES := $(wildcard ../tier1/*.cpp)
|
||||
TIER_FILES := ../tier0/lib.cpp ../tier0/mem.cpp ../tier0/platform.cpp ../tier1/utlbuffer.cpp ../tier1/utlstring.cpp ../tier1/utlvector.cpp ../tier1/utlmap.cpp ../tier1/commandline.cpp
|
||||
FPC_FILES := main.cpp library/runner.cpp library/helper.cpp library/c.cpp library/ld.cpp
|
||||
CC = clang
|
||||
OUTPUT_DIR = fpc
|
||||
|
||||
recompile:
|
||||
recompile: ../build/tools
|
||||
./fpc build
|
||||
mv fpc_temp fpc
|
||||
cp fpc ../build/tools/fpc
|
||||
|
||||
install: $(FPC_FILES) ../build/tools
|
||||
$(CC) -g -rdynamic $(TIER_FILES) $(FPC_FILES) -I../public -Ipublic -lc -lstdc++ -o $(OUTPUT_DIR)
|
||||
./fpc build
|
||||
mv fpc_temp fpc
|
||||
|
||||
|
||||
../build/tools:
|
||||
mkdir -p ../build/tools
|
||||
|
||||
install: $(TIER0_FILES) $(TIER1_FILES) $(FPC_FILES) ../build/tools
|
||||
$(CC) -g -rdynamic $(TIER0_FILES) $(TIER1_FILES) $(FPC_FILES) -I../public -Ipublic -lc -lstdc++ -o $(OUTPUT_DIR)
|
||||
./fpc build
|
||||
mv fpc_temp fpc
|
||||
cp fpc ../build/tools/fpc
|
||||
install_fpc:
|
||||
cp fpc ../build/tools
|
||||
cp -r public ../build/tools
|
||||
cp -r ../public/tier0 ../build/tools/public
|
||||
cp -r ../public/tier1 ../build/tools/public
|
||||
|
||||
auto: install install_fpc
|
||||
|
||||
@@ -25,7 +25,10 @@ CUtlString CLDProject::Link( void )
|
||||
{
|
||||
CUtlVector<CUtlString> args = {
|
||||
"rcs",
|
||||
szOutputFile
|
||||
};
|
||||
for (auto object: objects)
|
||||
args.AppendTail(object.m_szObjectFile);
|
||||
IRunner::Run("ar", args);
|
||||
} else {
|
||||
CUtlVector<CUtlString> args = {
|
||||
|
||||
@@ -28,6 +28,25 @@ int IRunner::Run(CUtlString szName, CUtlVector<CUtlString>& args)
|
||||
|
||||
int IRunner::Run(CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args)
|
||||
{
|
||||
pid_t pid = fork();
|
||||
if (pid < 0)
|
||||
Plat_FatalErrorFunc("Failed to fork");
|
||||
/* child */
|
||||
if (pid == 0)
|
||||
{
|
||||
CUtlVector<const char*> execargs;
|
||||
execargs.AppendTail(szName);
|
||||
for (auto &arg: args)
|
||||
{
|
||||
execargs.AppendTail(arg);
|
||||
}
|
||||
execargs.AppendTail(0);
|
||||
chdir(szDirectory.GetString());
|
||||
execvp(szName, (char *const*)execargs.GetData());
|
||||
}
|
||||
/* parent */
|
||||
wait(NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IRunner::Run(CUtlString szName, CUtlString szDirectory, CUtlVector<CUtlString>& args, CUtlVector<CUtlString>& environment)
|
||||
|
||||
26
game/client/__build.cpp
Normal file
26
game/client/__build.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "helper.h"
|
||||
#include "c.h"
|
||||
#include "ld.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
CUtlVector<CUtlString> client_CompiledFiles = {
|
||||
"game/client/baseplayer.cpp",
|
||||
};
|
||||
|
||||
int client_build()
|
||||
{
|
||||
CCProject compileProject = {};
|
||||
CLDProject ldProject = {};
|
||||
|
||||
compileProject.m_szName = "client";
|
||||
compileProject.files = client_CompiledFiles;
|
||||
compileProject.includeDirectories = all_IncludeDirectories;
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = compileProject.Compile();
|
||||
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||
|
||||
CUtlString outputProject = ldProject.Link();
|
||||
|
||||
return 0;
|
||||
};
|
||||
DECLARE_BUILD_STAGE(client, client_build);
|
||||
27
game/server/__build.cpp
Normal file
27
game/server/__build.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "helper.h"
|
||||
#include "c.h"
|
||||
#include "ld.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
CUtlVector<CUtlString> server_CompiledFiles = {
|
||||
"game/server/game.cpp",
|
||||
"game/server/baseplayer.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();
|
||||
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||
|
||||
CUtlString outputProject = ldProject.Link();
|
||||
|
||||
return 0;
|
||||
};
|
||||
DECLARE_BUILD_STAGE(server, server_build);
|
||||
26
launcher/__build.cpp
Normal file
26
launcher/__build.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "helper.h"
|
||||
#include "c.h"
|
||||
#include "ld.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
CUtlVector<CUtlString> launcher_CompiledFiles = {
|
||||
"launcher/launcher.cpp",
|
||||
};
|
||||
|
||||
int launcher_build()
|
||||
{
|
||||
CCProject compileProject = {};
|
||||
CLDProject ldProject = {};
|
||||
|
||||
compileProject.m_szName = "launcher";
|
||||
compileProject.files = launcher_CompiledFiles;
|
||||
compileProject.includeDirectories = all_IncludeDirectories;
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = compileProject.Compile();
|
||||
ldProject.linkType = ELINK_EXECUTABLE;
|
||||
|
||||
CUtlString outputProject = ldProject.Link();
|
||||
|
||||
return 0;
|
||||
};
|
||||
DECLARE_BUILD_STAGE(launcher, launcher_build);
|
||||
@@ -8,12 +8,10 @@
|
||||
// fuck C++ twice
|
||||
// fuck C++ thrice
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "unban_std.h"
|
||||
|
||||
#include "initializer_list"
|
||||
template<typename T>
|
||||
using CUtlInitializerList = std::initializer_list<T>;
|
||||
|
||||
#include "ban_std.h"
|
||||
|
||||
#endif
|
||||
|
||||
28
rapier/__build.cpp
Normal file
28
rapier/__build.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "helper.h"
|
||||
#include "c.h"
|
||||
#include "ld.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
int rapier_build()
|
||||
{
|
||||
CUtlVector<CUtlString> cargo_args = {
|
||||
"build",
|
||||
"--release",
|
||||
"--target",
|
||||
"x86_64-unknown-linux-gnu"
|
||||
};
|
||||
IRunner::Run("cargo", "rapier", cargo_args);
|
||||
|
||||
CUtlVector<CUtlString> cbindgen_args = {
|
||||
"--config",
|
||||
"cbindgen.toml",
|
||||
"--crate",
|
||||
"rapier_rtt",
|
||||
"--output",
|
||||
"../public/physics_gen.h",
|
||||
};
|
||||
IRunner::Run("cbindgen", "rapier", cbindgen_args);
|
||||
|
||||
return 0;
|
||||
};
|
||||
DECLARE_BUILD_STAGE(rapier, rapier_build);
|
||||
@@ -1,9 +1,28 @@
|
||||
#include "helper.h"
|
||||
#include "c.h"
|
||||
#include "ld.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
CUtlVector<CUtlString> tier0_CompiledFiles = {
|
||||
"tier0/lib.cpp",
|
||||
"tier0/mem.cpp",
|
||||
"tier0/platform.cpp",
|
||||
};
|
||||
|
||||
int tier0_build()
|
||||
{
|
||||
CCProject compileProject = {};
|
||||
CLDProject ldProject = {};
|
||||
|
||||
compileProject.m_szName = "tier0";
|
||||
compileProject.files = tier0_CompiledFiles;
|
||||
compileProject.includeDirectories = all_IncludeDirectories;
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = compileProject.Compile();
|
||||
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||
|
||||
CUtlString outputProject = ldProject.Link();
|
||||
|
||||
return 0;
|
||||
};
|
||||
DECLARE_BUILD_STAGE(tier0, tier0_build);
|
||||
|
||||
30
tier1/__build.cpp
Normal file
30
tier1/__build.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "helper.h"
|
||||
#include "c.h"
|
||||
#include "ld.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
CUtlVector<CUtlString> tier1_CompiledFiles = {
|
||||
"tier1/commandline.cpp",
|
||||
"tier1/utlbuffer.cpp",
|
||||
"tier1/utlmap.cpp",
|
||||
"tier1/utlstring.cpp",
|
||||
"tier1/utlvector.cpp",
|
||||
};
|
||||
|
||||
int tier1_build()
|
||||
{
|
||||
CCProject compileProject = {};
|
||||
CLDProject ldProject = {};
|
||||
|
||||
compileProject.m_szName = "tier1";
|
||||
compileProject.files = tier1_CompiledFiles;
|
||||
compileProject.includeDirectories = all_IncludeDirectories;
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = compileProject.Compile();
|
||||
ldProject.linkType = ELINK_STATIC_LIBRARY;
|
||||
|
||||
CUtlString outputProject = ldProject.Link();
|
||||
|
||||
return 0;
|
||||
};
|
||||
DECLARE_BUILD_STAGE(tier1, tier1_build);
|
||||
Reference in New Issue
Block a user