feat(build-system): enhance CMake configuration and introduce new utility files
- Refactored CMakeLists.txt to streamline project configuration and improve readability. - Introduced new utility functions in `utils.cmake` for setting compiler flags and managing dependencies. - Added `dependencies.cmake` to centralize third-party dependency management, enhancing modularity. - Updated CI workflows to include new build options and improved logging for better feedback during configuration. - Implemented precompiled headers in various libraries to speed up compilation times. Benefits: - Improved maintainability and clarity of the build system. - Enhanced build performance through precompiled headers. - Streamlined dependency management for easier integration of third-party libraries.
This commit is contained in:
@@ -18,16 +18,13 @@ set(YAZE_TEST_SOURCES
|
||||
add_library(yaze_test_support STATIC ${YAZE_TEST_SOURCES})
|
||||
|
||||
target_precompile_headers(yaze_test_support PRIVATE
|
||||
<memory>
|
||||
<set>
|
||||
<string>
|
||||
<string_view>
|
||||
<vector>
|
||||
"$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_SOURCE_DIR}/src/yaze_pch.h>"
|
||||
)
|
||||
|
||||
target_include_directories(yaze_test_support PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
@@ -41,11 +38,17 @@ target_link_libraries(yaze_test_support PUBLIC
|
||||
yaze_common
|
||||
)
|
||||
|
||||
# Link agent library if gRPC is enabled (for z3ed test suites)
|
||||
# Link agent library if available (for z3ed test suites)
|
||||
# yaze_agent contains all the CLI service code (tile16_proposal_generator, gui_automation_client, etc.)
|
||||
if(YAZE_WITH_GRPC)
|
||||
if(TARGET yaze_agent)
|
||||
target_link_libraries(yaze_test_support PUBLIC yaze_agent)
|
||||
message(STATUS "✓ z3ed test suites enabled (YAZE_WITH_GRPC=ON)")
|
||||
if(YAZE_WITH_GRPC)
|
||||
message(STATUS "✓ z3ed test suites enabled with gRPC support")
|
||||
else()
|
||||
message(STATUS "✓ z3ed test suites enabled (without gRPC)")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "○ z3ed test suites disabled (yaze_agent not built)")
|
||||
endif()
|
||||
|
||||
message(STATUS "✓ yaze_test_support library configured")
|
||||
@@ -1675,9 +1675,9 @@ absl::Status TestManager::TestRomDataIntegrity(Rom* rom) {
|
||||
});
|
||||
}
|
||||
|
||||
#if defined(YAZE_WITH_GRPC)
|
||||
std::string TestManager::RegisterHarnessTest(const std::string& name,
|
||||
const std::string& category) {
|
||||
#if defined(YAZE_WITH_GRPC)
|
||||
absl::MutexLock lock(&harness_history_mutex_);
|
||||
std::string test_id = absl::StrCat("harness_", absl::ToUnixMicros(absl::Now()), "_", harness_history_.size());
|
||||
HarnessTestExecution execution;
|
||||
@@ -1693,12 +1693,15 @@ std::string TestManager::RegisterHarnessTest(const std::string& name,
|
||||
aggregate.latest_execution = execution;
|
||||
harness_history_order_.push_back(test_id);
|
||||
return test_id;
|
||||
}
|
||||
#else
|
||||
std::string TestManager::RegisterHarnessTest(const std::string& name,
|
||||
const std::string& category) {
|
||||
(void)name;
|
||||
(void)category;
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(YAZE_WITH_GRPC)
|
||||
void TestManager::MarkHarnessTestRunning(const std::string& test_id) {
|
||||
@@ -1852,10 +1855,12 @@ void TestManager::CaptureFailureContext(const std::string& test_id) {
|
||||
if (harness_listener_) {
|
||||
harness_listener_->OnHarnessTestUpdated(execution);
|
||||
}
|
||||
#else
|
||||
(void)test_id;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
void TestManager::CaptureFailureContext(const std::string& test_id) {
|
||||
(void)test_id;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(YAZE_WITH_GRPC)
|
||||
void TestManager::TrimHarnessHistoryLocked() {
|
||||
@@ -1870,14 +1875,6 @@ absl::Status TestManager::ReplayLastPlan() {
|
||||
return absl::FailedPreconditionError("Harness plan replay not available");
|
||||
}
|
||||
|
||||
absl::Status TestManager::ShowHarnessDashboard() {
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
absl::Status TestManager::ShowHarnessActiveTests() {
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
void TestManager::SetHarnessListener(HarnessListener* listener) {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
harness_listener_ = listener;
|
||||
@@ -1886,15 +1883,24 @@ void TestManager::SetHarnessListener(HarnessListener* listener) {
|
||||
absl::Status TestManager::ReplayLastPlan() {
|
||||
return absl::UnimplementedError("Harness features require YAZE_WITH_GRPC");
|
||||
}
|
||||
#endif
|
||||
|
||||
absl::Status TestManager::ShowHarnessDashboard() {
|
||||
// These methods are always available, but may return unimplemented without GRPC
|
||||
#if defined(YAZE_WITH_GRPC)
|
||||
return absl::OkStatus();
|
||||
#else
|
||||
return absl::UnimplementedError("Harness features require YAZE_WITH_GRPC");
|
||||
#endif
|
||||
}
|
||||
|
||||
absl::Status TestManager::ShowHarnessActiveTests() {
|
||||
#if defined(YAZE_WITH_GRPC)
|
||||
return absl::OkStatus();
|
||||
#else
|
||||
return absl::UnimplementedError("Harness features require YAZE_WITH_GRPC");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void TestManager::RecordPlanSummary(const std::string& summary) {
|
||||
(void)summary;
|
||||
|
||||
@@ -299,8 +299,16 @@ class TestManager {
|
||||
|
||||
void SetHarnessListener(HarnessListener* listener);
|
||||
|
||||
absl::Status ReplayLastPlan();
|
||||
#else
|
||||
// Stub implementations when GRPC is not available
|
||||
std::string RegisterHarnessTest(const std::string& name,
|
||||
const std::string& category);
|
||||
void CaptureFailureContext(const std::string& test_id);
|
||||
absl::Status ReplayLastPlan();
|
||||
#endif
|
||||
|
||||
// These methods are always available
|
||||
absl::Status ShowHarnessDashboard();
|
||||
absl::Status ShowHarnessActiveTests();
|
||||
void RecordPlanSummary(const std::string& summary);
|
||||
|
||||
Reference in New Issue
Block a user