From 4005b68383538b1b33fd95d98dd9f5dee14cc3c7 Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sun, 22 Jun 2025 13:52:23 -0500 Subject: [PATCH] [Code] Optimize PCH Config (Faster Builds) (#4951) --- common/CMakeLists.txt | 2 +- common/pch/app-pch.h | 7 +++++++ common/pch/{pch.h => std-pch.h} | 0 world/CMakeLists.txt | 2 +- zone/CMakeLists.txt | 10 ++++++---- 5 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 common/pch/app-pch.h rename common/pch/{pch.h => std-pch.h} (100%) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 0350cb6d4..787cd299c 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -842,7 +842,7 @@ IF (UNIX) ENDIF (UNIX) IF (WIN32 AND EQEMU_BUILD_PCH) - TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/pch.h) + TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/std-pch.h) ENDIF () SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/common/pch/app-pch.h b/common/pch/app-pch.h new file mode 100644 index 000000000..6c1f216aa --- /dev/null +++ b/common/pch/app-pch.h @@ -0,0 +1,7 @@ +#include "../types.h" +#include "../database.h" +#include "../strings.h" +#include "../eqemu_logsys.h" +#include "../eqemu_logsys_log_aliases.h" +#include "../features.h" +#include "../global_define.h" diff --git a/common/pch/pch.h b/common/pch/std-pch.h similarity index 100% rename from common/pch/pch.h rename to common/pch/std-pch.h diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt index 0eed74b9b..1963c83ae 100644 --- a/world/CMakeLists.txt +++ b/world/CMakeLists.txt @@ -77,7 +77,7 @@ ADD_EXECUTABLE(world ${world_sources} ${world_headers}) INSTALL(TARGETS world RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) IF (WIN32 AND EQEMU_BUILD_PCH) - TARGET_PRECOMPILE_HEADERS(world PRIVATE ../common/pch/pch.h) + TARGET_PRECOMPILE_HEADERS(world PRIVATE ../common/pch/std-pch.h) ENDIF () ADD_DEFINITIONS(-DWORLD) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 8424891e9..ecc9d35a8 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -480,13 +480,15 @@ ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers}) # binary output directory INSTALL(TARGETS zone RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -# precompile headers +# precompiled headers IF (WIN32 AND EQEMU_BUILD_PCH) - TARGET_PRECOMPILE_HEADERS(zone PRIVATE ../common/pch/pch.h) - TARGET_PRECOMPILE_HEADERS(zone PRIVATE ../common/types.h ../common/eqemu_logsys.h ../common/eqemu_logsys_log_aliases.h ../common/features.h ../common/global_define.h) - TARGET_PRECOMPILE_HEADERS(zone PRIVATE mob.h npc.h corpse.h doors.h bot.h entity.h client.h zone.h) + TARGET_PRECOMPILE_HEADERS(zone PRIVATE ../common/pch/std-pch.h) ENDIF() +# precompiled headers +TARGET_PRECOMPILE_HEADERS(zone PRIVATE ../common/pch/app-pch.h) +TARGET_PRECOMPILE_HEADERS(zone PRIVATE merc.h mob.h npc.h corpse.h doors.h bot.h entity.h client.h zone.h) + ADD_DEFINITIONS(-DZONE) # link lua_zone unity build against luabind