build: Generate precompiled header only once (msvc only)

This commit is contained in:
Exzap 2026-03-05 17:43:55 +01:00
parent 1a5546e4ad
commit 8e2e2c44bb
11 changed files with 28 additions and 6 deletions

View File

@ -55,6 +55,8 @@ add_executable(CemuBin
mainLLE.cpp
)
target_precompile_headers(CemuBin REUSE_FROM CemuCommon)
if(MSVC AND MSVC_VERSION EQUAL 1940)
# workaround for an msvc issue on VS 17.10 where generated ILK files are too large
# see https://developercommunity.visualstudio.com/t/After-updating-to-VS-1710-the-size-of-/10665511

View File

@ -614,6 +614,8 @@ endif()
set_property(TARGET CemuCafe PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuCafe REUSE_FROM CemuCommon)
target_include_directories(CemuCafe PUBLIC "../")
if (glslang_VERSION VERSION_LESS "15.0.0")

View File

@ -40,6 +40,8 @@ endif()
set_property(TARGET CemuComponents PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuComponents REUSE_FROM CemuCommon)
target_include_directories(CemuComponents PUBLIC "../")
target_link_libraries(CemuComponents PRIVATE

View File

@ -53,14 +53,11 @@ if(LINUX)
)
endif()
# All the targets wanting to use the precompiled.h header
# have to link to CemuCommon
target_precompile_headers(CemuCommon PUBLIC precompiled.h)
# the precompiled header is produced by CemuCommon and reused by all the other targets
target_precompile_headers(CemuCommon PRIVATE precompiled.h)
target_include_directories(CemuCommon PUBLIC "../")
target_link_libraries(CemuCommon PRIVATE
Boost::nowide
Boost::filesystem
glm::glm
)
@ -69,6 +66,11 @@ if (UNIX AND NOT APPLE)
endif()
# PUBLIC because:
# - boost/nowide/convert.hpp is included in precompiled.h
# - boost/predef/os.h is included in platform.h
# - fmt/core.h is included in precompiled.h
target_link_libraries(CemuCommon PUBLIC Boost::headers fmt::fmt)
target_link_libraries(CemuCommon PUBLIC
Boost::nowide
Boost::headers
fmt::fmt
)

View File

@ -7,6 +7,8 @@ add_library(CemuAudio
set_property(TARGET CemuAudio PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuAudio REUSE_FROM CemuCommon)
if(WIN32)
target_sources(CemuAudio PRIVATE
DirectSoundAPI.cpp

View File

@ -13,6 +13,8 @@ add_library(CemuConfig
set_property(TARGET CemuConfig PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuConfig REUSE_FROM CemuCommon)
target_include_directories(CemuConfig PUBLIC "../")
target_link_libraries(CemuConfig PRIVATE

View File

@ -132,6 +132,8 @@ endif()
set_property(TARGET CemuWxGui PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuWxGui REUSE_FROM CemuCommon)
target_include_directories(CemuWxGui PUBLIC "../")
# PUBLIC because rapidjson/document.h is included in ChecksumTool.h

View File

@ -18,6 +18,8 @@ endif ()
set_property(TARGET imguiImpl PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(imguiImpl REUSE_FROM CemuCommon)
target_include_directories(imguiImpl PUBLIC "../")
# imgui source files

View File

@ -43,6 +43,8 @@ add_library(CemuInput
set_property(TARGET CemuInput PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuInput REUSE_FROM CemuCommon)
if(WIN32)
# XInput
target_sources(CemuInput PRIVATE

View File

@ -2,6 +2,8 @@ add_library(CemuResource)
set_property(TARGET CemuResource PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuResource REUSE_FROM CemuCommon)
enable_language(ASM)
# icon resources

View File

@ -89,6 +89,8 @@ endif()
set_property(TARGET CemuUtil PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuUtil REUSE_FROM CemuCommon)
target_include_directories(CemuUtil PUBLIC "../")
target_link_libraries(CemuUtil PRIVATE