Skip to content

Commit aa6fd4c

Browse files
cursoragenttimfox
andcommitted
Remove USE_ECS compile flag; always build ECS module
- CMake: always add ecs_module from src/game/ecs.cpp and link the client; drop redundant EXISTS branch and ECS_MODULE_AVAILABLE. - Client/Lua: remove #ifdef USE_ECS; ECS init/bindings match shipped tree. - MSVC: drop USE_ECS from preprocessor definitions (no longer used). Behavior matches the previous default when ecs.cpp was present. Co-authored-by: Tim Fox <timfox@outlook.com>
1 parent 8d6297b commit aa6fd4c

4 files changed

Lines changed: 21 additions & 44 deletions

File tree

CMakeLists.txt

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,29 +2181,21 @@ if(USE_RECAST_NAV)
21812181
endif()
21822182

21832183
# --- ECS (EnTT) module - alternative to gentity ---
2184-
set(ECS_CPP "${CMAKE_SOURCE_DIR}/src/game/ecs.cpp")
2185-
if(EXISTS "${ECS_CPP}")
2186-
enable_language(CXX)
2187-
ADD_LIBRARY(ecs_module STATIC ${ECS_CPP})
2188-
set_target_properties(ecs_module PROPERTIES
2189-
CXX_STANDARD 17
2190-
CXX_STANDARD_REQUIRED ON
2191-
)
2192-
target_include_directories(ecs_module PRIVATE
2193-
${EXTERNAL_INCLUDE}/entt/single_include
2194-
${CMAKE_SOURCE_DIR}/src/game
2195-
${CMAKE_SOURCE_DIR}/src/qcommon
2196-
)
2197-
if(NOT MSVC)
2198-
target_compile_options(ecs_module PRIVATE -Wno-unused-parameter)
2199-
endif()
2200-
set(ECS_MODULE_AVAILABLE TRUE)
2201-
add_compile_definitions(USE_ECS)
2202-
message(STATUS "ECS (EnTT): enabled")
2203-
else()
2204-
set(ECS_MODULE_AVAILABLE FALSE)
2205-
message(STATUS "ECS (EnTT): disabled (src/game/ecs.cpp not found)")
2184+
enable_language(CXX)
2185+
ADD_LIBRARY(ecs_module STATIC src/game/ecs.cpp)
2186+
set_target_properties(ecs_module PROPERTIES
2187+
CXX_STANDARD 17
2188+
CXX_STANDARD_REQUIRED ON
2189+
)
2190+
target_include_directories(ecs_module PRIVATE
2191+
${EXTERNAL_INCLUDE}/entt/single_include
2192+
${CMAKE_SOURCE_DIR}/src/game
2193+
${CMAKE_SOURCE_DIR}/src/qcommon
2194+
)
2195+
if(NOT MSVC)
2196+
target_compile_options(ecs_module PRIVATE -Wno-unused-parameter)
22062197
endif()
2198+
message(STATUS "ECS (EnTT): enabled")
22072199

22082200
# --- Bullet Physics module ---
22092201
option(USE_BULLET_PHYSICS "Enable Bullet Physics integration" ON)
@@ -2270,9 +2262,7 @@ endif()
22702262
if(USE_RECAST_NAV AND TARGET recast_nav)
22712263
TARGET_LINK_LIBRARIES(${CNAME}${BINEXT} PRIVATE recast_nav)
22722264
endif()
2273-
if(TARGET ecs_module)
2274-
TARGET_LINK_LIBRARIES(${CNAME}${BINEXT} PRIVATE ecs_module)
2275-
endif()
2265+
TARGET_LINK_LIBRARIES(${CNAME}${BINEXT} PRIVATE ecs_module)
22762266
if(USE_FLUX)
22772267
TARGET_COMPILE_DEFINITIONS(${CNAME}${BINEXT} PRIVATE USE_FLUX)
22782268
if(TARGET cflux2)

src/client/cl_gameframe.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ Ticks all gameplay subsystems each client frame:
3939
#include "../game/g_engine_systems.h"
4040
#include "../game/g_lua_bindings.h"
4141
#include "client.h"
42-
#ifdef USE_ECS
4342
#include "../game/ecs.h"
44-
#endif
4543
#include "../audio/snd_music_adaptive.h"
4644

4745
static qboolean gameSystemsInitialized = qfalse;
@@ -163,9 +161,7 @@ void CL_InitGameSystems(void) {
163161
EngineQuest_Init();
164162
EngineDialogue_Init();
165163
BT_Init();
166-
#ifdef USE_ECS
167164
ECS_Init();
168-
#endif
169165
MobileFog_Init();
170166
BgMap_Init();
171167
WinTitle_Init();
@@ -196,9 +192,7 @@ void CL_ShutdownGameSystems(void) {
196192
EngineReplay_Shutdown();
197193
EngineTelemetry_Shutdown();
198194
BT_Shutdown();
199-
#ifdef USE_ECS
200195
ECS_Shutdown();
201-
#endif
202196
BgMap_Shutdown();
203197

204198
activeNavMesh = -1;

src/game/g_lua_bindings.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ Usage from Lua:
4141
#include "g_dismember.h"
4242
#include "g_choreography.h"
4343
#include "g_response.h"
44-
#ifdef USE_ECS
4544
#include "ecs.h"
46-
#endif
4745
#include "../physics/phys_bullet.h"
4846
#include "../physics/phys_procedural_anim.h"
4947
#include "../physics/phys_ik.h"
@@ -423,7 +421,6 @@ static int l_dialogue_count(lua_State *L ) {
423421
}
424422

425423
/* ========== ECS bindings ========== */
426-
#ifdef USE_ECS
427424

428425
static int l_ecs_create(lua_State *L) {
429426
ecs_entity_t e = ECS_Create();
@@ -537,8 +534,6 @@ static int l_ecs_componentName(lua_State *L) {
537534
return 1;
538535
}
539536

540-
#endif /* USE_ECS */
541-
542537
/* ========== GOAP bindings ========== */
543538

544539
#include "g_goap.h"
@@ -991,7 +986,6 @@ void LuaBindings_RegisterAll(void *luaState) {
991986
};
992987
registerTable(L, "BT", btFuncs);
993988

994-
#ifdef USE_ECS
995989
static const luaL_Reg ecsFuncs[] = {
996990
{"create", l_ecs_create}, {"destroy", l_ecs_destroy},
997991
{"valid", l_ecs_valid}, {"count", l_ecs_count},
@@ -1007,7 +1001,6 @@ void LuaBindings_RegisterAll(void *luaState) {
10071001
{NULL, NULL}
10081002
};
10091003
registerTable(L, "ECS", ecsFuncs);
1010-
#endif
10111004

10121005
static const luaL_Reg aimlFuncs[] = {
10131006
{"createBot", l_aiml_createBot},

src/platform/win32/msvc2017/quake3e.vcxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
144144
<ClCompile>
145145
<AdditionalIncludeDirectories>$(OpenSslRoot)\include;$(AudioIncludeDirectories);$(LibCurlInclude);$(LibJpegInclude);..\..\..\qcommon;..\..\..\game;..\..\..\external\include\entt\single_include;..\..\..\external\src\jpeg;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
146-
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_CURL;CURL_STATICLIB;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;USE_WIN32_ASM;USE_ECS;USE_DTLS=1;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
146+
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_CURL;CURL_STATICLIB;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;USE_WIN32_ASM;USE_DTLS=1;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
147147
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
148148
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
149149
<BrowseInformation>true</BrowseInformation>
@@ -171,7 +171,7 @@
171171
<ClCompile>
172172
<Optimization>Disabled</Optimization>
173173
<AdditionalIncludeDirectories>$(OpenSslRoot)\include;$(AudioIncludeDirectories);$(LibCurlInclude);$(LibJpegInclude);..\..\..\qcommon;..\..\..\game;..\..\..\external\include\entt\single_include;..\..\..\external\src\jpeg;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
174-
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_CURL;CURL_STATICLIB;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;USE_WIN32_ASM;USE_ECS;USE_DTLS=1;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
174+
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_CURL;CURL_STATICLIB;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;USE_WIN32_ASM;USE_DTLS=1;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
175175
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
176176
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
177177
<BrowseInformation>true</BrowseInformation>
@@ -195,7 +195,7 @@
195195
<ClCompile>
196196
<Optimization>Disabled</Optimization>
197197
<AdditionalIncludeDirectories>$(AudioIncludeDirectories);$(LibCurlInclude);$(LibJpegInclude);..\..\..\qcommon;..\..\..\game;..\..\..\external\include\entt\single_include;..\..\..\external\src\jpeg;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
198-
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;USE_ECS;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
198+
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
199199
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
200200
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
201201
<BrowseInformation>true</BrowseInformation>
@@ -220,7 +220,7 @@
220220
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
221221
<ClCompile>
222222
<AdditionalIncludeDirectories>$(OpenSslRoot)\include;$(AudioIncludeDirectories);$(LibCurlInclude);$(LibJpegInclude);..\..\..\qcommon;..\..\..\game;..\..\..\external\include\entt\single_include;..\..\..\external\src\jpeg;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
223-
<PreprocessorDefinitions>WIN32;_WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_CURL;CURL_STATICLIB;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;USE_WIN32_ASM;USE_ECS;USE_DTLS=1;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
223+
<PreprocessorDefinitions>WIN32;_WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_CURL;CURL_STATICLIB;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;USE_WIN32_ASM;USE_DTLS=1;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
224224
<WarningLevel>Level4</WarningLevel>
225225
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
226226
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
@@ -247,7 +247,7 @@
247247
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
248248
<ClCompile>
249249
<AdditionalIncludeDirectories>$(OpenSslRoot)\include;$(AudioIncludeDirectories);$(LibCurlInclude);$(LibJpegInclude);..\..\..\qcommon;..\..\..\game;..\..\..\external\include\entt\single_include;..\..\..\external\src\jpeg;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
250-
<PreprocessorDefinitions>WIN32;_WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_CURL;CURL_STATICLIB;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;USE_WIN32_ASM;USE_ECS;USE_DTLS=1;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
250+
<PreprocessorDefinitions>WIN32;_WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_CURL;CURL_STATICLIB;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;USE_WIN32_ASM;USE_DTLS=1;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
251251
<WarningLevel>Level4</WarningLevel>
252252
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
253253
<AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
@@ -274,7 +274,7 @@
274274
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
275275
<ClCompile>
276276
<AdditionalIncludeDirectories>$(AudioIncludeDirectories);$(LibCurlInclude);$(LibJpegInclude);..\..\..\qcommon;..\..\..\game;..\..\..\external\include\entt\single_include;..\..\..\external\src\jpeg;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
277-
<PreprocessorDefinitions>WIN32;_WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;USE_ECS;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
277+
<PreprocessorDefinitions>WIN32;_WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;$(UseWASAPI);%(PreprocessorDefinitions)</PreprocessorDefinitions>
278278
<WarningLevel>Level4</WarningLevel>
279279
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
280280
<MultiProcessorCompilation>true</MultiProcessorCompilation>

0 commit comments

Comments
 (0)