backend-infra-engineer: fix grpc proto includes
This commit is contained in:
@@ -57,23 +57,6 @@ if(YAZE_ENABLE_JSON)
|
|||||||
target_compile_definitions(yaze_grpc_support PUBLIC YAZE_WITH_JSON)
|
target_compile_definitions(yaze_grpc_support PUBLIC YAZE_WITH_JSON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Create a separate OBJECT library for proto files to break dependency cycles
|
|
||||||
# This allows yaze_agent to depend on the protos without depending on yaze_grpc_support
|
|
||||||
add_library(yaze_proto_gen OBJECT)
|
|
||||||
target_add_protobuf(yaze_proto_gen
|
|
||||||
${PROJECT_SOURCE_DIR}/src/protos/rom_service.proto
|
|
||||||
${PROJECT_SOURCE_DIR}/src/protos/canvas_automation.proto
|
|
||||||
${PROJECT_SOURCE_DIR}/src/protos/imgui_test_harness.proto
|
|
||||||
${PROJECT_SOURCE_DIR}/src/protos/emulator_service.proto
|
|
||||||
)
|
|
||||||
|
|
||||||
# Link proto gen to protobuf
|
|
||||||
target_link_libraries(yaze_proto_gen PUBLIC ${YAZE_PROTOBUF_TARGETS})
|
|
||||||
|
|
||||||
# Add proto objects to grpc_support
|
|
||||||
target_sources(yaze_grpc_support PRIVATE $<TARGET_OBJECTS:yaze_proto_gen>)
|
|
||||||
target_include_directories(yaze_grpc_support PUBLIC ${CMAKE_BINARY_DIR}/gens)
|
|
||||||
|
|
||||||
# Resolve gRPC targets (FetchContent builds expose bare names, vcpkg uses
|
# Resolve gRPC targets (FetchContent builds expose bare names, vcpkg uses
|
||||||
# the gRPC:: namespace). Fallback gracefully.
|
# the gRPC:: namespace). Fallback gracefully.
|
||||||
set(_YAZE_GRPCPP_TARGET grpc++)
|
set(_YAZE_GRPCPP_TARGET grpc++)
|
||||||
@@ -93,6 +76,28 @@ if(NOT TARGET ${_YAZE_GRPCPP_REFLECTION_TARGET})
|
|||||||
message(FATAL_ERROR "gRPC reflection target not available (checked ${_YAZE_GRPCPP_REFLECTION_TARGET})")
|
message(FATAL_ERROR "gRPC reflection target not available (checked ${_YAZE_GRPCPP_REFLECTION_TARGET})")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Create a separate OBJECT library for proto files to break dependency cycles
|
||||||
|
# This allows yaze_agent to depend on the protos without depending on yaze_grpc_support
|
||||||
|
add_library(yaze_proto_gen OBJECT)
|
||||||
|
target_add_protobuf(yaze_proto_gen
|
||||||
|
${PROJECT_SOURCE_DIR}/src/protos/rom_service.proto
|
||||||
|
${PROJECT_SOURCE_DIR}/src/protos/canvas_automation.proto
|
||||||
|
${PROJECT_SOURCE_DIR}/src/protos/imgui_test_harness.proto
|
||||||
|
${PROJECT_SOURCE_DIR}/src/protos/emulator_service.proto
|
||||||
|
)
|
||||||
|
|
||||||
|
# Link proto gen to protobuf and ensure gRPC headers are on include path
|
||||||
|
target_link_libraries(yaze_proto_gen PUBLIC ${YAZE_PROTOBUF_TARGETS})
|
||||||
|
target_include_directories(
|
||||||
|
yaze_proto_gen
|
||||||
|
PUBLIC
|
||||||
|
$<TARGET_PROPERTY:${_YAZE_GRPCPP_TARGET},INTERFACE_INCLUDE_DIRECTORIES>
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add proto objects to grpc_support
|
||||||
|
target_sources(yaze_grpc_support PRIVATE $<TARGET_OBJECTS:yaze_proto_gen>)
|
||||||
|
target_include_directories(yaze_grpc_support PUBLIC ${CMAKE_BINARY_DIR}/gens)
|
||||||
|
|
||||||
# Link gRPC and protobuf libraries (single point of linking)
|
# Link gRPC and protobuf libraries (single point of linking)
|
||||||
target_link_libraries(yaze_grpc_support PUBLIC
|
target_link_libraries(yaze_grpc_support PUBLIC
|
||||||
${_YAZE_GRPCPP_TARGET}
|
${_YAZE_GRPCPP_TARGET}
|
||||||
|
|||||||
Reference in New Issue
Block a user