chore: reintroduce /WHOLEARCHIVE linking for protobuf at executable level

- Added /WHOLEARCHIVE linking for protobuf in various CMake files to ensure internal symbols are included while preventing resource duplication.
- Updated linking options for `yaze`, `yaze_emu`, `z3ed`, and test suites to apply this option conditionally on Windows with MSVC.

Benefits:
- Ensures proper inclusion of protobuf symbols in executables, improving compatibility and functionality across platforms.
This commit is contained in:
scawful
2025-10-18 01:54:58 -04:00
parent 41154fc425
commit b4d4195e47
5 changed files with 41 additions and 4 deletions

View File

@@ -203,7 +203,13 @@ target_link_libraries(yaze PRIVATE
)
if(YAZE_WITH_GRPC AND YAZE_PROTOBUF_TARGETS)
target_link_libraries(yaze PRIVATE ${YAZE_PROTOBUF_TARGETS})
# NOTE: Removed /WHOLEARCHIVE - already linked transitively from libraries
# Apply /WHOLEARCHIVE only at executable level to avoid duplicate version.res
# This ensures protobuf internal symbols are included while preventing resource duplication
if(MSVC AND YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
foreach(_yaze_proto_target IN LISTS YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
target_link_options(yaze PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:${_yaze_proto_target}>)
endforeach()
endif()
endif()
# Link test support library (yaze_editor needs TestManager)