refactor(build): enhance MSVC whole-archive linking for protobuf

- Updated CMake configurations across core, net, agent, and z3ed to conditionally apply /WHOLEARCHIVE linking for libprotobuf based on the compiler ID.
- Added status messages to indicate when /WHOLEARCHIVE linking is skipped for clang-cl, improving clarity in build logs.

Benefits:
- Improves compatibility and clarity in the build process for Windows environments using different compilers.
- Ensures that necessary symbols are included when using MSVC, enhancing build reliability.
This commit is contained in:
scawful
2025-10-13 23:11:06 -04:00
parent 7bb0f257ce
commit cafa50b355
5 changed files with 23 additions and 11 deletions

View File

@@ -49,7 +49,11 @@ if(YAZE_BUILD_TESTS)
target_link_options(${suite_name} PRIVATE /STACK:16777216)
# Force whole-archive linking for protobuf to ensure all symbols are included
if(YAZE_WITH_GRPC)
target_link_options(${suite_name} PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:libprotobuf>)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_link_options(${suite_name} PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:libprotobuf>)
else()
message(STATUS "○ Skipping /WHOLEARCHIVE for libprotobuf in ${suite_name} (clang-cl)")
endif()
endif()
else()
target_link_options(${suite_name} PRIVATE -Wl,--stack,16777216)
@@ -153,4 +157,4 @@ if(YAZE_BUILD_TESTS)
)
yaze_add_test_suite(yaze_test_benchmark "benchmark" OFF ${BENCHMARK_TEST_SOURCES})
endif()
endif()