chore: enhance CMake linking for yaze_agent in test suites

- Updated CMake configuration to conditionally apply whole-archive linking for the `yaze_agent` target on Unix-like systems, ensuring all necessary symbols are included.
- Maintained standard linking for Windows while improving compatibility across platforms.

Benefits:
- Increases build stability and ensures proper symbol inclusion for test support libraries, reducing potential linker errors.
This commit is contained in:
scawful
2025-10-18 13:14:19 -04:00
parent 283a21888e
commit d2e35dc645

View File

@@ -70,7 +70,19 @@ endif()
# Link agent library if available (for z3ed test suites)
# yaze_agent contains all the CLI service code (tile16_proposal_generator, gui_automation_client, etc.)
if(TARGET yaze_agent)
target_link_libraries(yaze_test_support PUBLIC yaze_agent)
# Use whole-archive on Unix to ensure agent symbols (GuiAutomationClient etc) are included
if(APPLE)
target_link_options(yaze_test_support PUBLIC
"LINKER:-force_load,$<TARGET_FILE:yaze_agent>")
target_link_libraries(yaze_test_support PUBLIC yaze_agent)
elseif(UNIX)
target_link_libraries(yaze_test_support PUBLIC
-Wl,--whole-archive yaze_agent -Wl,--no-whole-archive)
else()
# Windows: Normal linking
target_link_libraries(yaze_test_support PUBLIC yaze_agent)
endif()
if(YAZE_WITH_GRPC)
message(STATUS "✓ z3ed test suites enabled with gRPC support")
else()