feat: Update CMake configuration for Abseil and gRPC, enhance modular build support, and add CLI flag handling

This commit is contained in:
scawful
2025-10-03 20:24:58 -04:00
parent c9f439207e
commit db227c9de5
12 changed files with 128 additions and 81 deletions

View File

@@ -105,7 +105,7 @@ if(YAZE_USE_MODULAR_BUILD)
list(APPEND _yaze_modular_links yaze_agent)
endif()
if(YAZE_BUILD_EMU AND NOT YAZE_WITH_GRPC AND TARGET yaze_emulator)
if(YAZE_BUILD_EMU AND TARGET yaze_emulator)
list(APPEND _yaze_modular_links yaze_emulator)
endif()

View File

@@ -47,6 +47,10 @@ target_sources(yaze_core_lib PRIVATE
)
if(YAZE_WITH_GRPC)
target_include_directories(yaze_core_lib PRIVATE
${CMAKE_SOURCE_DIR}/third_party/json/include)
target_compile_definitions(yaze_core_lib PRIVATE YAZE_WITH_JSON)
target_add_protobuf(yaze_core_lib
${CMAKE_SOURCE_DIR}/src/app/core/proto/imgui_test_harness.proto)

View File

@@ -52,43 +52,6 @@ void KeepDynamicTestData(const std::shared_ptr<DynamicTestData>& data) {
}
}
::yaze::test::GetTestStatusResponse_Status ConvertHarnessStatus(
::yaze::test::HarnessTestStatus status) {
switch (status) {
case ::yaze::test::HarnessTestStatus::kQueued:
return ::yaze::test::GetTestStatusResponse::STATUS_QUEUED;
case ::yaze::test::HarnessTestStatus::kRunning:
return ::yaze::test::GetTestStatusResponse::STATUS_RUNNING;
case ::yaze::test::HarnessTestStatus::kPassed:
return ::yaze::test::GetTestStatusResponse::STATUS_PASSED;
case ::yaze::test::HarnessTestStatus::kFailed:
return ::yaze::test::GetTestStatusResponse::STATUS_FAILED;
case ::yaze::test::HarnessTestStatus::kTimeout:
return ::yaze::test::GetTestStatusResponse::STATUS_TIMEOUT;
case ::yaze::test::HarnessTestStatus::kUnspecified:
default:
return ::yaze::test::GetTestStatusResponse::STATUS_UNSPECIFIED;
}
}
int64_t ToUnixMillisSafe(absl::Time timestamp) {
if (timestamp == absl::InfinitePast()) {
return 0;
}
return absl::ToUnixMillis(timestamp);
}
int32_t ClampDurationToInt32(absl::Duration duration) {
int64_t millis = absl::ToInt64Milliseconds(duration);
if (millis > std::numeric_limits<int32_t>::max()) {
return std::numeric_limits<int32_t>::max();
}
if (millis < std::numeric_limits<int32_t>::min()) {
return std::numeric_limits<int32_t>::min();
}
return static_cast<int32_t>(millis);
}
void RunDynamicTest(ImGuiTestContext* ctx) {
auto* data = (DynamicTestData*)ctx->Test->UserData;
if (data && data->test_func) {
@@ -127,6 +90,47 @@ struct RPCState {
} // namespace
#endif
namespace {
::yaze::test::GetTestStatusResponse_Status ConvertHarnessStatus(
::yaze::test::HarnessTestStatus status) {
switch (status) {
case ::yaze::test::HarnessTestStatus::kQueued:
return ::yaze::test::GetTestStatusResponse::STATUS_QUEUED;
case ::yaze::test::HarnessTestStatus::kRunning:
return ::yaze::test::GetTestStatusResponse::STATUS_RUNNING;
case ::yaze::test::HarnessTestStatus::kPassed:
return ::yaze::test::GetTestStatusResponse::STATUS_PASSED;
case ::yaze::test::HarnessTestStatus::kFailed:
return ::yaze::test::GetTestStatusResponse::STATUS_FAILED;
case ::yaze::test::HarnessTestStatus::kTimeout:
return ::yaze::test::GetTestStatusResponse::STATUS_TIMEOUT;
case ::yaze::test::HarnessTestStatus::kUnspecified:
default:
return ::yaze::test::GetTestStatusResponse::STATUS_UNSPECIFIED;
}
}
int64_t ToUnixMillisSafe(absl::Time timestamp) {
if (timestamp == absl::InfinitePast()) {
return 0;
}
return absl::ToUnixMillis(timestamp);
}
int32_t ClampDurationToInt32(absl::Duration duration) {
int64_t millis = absl::ToInt64Milliseconds(duration);
if (millis > std::numeric_limits<int32_t>::max()) {
return std::numeric_limits<int32_t>::max();
}
if (millis < std::numeric_limits<int32_t>::min()) {
return std::numeric_limits<int32_t>::min();
}
return static_cast<int32_t>(millis);
}
} // namespace
#include <grpcpp/grpcpp.h>
#include <grpcpp/server_builder.h>