From 11864f89020256547f53310548b8c138040be929 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 15 May 2023 14:47:03 +0200 Subject: [PATCH] Add all public headers to CMake projects Added all public headers to CMake projects, also moved some files around in the public directory. Translation units have been moved to the libraries that were responsible for implementing them, as this game is monolithic. --- r5dev/CMakeLists.txt | 1 + r5dev/core/CMakeLists.txt | 2 ++ r5dev/engine/CMakeLists.txt | 34 +++++++++++++++++++++ r5dev/{public => engine}/datamap.cpp | 0 r5dev/{public => engine}/dt_recv.cpp | 0 r5dev/{public => engine}/networkvar.cpp | 0 r5dev/game/CMakeLists.txt | 19 ++++++++++++ r5dev/game/server/baseentity.h | 2 +- r5dev/materialsystem/CMakeLists.txt | 8 ++++- r5dev/public/appframework/IAppSystemGroup.h | 2 +- r5dev/public/iserverentity.h | 3 +- r5dev/public/{ => tier0}/imemalloc.h | 0 r5dev/public/{ => tier1}/interface.h | 0 r5dev/public/tier1/memstack.h | 2 +- r5dev/public/{ => tier1}/string_t.h | 0 r5dev/studiorender/CMakeLists.txt | 20 ++++++++++++ r5dev/studiorender/studiorendercontext.cpp | 7 +++++ r5dev/tier0/CMakeLists.txt | 2 ++ r5dev/tier1/CMakeLists.txt | 3 ++ r5dev/vpc/interfaces.h | 2 +- r5dev/vstdlib/CMakeLists.txt | 4 +++ 21 files changed, 104 insertions(+), 7 deletions(-) rename r5dev/{public => engine}/datamap.cpp (100%) rename r5dev/{public => engine}/dt_recv.cpp (100%) rename r5dev/{public => engine}/networkvar.cpp (100%) rename r5dev/public/{ => tier0}/imemalloc.h (100%) rename r5dev/public/{ => tier1}/interface.h (100%) rename r5dev/public/{ => tier1}/string_t.h (100%) create mode 100644 r5dev/studiorender/CMakeLists.txt create mode 100644 r5dev/studiorender/studiorendercontext.cpp diff --git a/r5dev/CMakeLists.txt b/r5dev/CMakeLists.txt index 1f79e679..97184d2e 100644 --- a/r5dev/CMakeLists.txt +++ b/r5dev/CMakeLists.txt @@ -52,6 +52,7 @@ add_subdirectory( materialsystem ) add_subdirectory( inputsystem ) add_subdirectory( filesystem ) add_subdirectory( datacache ) +add_subdirectory( studiorender ) add_subdirectory( localize ) add_subdirectory( engine ) add_subdirectory( vguimatsurface ) diff --git a/r5dev/core/CMakeLists.txt b/r5dev/core/CMakeLists.txt index 01231fa1..4b5628de 100644 --- a/r5dev/core/CMakeLists.txt +++ b/r5dev/core/CMakeLists.txt @@ -89,6 +89,8 @@ target_link_libraries( ${PROJECT_NAME} PRIVATE "inputsystem" "materialsystem" + "studiorender" + "vguimatsurface" "vgui" "rui" diff --git a/r5dev/engine/CMakeLists.txt b/r5dev/engine/CMakeLists.txt index 9b9abed6..6cffcd88 100644 --- a/r5dev/engine/CMakeLists.txt +++ b/r5dev/engine/CMakeLists.txt @@ -43,6 +43,8 @@ add_sources( SOURCE_GROUP "Render" endif() add_sources( SOURCE_GROUP "Network" + "dt_recv.cpp" + "datamap.cpp" "datablock.h" "framesnapshot.h" "net.cpp" @@ -54,6 +56,7 @@ add_sources( SOURCE_GROUP "Network" "packed_entity.h" "staticpropmgr.cpp" "staticpropmgr.h" + # "networkvar.cpp" # TODO: Enable? ) add_sources( SOURCE_GROUP "Model" @@ -180,6 +183,37 @@ add_sources( SOURCE_GROUP "Common" "${ENGINE_SOURCE_DIR}/common/x86defs.h" ) +file( GLOB ENGINE_PUBLIC_HEADERS + "${ENGINE_SOURCE_DIR}/public/engine/*" +) +add_sources( SOURCE_GROUP "Public" + "${ENGINE_PUBLIC_HEADERS}" + "${ENGINE_SOURCE_DIR}/public/const.h" + "${ENGINE_SOURCE_DIR}/public/dt_common.h" + "${ENGINE_SOURCE_DIR}/public/dt_send.h" + "${ENGINE_SOURCE_DIR}/public/dt_recv.h" + "${ENGINE_SOURCE_DIR}/public/datamap.h" + "${ENGINE_SOURCE_DIR}/public/idebugoverlay.h" + "${ENGINE_SOURCE_DIR}/public/iengine.h" + "${ENGINE_SOURCE_DIR}/public/igame.h" + "${ENGINE_SOURCE_DIR}/public/iserver.h" + "${ENGINE_SOURCE_DIR}/public/isnapshotmgr.h" + "${ENGINE_SOURCE_DIR}/public/inetchannel.h" + "${ENGINE_SOURCE_DIR}/public/inetmessage.h" + "${ENGINE_SOURCE_DIR}/public/inetmsghandler.h" + "${ENGINE_SOURCE_DIR}/public/server_class.h" + "${ENGINE_SOURCE_DIR}/public/networkvar.h" + "${ENGINE_SOURCE_DIR}/public/playerstate.h" +) + +if( ${PROJECT_NAME} STREQUAL "engine" ) +add_sources( SOURCE_GROUP "Public" + "${ENGINE_SOURCE_DIR}/public/client_class.h" + "${ENGINE_SOURCE_DIR}/public/ivrenderview.h" + "${ENGINE_SOURCE_DIR}/public/isurfacesystem.h" # ImGui surface +) +endif() + end_sources() if( ${PROJECT_NAME} STREQUAL "engine_ds" ) diff --git a/r5dev/public/datamap.cpp b/r5dev/engine/datamap.cpp similarity index 100% rename from r5dev/public/datamap.cpp rename to r5dev/engine/datamap.cpp diff --git a/r5dev/public/dt_recv.cpp b/r5dev/engine/dt_recv.cpp similarity index 100% rename from r5dev/public/dt_recv.cpp rename to r5dev/engine/dt_recv.cpp diff --git a/r5dev/public/networkvar.cpp b/r5dev/engine/networkvar.cpp similarity index 100% rename from r5dev/public/networkvar.cpp rename to r5dev/engine/networkvar.cpp diff --git a/r5dev/game/CMakeLists.txt b/r5dev/game/CMakeLists.txt index 10f5206e..4998a7ff 100644 --- a/r5dev/game/CMakeLists.txt +++ b/r5dev/game/CMakeLists.txt @@ -71,6 +71,25 @@ add_sources( SOURCE_GROUP "Client" "client/viewrender.h" ) +add_sources( SOURCE_GROUP "Public" + "${ENGINE_SOURCE_DIR}/public/basehandle.h" + "${ENGINE_SOURCE_DIR}/public/edict.h" + "${ENGINE_SOURCE_DIR}/public/eiface.h" + "${ENGINE_SOURCE_DIR}/public/globalvars_base.h" + "${ENGINE_SOURCE_DIR}/public/ihandleentity.h" + + "${ENGINE_SOURCE_DIR}/public/iserverentity.h" + "${ENGINE_SOURCE_DIR}/public/iservernetworkable.h" + "${ENGINE_SOURCE_DIR}/public/iserverunknown.h" + + "${ENGINE_SOURCE_DIR}/public/icliententity.h" + "${ENGINE_SOURCE_DIR}/public/icliententitylist.h" + "${ENGINE_SOURCE_DIR}/public/iclientnetworkable.h" + "${ENGINE_SOURCE_DIR}/public/iclientrenderable.h" + "${ENGINE_SOURCE_DIR}/public/iclientthinkable.h" + "${ENGINE_SOURCE_DIR}/public/iclientunknown.h" +) + end_sources() target_include_directories( ${PROJECT_NAME} PRIVATE diff --git a/r5dev/game/server/baseentity.h b/r5dev/game/server/baseentity.h index 4ea9c04c..61423ea1 100644 --- a/r5dev/game/server/baseentity.h +++ b/r5dev/game/server/baseentity.h @@ -12,9 +12,9 @@ #endif #include "mathlib/vector.h" +#include "tier1/string_t.h" #include "public/iservernetworkable.h" #include "public/iserverentity.h" -#include "public/string_t.h" #include "engine/gl_model_private.h" #include "game/shared/collisionproperty.h" #include "networkproperty.h" diff --git a/r5dev/materialsystem/CMakeLists.txt b/r5dev/materialsystem/CMakeLists.txt index 4898c74e..dcc7f588 100644 --- a/r5dev/materialsystem/CMakeLists.txt +++ b/r5dev/materialsystem/CMakeLists.txt @@ -3,7 +3,7 @@ add_module( "lib" "materialsystem" "vpc" ${FOLDER_CONTEXT} TRUE ) start_sources() -add_sources( SOURCE_GROUP "Runtime" +add_sources( SOURCE_GROUP "Private" "cmaterialglue.cpp" "cmaterialglue.h" "cmaterialsystem.cpp" @@ -12,4 +12,10 @@ add_sources( SOURCE_GROUP "Runtime" "cshaderglue.h" ) +add_sources( SOURCE_GROUP "Public" + "${ENGINE_SOURCE_DIR}/public/imaterial.h" + "${ENGINE_SOURCE_DIR}/public/imaterialinternal.h" + "${ENGINE_SOURCE_DIR}/public/imaterialsystem.h" +) + end_sources() diff --git a/r5dev/public/appframework/IAppSystemGroup.h b/r5dev/public/appframework/IAppSystemGroup.h index 2c261fa7..a5b31815 100644 --- a/r5dev/public/appframework/IAppSystemGroup.h +++ b/r5dev/public/appframework/IAppSystemGroup.h @@ -1,7 +1,7 @@ #ifndef APPSYSTEMGROUP_H #define APPSYSTEMGROUP_H -#include "public/interface.h" +#include "tier1/interface.h" #include "tier1/utlvector.h" #include "filesystem/filesystem.h" diff --git a/r5dev/public/iserverentity.h b/r5dev/public/iserverentity.h index 59b08615..330a32d4 100644 --- a/r5dev/public/iserverentity.h +++ b/r5dev/public/iserverentity.h @@ -12,9 +12,8 @@ #endif +#include "tier1/string_t.h" #include "iserverunknown.h" -#include "string_t.h" - struct Ray_t; diff --git a/r5dev/public/imemalloc.h b/r5dev/public/tier0/imemalloc.h similarity index 100% rename from r5dev/public/imemalloc.h rename to r5dev/public/tier0/imemalloc.h diff --git a/r5dev/public/interface.h b/r5dev/public/tier1/interface.h similarity index 100% rename from r5dev/public/interface.h rename to r5dev/public/tier1/interface.h diff --git a/r5dev/public/tier1/memstack.h b/r5dev/public/tier1/memstack.h index aa1a79f1..7d6e0773 100644 --- a/r5dev/public/tier1/memstack.h +++ b/r5dev/public/tier1/memstack.h @@ -11,8 +11,8 @@ #pragma once #endif +#include "tier0/imemalloc.h" #include "tier1/utlvector.h" -#include "public/imemalloc.h" #if defined( _WIN32 ) || defined( _PS3 ) #define MEMSTACK_VIRTUAL_MEMORY_AVAILABLE diff --git a/r5dev/public/string_t.h b/r5dev/public/tier1/string_t.h similarity index 100% rename from r5dev/public/string_t.h rename to r5dev/public/tier1/string_t.h diff --git a/r5dev/studiorender/CMakeLists.txt b/r5dev/studiorender/CMakeLists.txt new file mode 100644 index 00000000..35033112 --- /dev/null +++ b/r5dev/studiorender/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required( VERSION 3.16 ) +add_module( "lib" "studiorender" "vpc" ${FOLDER_CONTEXT} TRUE ) + +start_sources() + +add_sources( SOURCE_GROUP "Private" + "studiorendercontext.cpp" + "studiorendercontext.h" +) + +add_sources( SOURCE_GROUP "Public" + "${ENGINE_SOURCE_DIR}/public/model_types.h" + "${ENGINE_SOURCE_DIR}/public/studio.h" + + # TODO: These are from bsplib: + "${ENGINE_SOURCE_DIR}/public/bspflags.h" + "${ENGINE_SOURCE_DIR}/public/worldsize.h" +) + +end_sources() diff --git a/r5dev/studiorender/studiorendercontext.cpp b/r5dev/studiorender/studiorendercontext.cpp new file mode 100644 index 00000000..760a8213 --- /dev/null +++ b/r5dev/studiorender/studiorendercontext.cpp @@ -0,0 +1,7 @@ +//=============================================================================// +// +// Purpose: Main systems initialization file +// +//=============================================================================// + +// TODO[ AMOS ]: Currently stubbed so public headers can be grouped under this project. diff --git a/r5dev/tier0/CMakeLists.txt b/r5dev/tier0/CMakeLists.txt index efca1714..c0b1f42c 100644 --- a/r5dev/tier0/CMakeLists.txt +++ b/r5dev/tier0/CMakeLists.txt @@ -39,6 +39,8 @@ file( GLOB TIER0_PUBLIC_HEADERS ) add_sources( SOURCE_GROUP "Public" "${TIER0_PUBLIC_HEADERS}" + "${ENGINE_SOURCE_DIR}/public/icommandline.h" + "${ENGINE_SOURCE_DIR}/public/iframetask.h" ) end_sources() diff --git a/r5dev/tier1/CMakeLists.txt b/r5dev/tier1/CMakeLists.txt index 302f4901..e657b529 100644 --- a/r5dev/tier1/CMakeLists.txt +++ b/r5dev/tier1/CMakeLists.txt @@ -30,6 +30,9 @@ file( GLOB TIER1_PUBLIC_HEADERS ) add_sources( SOURCE_GROUP "Public" "${TIER1_PUBLIC_HEADERS}" + "${ENGINE_SOURCE_DIR}/public/iconcommand.h" + "${ENGINE_SOURCE_DIR}/public/iconvar.h" + "${ENGINE_SOURCE_DIR}/public/icvar.h" ) end_sources() diff --git a/r5dev/vpc/interfaces.h b/r5dev/vpc/interfaces.h index a6092af2..fddbd700 100644 --- a/r5dev/vpc/interfaces.h +++ b/r5dev/vpc/interfaces.h @@ -1,5 +1,5 @@ #pragma once -#include "public/interface.h" +#include "tier1/interface.h" /*----------------------------------------------------------------------------- * _interfaces.h diff --git a/r5dev/vstdlib/CMakeLists.txt b/r5dev/vstdlib/CMakeLists.txt index eadd213f..bc8ab1ad 100644 --- a/r5dev/vstdlib/CMakeLists.txt +++ b/r5dev/vstdlib/CMakeLists.txt @@ -13,6 +13,10 @@ add_sources( SOURCE_GROUP "Private" "random.h" ) +add_sources( SOURCE_GROUP "Public" + "${ENGINE_SOURCE_DIR}/public/ikeyvaluessystem.h" +) + end_sources() target_include_directories( ${PROJECT_NAME} PRIVATE