[Code] Optimize PCH Config (Faster Builds) (#4951)

This commit is contained in:
Chris Miles 2025-06-22 13:52:23 -05:00 committed by GitHub
parent 5ac9dd04e4
commit 4005b68383
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 6 deletions

View File

@ -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)

7
common/pch/app-pch.h Normal file
View File

@ -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"

View File

@ -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)

View File

@ -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