refactor: reorganize submodule structure and enhance CMake configuration
- Moved all third-party libraries (SDL, ImGui, Asar, etc.) from `src/lib/` and `third_party/` to a new `ext/` directory for better organization and clarity in dependency management. - Updated CMake configuration to reflect the new paths, ensuring all targets and includes point to the `ext/` directory. - Enhanced CMake presets to support new build options for AI and gRPC features, improving modularity and build flexibility. - Added new feature flags for agent UI and remote automation, allowing for more granular control over build configurations. - Updated documentation to reflect changes in the project structure and build options, ensuring clarity for contributors and users.
This commit is contained in:
@@ -14,7 +14,7 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
# Set Asar source directory
|
||||
set(ASAR_SRC_DIR "${CMAKE_SOURCE_DIR}/src/lib/asar/src")
|
||||
set(ASAR_SRC_DIR "${CMAKE_SOURCE_DIR}/ext/asar/src")
|
||||
|
||||
# Add Asar as subdirectory
|
||||
add_subdirectory(${ASAR_SRC_DIR} EXCLUDE_FROM_ALL)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Dear ImGui dependency management
|
||||
# Uses the bundled ImGui in src/lib/imgui
|
||||
# Uses the bundled ImGui in ext/imgui
|
||||
|
||||
message(STATUS "Setting up Dear ImGui from bundled sources")
|
||||
|
||||
# Use the bundled ImGui from src/lib/imgui
|
||||
set(IMGUI_DIR ${CMAKE_SOURCE_DIR}/src/lib/imgui)
|
||||
# Use the bundled ImGui from ext/imgui
|
||||
set(IMGUI_DIR ${CMAKE_SOURCE_DIR}/ext/imgui)
|
||||
|
||||
# Create ImGui library with core files from bundled source
|
||||
add_library(ImGui STATIC
|
||||
@@ -35,7 +35,7 @@ message(STATUS "Created ImGui target from bundled source at ${IMGUI_DIR}")
|
||||
|
||||
# Create ImGui Test Engine for test automation (if tests are enabled)
|
||||
if(YAZE_BUILD_TESTS)
|
||||
set(IMGUI_TEST_ENGINE_DIR ${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine/imgui_test_engine)
|
||||
set(IMGUI_TEST_ENGINE_DIR ${CMAKE_SOURCE_DIR}/ext/imgui_test_engine/imgui_test_engine)
|
||||
|
||||
if(EXISTS ${IMGUI_TEST_ENGINE_DIR})
|
||||
set(IMGUI_TEST_ENGINE_SOURCES
|
||||
@@ -53,7 +53,7 @@ if(YAZE_BUILD_TESTS)
|
||||
target_include_directories(ImGuiTestEngine PUBLIC
|
||||
${IMGUI_DIR}
|
||||
${IMGUI_TEST_ENGINE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${CMAKE_SOURCE_DIR}/ext
|
||||
)
|
||||
target_compile_features(ImGuiTestEngine PUBLIC cxx_std_17)
|
||||
target_link_libraries(ImGuiTestEngine PUBLIC ImGui ${YAZE_SDL2_TARGETS})
|
||||
|
||||
@@ -4,14 +4,14 @@ if(NOT YAZE_ENABLE_JSON)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Setting up nlohmann_json with local third_party")
|
||||
message(STATUS "Setting up nlohmann_json with local ext directory")
|
||||
|
||||
# Use the bundled nlohmann_json from third_party
|
||||
# Use the bundled nlohmann_json from ext/json
|
||||
set(JSON_BuildTests OFF CACHE BOOL "" FORCE)
|
||||
set(JSON_Install OFF CACHE BOOL "" FORCE)
|
||||
set(JSON_MultipleHeaders OFF CACHE BOOL "" FORCE)
|
||||
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/third_party/json EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/ext/json EXCLUDE_FROM_ALL)
|
||||
|
||||
# Verify target is available
|
||||
if(TARGET nlohmann_json::nlohmann_json)
|
||||
@@ -25,10 +25,7 @@ else()
|
||||
endif()
|
||||
|
||||
# Export for use in other CMake files
|
||||
set(YAZE_JSON_TARGETS
|
||||
nlohmann_json::nlohmann_json
|
||||
PARENT_SCOPE
|
||||
)
|
||||
set(YAZE_JSON_TARGETS nlohmann_json::nlohmann_json CACHE INTERNAL "nlohmann_json targets")
|
||||
|
||||
message(STATUS "nlohmann_json setup complete")
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
# Core build options
|
||||
option(YAZE_BUILD_GUI "Build GUI application" ON)
|
||||
option(YAZE_BUILD_CLI "Build CLI tools (z3ed)" ON)
|
||||
option(YAZE_BUILD_CLI "Build CLI tools (shared libraries)" ON)
|
||||
option(YAZE_BUILD_Z3ED "Build z3ed CLI executable" ON)
|
||||
option(YAZE_BUILD_EMU "Build emulator components" ON)
|
||||
option(YAZE_BUILD_LIB "Build static library" ON)
|
||||
option(YAZE_BUILD_TESTS "Build test suite" ON)
|
||||
@@ -13,6 +14,24 @@ option(YAZE_ENABLE_GRPC "Enable gRPC agent support" ON)
|
||||
option(YAZE_ENABLE_JSON "Enable JSON support" ON)
|
||||
option(YAZE_ENABLE_AI "Enable AI agent features" ON)
|
||||
|
||||
# Advanced feature toggles
|
||||
option(YAZE_ENABLE_REMOTE_AUTOMATION
|
||||
"Enable remote automation services (gRPC/protobuf servers + GUI automation clients)"
|
||||
${YAZE_ENABLE_GRPC})
|
||||
option(YAZE_ENABLE_AI_RUNTIME
|
||||
"Enable AI runtime integrations (Gemini/Ollama, advanced routing, proposal planning)"
|
||||
${YAZE_ENABLE_AI})
|
||||
option(YAZE_BUILD_AGENT_UI
|
||||
"Build ImGui-based agent/chat panels inside the GUI"
|
||||
${YAZE_BUILD_GUI})
|
||||
option(YAZE_ENABLE_AGENT_CLI
|
||||
"Build the conversational agent CLI stack (z3ed agent commands)"
|
||||
${YAZE_BUILD_CLI})
|
||||
|
||||
if((YAZE_BUILD_CLI OR YAZE_BUILD_Z3ED) AND NOT YAZE_ENABLE_AGENT_CLI)
|
||||
set(YAZE_ENABLE_AGENT_CLI ON CACHE BOOL "Build the conversational agent CLI stack (z3ed agent commands)" FORCE)
|
||||
endif()
|
||||
|
||||
# Build optimizations
|
||||
option(YAZE_ENABLE_LTO "Enable link-time optimization" OFF)
|
||||
option(YAZE_ENABLE_SANITIZERS "Enable AddressSanitizer/UBSanitizer" OFF)
|
||||
@@ -33,6 +52,14 @@ option(YAZE_INSTALL_LIB "Install static library" OFF)
|
||||
option(YAZE_INSTALL_HEADERS "Install public headers" ON)
|
||||
|
||||
# Set preprocessor definitions based on options
|
||||
if(YAZE_ENABLE_REMOTE_AUTOMATION AND NOT YAZE_ENABLE_GRPC)
|
||||
set(YAZE_ENABLE_GRPC ON CACHE BOOL "Enable gRPC agent support" FORCE)
|
||||
endif()
|
||||
|
||||
if(NOT YAZE_ENABLE_REMOTE_AUTOMATION)
|
||||
set(YAZE_ENABLE_GRPC OFF CACHE BOOL "Enable gRPC agent support" FORCE)
|
||||
endif()
|
||||
|
||||
if(YAZE_ENABLE_GRPC)
|
||||
add_compile_definitions(YAZE_WITH_GRPC)
|
||||
endif()
|
||||
@@ -41,6 +68,14 @@ if(YAZE_ENABLE_JSON)
|
||||
add_compile_definitions(YAZE_WITH_JSON)
|
||||
endif()
|
||||
|
||||
if(YAZE_ENABLE_AI_RUNTIME AND NOT YAZE_ENABLE_AI)
|
||||
set(YAZE_ENABLE_AI ON CACHE BOOL "Enable AI agent features" FORCE)
|
||||
endif()
|
||||
|
||||
if(NOT YAZE_ENABLE_AI_RUNTIME)
|
||||
set(YAZE_ENABLE_AI OFF CACHE BOOL "Enable AI agent features" FORCE)
|
||||
endif()
|
||||
|
||||
if(YAZE_ENABLE_AI)
|
||||
add_compile_definitions(Z3ED_AI)
|
||||
endif()
|
||||
@@ -49,12 +84,17 @@ endif()
|
||||
message(STATUS "=== YAZE Build Configuration ===")
|
||||
message(STATUS "GUI Application: ${YAZE_BUILD_GUI}")
|
||||
message(STATUS "CLI Tools: ${YAZE_BUILD_CLI}")
|
||||
message(STATUS "z3ed CLI: ${YAZE_BUILD_Z3ED}")
|
||||
message(STATUS "Emulator: ${YAZE_BUILD_EMU}")
|
||||
message(STATUS "Static Library: ${YAZE_BUILD_LIB}")
|
||||
message(STATUS "Tests: ${YAZE_BUILD_TESTS}")
|
||||
message(STATUS "gRPC Support: ${YAZE_ENABLE_GRPC}")
|
||||
message(STATUS "Remote Automation: ${YAZE_ENABLE_REMOTE_AUTOMATION}")
|
||||
message(STATUS "JSON Support: ${YAZE_ENABLE_JSON}")
|
||||
message(STATUS "AI Features: ${YAZE_ENABLE_AI}")
|
||||
message(STATUS "AI Runtime: ${YAZE_ENABLE_AI_RUNTIME}")
|
||||
message(STATUS "AI Features (legacy): ${YAZE_ENABLE_AI}")
|
||||
message(STATUS "Agent UI Panels: ${YAZE_BUILD_AGENT_UI}")
|
||||
message(STATUS "Agent CLI Stack: ${YAZE_ENABLE_AGENT_CLI}")
|
||||
message(STATUS "LTO: ${YAZE_ENABLE_LTO}")
|
||||
message(STATUS "Sanitizers: ${YAZE_ENABLE_SANITIZERS}")
|
||||
message(STATUS "Coverage: ${YAZE_ENABLE_COVERAGE}")
|
||||
|
||||
@@ -27,14 +27,14 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
# Fall back to bundled SDL if vcpkg not available or SDL2 not found
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/src/lib/SDL/CMakeLists.txt")
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/ext/SDL/CMakeLists.txt")
|
||||
message(STATUS "○ vcpkg SDL2 not found, using bundled SDL2")
|
||||
add_subdirectory(src/lib/SDL)
|
||||
add_subdirectory(ext/SDL)
|
||||
set(SDL_TARGETS SDL2-static)
|
||||
set(SDL2_INCLUDE_DIR
|
||||
${CMAKE_SOURCE_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include-config-${CMAKE_BUILD_TYPE}
|
||||
${CMAKE_SOURCE_DIR}/ext/SDL/include
|
||||
${CMAKE_BINARY_DIR}/ext/SDL/include
|
||||
${CMAKE_BINARY_DIR}/ext/SDL/include-config-${CMAKE_BUILD_TYPE}
|
||||
)
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
||||
if(TARGET SDL2main)
|
||||
@@ -47,12 +47,12 @@ if(WIN32)
|
||||
endif()
|
||||
elseif(UNIX OR MINGW)
|
||||
# Non-Windows: use bundled SDL
|
||||
add_subdirectory(src/lib/SDL)
|
||||
add_subdirectory(ext/SDL)
|
||||
set(SDL_TARGETS SDL2-static)
|
||||
set(SDL2_INCLUDE_DIR
|
||||
${CMAKE_SOURCE_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include-config-${CMAKE_BUILD_TYPE}
|
||||
${CMAKE_SOURCE_DIR}/ext/SDL/include
|
||||
${CMAKE_BINARY_DIR}/ext/SDL/include
|
||||
${CMAKE_BINARY_DIR}/ext/SDL/include-config-${CMAKE_BUILD_TYPE}
|
||||
)
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
||||
message(STATUS "Using bundled SDL2")
|
||||
|
||||
Reference in New Issue
Block a user