feat: Update CMake configuration for Abseil and gRPC, enhance modular build support, and add CLI flag handling
This commit is contained in:
@@ -102,7 +102,7 @@ if(YAZE_USE_MODULAR_BUILD)
|
||||
include(app/gui/gui_library.cmake)
|
||||
include(app/zelda3/zelda3_library.cmake)
|
||||
|
||||
if(YAZE_BUILD_EMU AND NOT YAZE_WITH_GRPC)
|
||||
if(YAZE_BUILD_EMU)
|
||||
include(app/emu/emu_library.cmake)
|
||||
endif()
|
||||
|
||||
@@ -233,7 +233,7 @@ if (YAZE_BUILD_LIB)
|
||||
target_link_libraries(yaze_core INTERFACE yaze_agent)
|
||||
endif()
|
||||
|
||||
if(YAZE_BUILD_EMU AND NOT YAZE_WITH_GRPC AND TARGET yaze_emulator)
|
||||
if(YAZE_BUILD_EMU AND TARGET yaze_emulator)
|
||||
target_link_libraries(yaze_core INTERFACE yaze_emulator)
|
||||
endif()
|
||||
|
||||
@@ -345,7 +345,7 @@ if (YAZE_BUILD_LIB)
|
||||
target_link_libraries(yaze_c PRIVATE yaze_agent)
|
||||
endif()
|
||||
|
||||
if(YAZE_BUILD_EMU AND NOT YAZE_WITH_GRPC AND TARGET yaze_emulator)
|
||||
if(YAZE_BUILD_EMU AND TARGET yaze_emulator)
|
||||
target_link_libraries(yaze_c PRIVATE yaze_emulator)
|
||||
endif()
|
||||
else()
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -77,6 +77,8 @@ set(YAZE_AGENT_SOURCES
|
||||
cli/service/planning/tile16_proposal_generator.cc
|
||||
cli/service/resources/resource_catalog.cc
|
||||
cli/service/resources/resource_context_builder.cc
|
||||
cli/handlers/overworld_inspect.cc
|
||||
cli/flags.cc
|
||||
cli/service/rom/rom_sandbox_manager.cc
|
||||
)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/flags/declare.h"
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "absl/strings/match.h"
|
||||
@@ -14,7 +15,7 @@
|
||||
#include "yaze_config.h"
|
||||
|
||||
ABSL_FLAG(bool, tui, false, "Launch Text User Interface");
|
||||
ABSL_FLAG(std::string, rom, "", "Path to the ROM file");
|
||||
ABSL_DECLARE_FLAG(std::string, rom);
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
5
src/cli/flags.cc
Normal file
5
src/cli/flags.cc
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <string>
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
|
||||
ABSL_FLAG(std::string, rom, "", "Path to the ROM file");
|
||||
@@ -65,6 +65,7 @@ add_executable(
|
||||
cli/handlers/agent/test_common.cc
|
||||
cli/handlers/agent/test_commands.cc
|
||||
cli/handlers/agent/gui_commands.cc
|
||||
cli/flags.cc
|
||||
cli/modern_cli.cc
|
||||
cli/tui/asar_patch.cc
|
||||
cli/tui/palette_editor.cc
|
||||
|
||||
Reference in New Issue
Block a user