diff --git a/src/app/service/grpc_support.cmake b/src/app/service/grpc_support.cmake index 777638a4..a3f77e6e 100644 --- a/src/app/service/grpc_support.cmake +++ b/src/app/service/grpc_support.cmake @@ -57,23 +57,6 @@ if(YAZE_ENABLE_JSON) target_compile_definitions(yaze_grpc_support PUBLIC YAZE_WITH_JSON) 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_include_directories(yaze_grpc_support PUBLIC ${CMAKE_BINARY_DIR}/gens) - # Resolve gRPC targets (FetchContent builds expose bare names, vcpkg uses # the gRPC:: namespace). Fallback gracefully. 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})") 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 + $ +) + +# Add proto objects to grpc_support +target_sources(yaze_grpc_support PRIVATE $) +target_include_directories(yaze_grpc_support PUBLIC ${CMAKE_BINARY_DIR}/gens) + # Link gRPC and protobuf libraries (single point of linking) target_link_libraries(yaze_grpc_support PUBLIC ${_YAZE_GRPCPP_TARGET}