Speed up the Windows build with precompiled headers.

[skip alpine ci]
[skip irctest ci]
[skip macos ci]
[skip ubuntu ci]
This commit is contained in:
Sadie Powell 2024-11-14 01:27:47 +00:00
parent e3db9ed118
commit 179bccb0c7
2 changed files with 10 additions and 0 deletions

View File

@ -96,6 +96,7 @@ list(SORT INSPIRCD_SOURCES)
add_executable("inspircd" ${INSPIRCD_HEADERS} ${INSPIRCD_SOURCES} "${INSPIRCD_BASE}/win/inspircd.rc")
add_dependencies("inspircd" "win32memory")
target_compile_definitions("inspircd" PRIVATE "FMT_LIB_EXPORT" "INSPIRCD_CORE")
target_precompile_headers("inspircd" PUBLIC "${INSPIRCD_BASE}/include/inspircd.h")
set_target_properties("inspircd" PROPERTIES "ENABLE_EXPORTS" ON)
target_link_libraries("inspircd" "win32memory")
install(TARGETS "inspircd" RUNTIME DESTINATION ".")

View File

@ -78,6 +78,15 @@ foreach(MODULE_NAME ${INSPIRCD_MODULES})
add_library(${BASE_NAME} MODULE ${MODULE_NAME})
endif()
set(PCH_TARGET "")
if(${PCH_TARGET})
target_precompile_headers(${BASE_NAME} REUSE_FROM ${PCH_TARGET})
else()
target_precompile_headers(${BASE_NAME} PUBLIC "${INSPIRCD_BASE}/include/inspircd.h")
set(PCH_TARGET ${BASE_NAME})
endif()
# Link against the core and memory library
add_dependencies(${BASE_NAME} "inspircd" "win32memory")
target_link_libraries(${BASE_NAME} "inspircd" "win32memory")