feat: Implement modular build system for Yaze
- Added option to enable modular build with `YAZE_USE_MODULAR_BUILD`. - Updated CMake configuration to support modular libraries for core, editor, graphics, GUI, and emulator functionalities. - Refactored existing libraries to separate concerns and improve build times. - Introduced new utility library `yaze_util` for low-level utilities. - Adjusted CI and release workflows to accommodate the new build system. - Updated various source files to reflect new include paths and modular structure. - Enhanced YAML configuration handling in the agent component.
This commit is contained in:
@@ -87,6 +87,32 @@ if(YAZE_BUILD_APP OR YAZE_BUILD_Z3ED)
|
||||
include(cli/agent.cmake)
|
||||
endif()
|
||||
|
||||
if(YAZE_USE_MODULAR_BUILD)
|
||||
message(STATUS "Using modular build system")
|
||||
|
||||
if(YAZE_BUILD_LIB OR YAZE_BUILD_APP OR YAZE_BUILD_Z3ED)
|
||||
include(app/gfx/gfx.cmake)
|
||||
include(app/gui/gui.cmake)
|
||||
include(app/zelda3/zelda3.cmake)
|
||||
include(app/core/core.cmake)
|
||||
include(app/editor/editor.cmake)
|
||||
|
||||
include(util/util.cmake)
|
||||
include(app/gfx/gfx_library.cmake)
|
||||
include(app/gui/gui_library.cmake)
|
||||
include(app/zelda3/zelda3_library.cmake)
|
||||
|
||||
if(YAZE_BUILD_EMU AND NOT YAZE_WITH_GRPC)
|
||||
include(app/emu/emu_library.cmake)
|
||||
endif()
|
||||
|
||||
include(app/core/core_library.cmake)
|
||||
include(app/editor/editor_library.cmake)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using traditional monolithic build system")
|
||||
endif()
|
||||
|
||||
if (YAZE_BUILD_APP)
|
||||
include(app/app.cmake)
|
||||
endif()
|
||||
@@ -165,29 +191,116 @@ endif()
|
||||
|
||||
# Yaze Core Library (for testing and C API)
|
||||
if (YAZE_BUILD_LIB)
|
||||
# Create core library for testing (includes editor and zelda3 components needed by tests)
|
||||
set(YAZE_CORE_SOURCES
|
||||
app/rom.cc
|
||||
${YAZE_APP_CORE_SRC}
|
||||
${YAZE_APP_GFX_SRC}
|
||||
${YAZE_APP_EDITOR_SRC}
|
||||
${YAZE_APP_ZELDA3_SRC}
|
||||
${YAZE_APP_EMU_SRC}
|
||||
${YAZE_GUI_SRC}
|
||||
${YAZE_UTIL_SRC}
|
||||
# cli/service/gui_automation_client.cc # Moved to yaze_c
|
||||
cli/service/testing/test_workflow_generator.cc
|
||||
)
|
||||
|
||||
# Create full library for C API
|
||||
# Sources shared by the C API library
|
||||
set(YAZE_C_SOURCES
|
||||
./yaze.cc
|
||||
cli/service/gui/gui_automation_client.cc
|
||||
)
|
||||
|
||||
# Create the core library (static for testing)
|
||||
add_library(yaze_core STATIC ${YAZE_CORE_SOURCES})
|
||||
|
||||
|
||||
if(YAZE_USE_MODULAR_BUILD)
|
||||
# Aggregate modular libraries into an interface target for backward compatibility
|
||||
if(NOT TARGET yaze_core)
|
||||
add_library(yaze_core INTERFACE)
|
||||
endif()
|
||||
|
||||
target_include_directories(
|
||||
yaze_core INTERFACE
|
||||
${CMAKE_SOURCE_DIR}/src/lib/
|
||||
${CMAKE_SOURCE_DIR}/src/app/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c
|
||||
${CMAKE_SOURCE_DIR}/incl/
|
||||
${CMAKE_SOURCE_DIR}/src/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
yaze_core INTERFACE
|
||||
yaze_util
|
||||
yaze_gfx
|
||||
yaze_gui
|
||||
yaze_zelda3
|
||||
yaze_core_lib
|
||||
yaze_editor
|
||||
ImGui
|
||||
)
|
||||
|
||||
if(TARGET yaze_agent)
|
||||
target_link_libraries(yaze_core INTERFACE yaze_agent)
|
||||
endif()
|
||||
|
||||
if(YAZE_BUILD_EMU AND NOT YAZE_WITH_GRPC AND TARGET yaze_emulator)
|
||||
target_link_libraries(yaze_core INTERFACE yaze_emulator)
|
||||
endif()
|
||||
|
||||
if(YAZE_ENABLE_UI_TESTS AND TARGET ImGuiTestEngine)
|
||||
target_link_libraries(yaze_core INTERFACE ImGuiTestEngine)
|
||||
endif()
|
||||
|
||||
if(YAZE_WITH_GRPC)
|
||||
target_link_libraries(yaze_core INTERFACE
|
||||
grpc++
|
||||
grpc++_reflection
|
||||
libprotobuf)
|
||||
endif()
|
||||
else()
|
||||
# Create core library for testing (includes editor and zelda3 components needed by tests)
|
||||
set(YAZE_CORE_SOURCES
|
||||
app/rom.cc
|
||||
${YAZE_APP_CORE_SRC}
|
||||
${YAZE_APP_GFX_SRC}
|
||||
${YAZE_APP_EDITOR_SRC}
|
||||
${YAZE_APP_ZELDA3_SRC}
|
||||
${YAZE_APP_EMU_SRC}
|
||||
${YAZE_GUI_SRC}
|
||||
${YAZE_UTIL_SRC}
|
||||
# cli/service/gui_automation_client.cc # Moved to yaze_c
|
||||
cli/service/testing/test_workflow_generator.cc
|
||||
)
|
||||
|
||||
add_library(yaze_core STATIC ${YAZE_CORE_SOURCES})
|
||||
|
||||
target_include_directories(
|
||||
yaze_core PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src/lib/
|
||||
${CMAKE_SOURCE_DIR}/src/app/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c
|
||||
${CMAKE_SOURCE_DIR}/incl/
|
||||
${CMAKE_SOURCE_DIR}/src/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
yaze_core PUBLIC
|
||||
asar-static
|
||||
yaze_agent
|
||||
${ABSL_TARGETS}
|
||||
${SDL_TARGETS}
|
||||
${CMAKE_DL_LIBS}
|
||||
ImGui
|
||||
)
|
||||
|
||||
if(YAZE_WITH_GRPC)
|
||||
target_add_protobuf(yaze_core
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/proto/imgui_test_harness.proto)
|
||||
|
||||
target_link_libraries(yaze_core PRIVATE
|
||||
grpc++
|
||||
grpc++_reflection
|
||||
libprotobuf)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Create the full C API library (static for CI, shared for release)
|
||||
if(YAZE_MINIMAL_BUILD)
|
||||
add_library(yaze_c STATIC ${YAZE_C_SOURCES})
|
||||
@@ -195,44 +308,6 @@ if (YAZE_BUILD_LIB)
|
||||
add_library(yaze_c SHARED ${YAZE_C_SOURCES})
|
||||
endif()
|
||||
|
||||
# Configure core library (for testing)
|
||||
target_include_directories(
|
||||
yaze_core PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src/lib/
|
||||
${CMAKE_SOURCE_DIR}/src/app/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c
|
||||
${CMAKE_SOURCE_DIR}/incl/
|
||||
${CMAKE_SOURCE_DIR}/src/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
yaze_core PUBLIC
|
||||
asar-static
|
||||
yaze_agent
|
||||
${ABSL_TARGETS}
|
||||
${SDL_TARGETS}
|
||||
${CMAKE_DL_LIBS}
|
||||
ImGui
|
||||
)
|
||||
|
||||
if(YAZE_WITH_GRPC)
|
||||
target_add_protobuf(yaze_core
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/proto/imgui_test_harness.proto)
|
||||
|
||||
target_link_libraries(yaze_core PRIVATE
|
||||
grpc++
|
||||
grpc++_reflection
|
||||
libprotobuf)
|
||||
endif()
|
||||
|
||||
# Configure full C API library
|
||||
target_include_directories(
|
||||
yaze_c PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src/lib/
|
||||
@@ -246,19 +321,41 @@ if (YAZE_BUILD_LIB)
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
# Conditionally add PNG include dirs if available
|
||||
|
||||
if(PNG_FOUND)
|
||||
target_include_directories(yaze_c PUBLIC ${PNG_INCLUDE_DIRS})
|
||||
target_include_directories(yaze_core PUBLIC ${PNG_INCLUDE_DIRS})
|
||||
if(NOT YAZE_USE_MODULAR_BUILD)
|
||||
target_include_directories(yaze_core PUBLIC ${PNG_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(YAZE_USE_MODULAR_BUILD)
|
||||
target_link_libraries(
|
||||
yaze_c PRIVATE
|
||||
yaze_util
|
||||
yaze_gfx
|
||||
yaze_gui
|
||||
yaze_zelda3
|
||||
yaze_core_lib
|
||||
yaze_editor
|
||||
ImGui
|
||||
)
|
||||
|
||||
if(TARGET yaze_agent)
|
||||
target_link_libraries(yaze_c PRIVATE yaze_agent)
|
||||
endif()
|
||||
|
||||
if(YAZE_BUILD_EMU AND NOT YAZE_WITH_GRPC AND TARGET yaze_emulator)
|
||||
target_link_libraries(yaze_c PRIVATE yaze_emulator)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(
|
||||
yaze_c PRIVATE
|
||||
yaze_core
|
||||
ImGui
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
yaze_c PRIVATE
|
||||
yaze_core
|
||||
ImGui
|
||||
)
|
||||
|
||||
if(YAZE_WITH_GRPC)
|
||||
target_add_protobuf(yaze_c
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/proto/imgui_test_harness.proto)
|
||||
@@ -269,18 +366,18 @@ if (YAZE_BUILD_LIB)
|
||||
libprotobuf)
|
||||
endif()
|
||||
|
||||
# Conditionally link ImGui Test Engine and set definitions
|
||||
if(YAZE_ENABLE_UI_TESTS AND TARGET ImGuiTestEngine)
|
||||
target_link_libraries(yaze_c PRIVATE ImGuiTestEngine)
|
||||
target_compile_definitions(yaze_c PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=1)
|
||||
else()
|
||||
target_compile_definitions(yaze_c PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=0)
|
||||
endif()
|
||||
|
||||
# Conditionally link PNG if available
|
||||
|
||||
if(PNG_FOUND)
|
||||
target_link_libraries(yaze_c PRIVATE ${PNG_LIBRARIES})
|
||||
target_link_libraries(yaze_core PRIVATE ${PNG_LIBRARIES})
|
||||
if(NOT YAZE_USE_MODULAR_BUILD)
|
||||
target_link_libraries(yaze_core PRIVATE ${PNG_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (YAZE_INSTALL_LIB)
|
||||
|
||||
@@ -98,7 +98,26 @@ else()
|
||||
target_compile_definitions(yaze PRIVATE YAZE_ENABLE_NFD=0)
|
||||
endif()
|
||||
|
||||
target_link_libraries(yaze PRIVATE yaze_core)
|
||||
if(YAZE_USE_MODULAR_BUILD)
|
||||
target_link_libraries(yaze PRIVATE
|
||||
yaze_util
|
||||
yaze_gfx
|
||||
yaze_gui
|
||||
yaze_zelda3
|
||||
yaze_core_lib
|
||||
yaze_editor
|
||||
)
|
||||
|
||||
if(TARGET yaze_agent)
|
||||
target_link_libraries(yaze PRIVATE yaze_agent)
|
||||
endif()
|
||||
|
||||
if(YAZE_BUILD_EMU AND NOT YAZE_WITH_GRPC AND TARGET yaze_emulator)
|
||||
target_link_libraries(yaze PRIVATE yaze_emulator)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(yaze PRIVATE yaze_core)
|
||||
endif()
|
||||
|
||||
# Enable policy framework in main yaze target
|
||||
target_compile_definitions(yaze PRIVATE YAZE_ENABLE_POLICY_FRAMEWORK=1)
|
||||
@@ -224,22 +243,24 @@ if(YAZE_WITH_GRPC)
|
||||
${CMAKE_SOURCE_DIR}/third_party/json/include)
|
||||
target_compile_definitions(yaze PRIVATE YAZE_WITH_JSON)
|
||||
|
||||
# Generate C++ code from .proto using the helper function from cmake/grpc.cmake
|
||||
target_add_protobuf(yaze
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/proto/imgui_test_harness.proto)
|
||||
|
||||
# Add service implementation sources
|
||||
target_sources(yaze PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/imgui_test_harness_service.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/imgui_test_harness_service.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/screenshot_utils.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/screenshot_utils.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/widget_discovery_service.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/widget_discovery_service.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_recorder.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_recorder.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_script_parser.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_script_parser.h)
|
||||
if(NOT YAZE_USE_MODULAR_BUILD)
|
||||
# Generate C++ code from .proto using the helper function from cmake/grpc.cmake
|
||||
target_add_protobuf(yaze
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/proto/imgui_test_harness.proto)
|
||||
|
||||
# Add service implementation sources
|
||||
target_sources(yaze PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/imgui_test_harness_service.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/imgui_test_harness_service.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/screenshot_utils.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/screenshot_utils.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/widget_discovery_service.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/widget_discovery_service.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_recorder.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_recorder.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_script_parser.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_script_parser.h)
|
||||
endif()
|
||||
|
||||
# Link gRPC libraries
|
||||
target_link_libraries(yaze PRIVATE
|
||||
|
||||
92
src/app/core/core_library.cmake
Normal file
92
src/app/core/core_library.cmake
Normal file
@@ -0,0 +1,92 @@
|
||||
# ==============================================================================
|
||||
# Yaze Core Library
|
||||
# ==============================================================================
|
||||
# This library contains core application functionality:
|
||||
# - ROM management
|
||||
# - Project management
|
||||
# - Controller/Window management
|
||||
# - Asar wrapper for assembly
|
||||
# - Platform-specific utilities (file dialogs, fonts, clipboard)
|
||||
# - Widget state capture for testing
|
||||
# - Emulator interface
|
||||
#
|
||||
# Dependencies: yaze_util, yaze_gfx, asar, SDL2
|
||||
# ==============================================================================
|
||||
|
||||
add_library(yaze_core_lib STATIC
|
||||
app/rom.cc
|
||||
${YAZE_APP_CORE_SRC}
|
||||
)
|
||||
|
||||
target_include_directories(yaze_core_lib PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src/app
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar
|
||||
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(yaze_core_lib PUBLIC
|
||||
yaze_util
|
||||
yaze_gfx
|
||||
yaze_common
|
||||
asar-static
|
||||
${ABSL_TARGETS}
|
||||
${SDL_TARGETS}
|
||||
${CMAKE_DL_LIBS}
|
||||
)
|
||||
|
||||
target_sources(yaze_core_lib PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/cli/service/testing/test_workflow_generator.cc
|
||||
)
|
||||
|
||||
if(YAZE_WITH_GRPC)
|
||||
target_add_protobuf(yaze_core_lib
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/proto/imgui_test_harness.proto)
|
||||
|
||||
target_sources(yaze_core_lib PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/imgui_test_harness_service.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/imgui_test_harness_service.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/screenshot_utils.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/screenshot_utils.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/widget_discovery_service.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/service/widget_discovery_service.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_recorder.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_recorder.h
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_script_parser.cc
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_script_parser.h
|
||||
)
|
||||
|
||||
target_link_libraries(yaze_core_lib PUBLIC
|
||||
grpc++
|
||||
grpc++_reflection
|
||||
libprotobuf
|
||||
)
|
||||
endif()
|
||||
|
||||
# Platform-specific libraries
|
||||
if(APPLE)
|
||||
target_link_libraries(yaze_core_lib PUBLIC ${COCOA_LIBRARY})
|
||||
endif()
|
||||
|
||||
set_target_properties(yaze_core_lib PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
||||
# Platform-specific compile definitions
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_compile_definitions(yaze_core_lib PRIVATE linux stricmp=strcasecmp)
|
||||
elseif(APPLE)
|
||||
target_compile_definitions(yaze_core_lib PRIVATE MACOS)
|
||||
elseif(WIN32)
|
||||
target_compile_definitions(yaze_core_lib PRIVATE WINDOWS)
|
||||
endif()
|
||||
|
||||
message(STATUS "✓ yaze_core_lib library configured")
|
||||
73
src/app/editor/editor_library.cmake
Normal file
73
src/app/editor/editor_library.cmake
Normal file
@@ -0,0 +1,73 @@
|
||||
# ==============================================================================
|
||||
# Yaze Editor Library
|
||||
# ==============================================================================
|
||||
# This library contains all editor functionality:
|
||||
# - Editor manager and coordination
|
||||
# - Dungeon editor (room selector, object editor, renderer)
|
||||
# - Overworld editor (map, tile16, entities)
|
||||
# - Sprite editor
|
||||
# - Music editor
|
||||
# - Message editor
|
||||
# - Assembly editor
|
||||
# - Graphics/palette editors
|
||||
# - System editors (settings, commands, extensions)
|
||||
# - Testing infrastructure
|
||||
#
|
||||
# Dependencies: yaze_core_lib, yaze_gfx, yaze_gui, yaze_zelda3, ImGui
|
||||
# ==============================================================================
|
||||
|
||||
add_library(yaze_editor STATIC ${YAZE_APP_EDITOR_SRC})
|
||||
|
||||
target_include_directories(yaze_editor PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(yaze_editor PUBLIC
|
||||
yaze_core_lib
|
||||
yaze_gfx
|
||||
yaze_gui
|
||||
yaze_zelda3
|
||||
yaze_util
|
||||
yaze_common
|
||||
ImGui
|
||||
)
|
||||
|
||||
# Conditionally link ImGui Test Engine
|
||||
if(YAZE_ENABLE_UI_TESTS AND TARGET ImGuiTestEngine)
|
||||
target_link_libraries(yaze_editor PUBLIC ImGuiTestEngine)
|
||||
target_compile_definitions(yaze_editor PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=1)
|
||||
else()
|
||||
target_compile_definitions(yaze_editor PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=0)
|
||||
endif()
|
||||
|
||||
# Conditionally link gRPC if enabled
|
||||
if(YAZE_WITH_GRPC)
|
||||
target_link_libraries(yaze_editor PRIVATE
|
||||
grpc++
|
||||
grpc++_reflection
|
||||
libprotobuf
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(yaze_editor PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
||||
# Platform-specific compile definitions
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_compile_definitions(yaze_editor PRIVATE linux stricmp=strcasecmp)
|
||||
elseif(APPLE)
|
||||
target_compile_definitions(yaze_editor PRIVATE MACOS)
|
||||
elseif(WIN32)
|
||||
target_compile_definitions(yaze_editor PRIVATE WINDOWS)
|
||||
endif()
|
||||
|
||||
message(STATUS "✓ yaze_editor library configured")
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "app/gui/modules/asset_browser.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/rom.h"
|
||||
#include "gfx/performance_profiler.h"
|
||||
#include "app/gfx/performance_profiler.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui/misc/cpp/imgui_stdlib.h"
|
||||
#include "imgui_memory_editor.h"
|
||||
|
||||
47
src/app/emu/emu_library.cmake
Normal file
47
src/app/emu/emu_library.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# ==============================================================================
|
||||
# Yaze Emulator Library
|
||||
# ==============================================================================
|
||||
# This library contains SNES emulation functionality:
|
||||
# - CPU (65C816) implementation
|
||||
# - PPU (Picture Processing Unit) for graphics
|
||||
# - APU (Audio Processing Unit) with SPC700 and DSP
|
||||
# - DMA controller
|
||||
# - Memory management
|
||||
#
|
||||
# Dependencies: yaze_util, SDL2
|
||||
# ==============================================================================
|
||||
|
||||
add_library(yaze_emulator STATIC ${YAZE_APP_EMU_SRC})
|
||||
|
||||
target_include_directories(yaze_emulator PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src/app
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(yaze_emulator PUBLIC
|
||||
yaze_util
|
||||
yaze_common
|
||||
${ABSL_TARGETS}
|
||||
${SDL_TARGETS}
|
||||
)
|
||||
|
||||
set_target_properties(yaze_emulator PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
||||
# Platform-specific compile definitions
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_compile_definitions(yaze_emulator PRIVATE linux stricmp=strcasecmp)
|
||||
elseif(APPLE)
|
||||
target_compile_definitions(yaze_emulator PRIVATE MACOS)
|
||||
elseif(WIN32)
|
||||
target_compile_definitions(yaze_emulator PRIVATE WINDOWS)
|
||||
endif()
|
||||
|
||||
message(STATUS "✓ yaze_emulator library configured")
|
||||
53
src/app/gfx/gfx_library.cmake
Normal file
53
src/app/gfx/gfx_library.cmake
Normal file
@@ -0,0 +1,53 @@
|
||||
# ==============================================================================
|
||||
# Yaze Graphics Library
|
||||
# ==============================================================================
|
||||
# This library contains all graphics-related functionality:
|
||||
# - Bitmap manipulation
|
||||
# - SNES tile/palette handling
|
||||
# - Compression/decompression
|
||||
# - Arena memory management
|
||||
# - Atlas rendering
|
||||
# - Performance profiling
|
||||
#
|
||||
# Dependencies: yaze_util, SDL2, Abseil
|
||||
# ==============================================================================
|
||||
|
||||
add_library(yaze_gfx STATIC ${YAZE_APP_GFX_SRC})
|
||||
|
||||
target_include_directories(yaze_gfx PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(yaze_gfx PUBLIC
|
||||
yaze_util
|
||||
yaze_common
|
||||
${ABSL_TARGETS}
|
||||
${SDL_TARGETS}
|
||||
)
|
||||
|
||||
# Conditionally add PNG support
|
||||
if(PNG_FOUND)
|
||||
target_include_directories(yaze_gfx PUBLIC ${PNG_INCLUDE_DIRS})
|
||||
target_link_libraries(yaze_gfx PUBLIC ${PNG_LIBRARIES})
|
||||
endif()
|
||||
|
||||
set_target_properties(yaze_gfx PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
||||
# Platform-specific compile definitions
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_compile_definitions(yaze_gfx PRIVATE linux stricmp=strcasecmp)
|
||||
elseif(APPLE)
|
||||
target_compile_definitions(yaze_gfx PRIVATE MACOS)
|
||||
elseif(WIN32)
|
||||
target_compile_definitions(yaze_gfx PRIVATE WINDOWS)
|
||||
endif()
|
||||
|
||||
message(STATUS "✓ yaze_gfx library configured")
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef YAZE_GUI_CANVAS_H
|
||||
#define YAZE_GUI_CANVAS_H
|
||||
|
||||
#include "gfx/tilemap.h"
|
||||
#include "app/gfx/tilemap.h"
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "app/gui/enhanced_palette_editor.h"
|
||||
#include "app/gui/bpp_format_ui.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "gui/canvas/canvas_modals.h"
|
||||
#include "app/gui/canvas/canvas_modals.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "gui/canvas/canvas_modals.h"
|
||||
#include "app/gui/canvas/canvas_modals.h"
|
||||
#include "canvas_usage_tracker.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gfx/bpp_format_manager.h"
|
||||
#include "gui/canvas_utils.h"
|
||||
#include "app/gui/canvas_utils.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
|
||||
49
src/app/gui/gui_library.cmake
Normal file
49
src/app/gui/gui_library.cmake
Normal file
@@ -0,0 +1,49 @@
|
||||
# ==============================================================================
|
||||
# Yaze GUI Library
|
||||
# ==============================================================================
|
||||
# This library contains all GUI-related functionality:
|
||||
# - Canvas system
|
||||
# - ImGui widgets and utilities
|
||||
# - Input handling
|
||||
# - Theme management
|
||||
# - Color utilities
|
||||
# - Background rendering
|
||||
#
|
||||
# Dependencies: yaze_gfx, yaze_util, ImGui, SDL2
|
||||
# ==============================================================================
|
||||
|
||||
add_library(yaze_gui STATIC ${YAZE_GUI_SRC})
|
||||
|
||||
target_include_directories(yaze_gui PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(yaze_gui PUBLIC
|
||||
yaze_gfx
|
||||
yaze_util
|
||||
yaze_common
|
||||
ImGui
|
||||
${SDL_TARGETS}
|
||||
)
|
||||
|
||||
set_target_properties(yaze_gui PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
||||
# Platform-specific compile definitions
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_compile_definitions(yaze_gui PRIVATE linux stricmp=strcasecmp)
|
||||
elseif(APPLE)
|
||||
target_compile_definitions(yaze_gui PRIVATE MACOS)
|
||||
elseif(WIN32)
|
||||
target_compile_definitions(yaze_gui PRIVATE WINDOWS)
|
||||
endif()
|
||||
|
||||
message(STATUS "✓ yaze_gui library configured")
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
class TextEditor {
|
||||
public:
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include "app/core/platform/file_dialog.h"
|
||||
#include "app/gui/theme_manager.h"
|
||||
#include "app/gui/background_renderer.h"
|
||||
#include "core/platform/font_loader.h"
|
||||
#include "gui/color.h"
|
||||
#include "gui/icons.h"
|
||||
#include "app/core/platform/font_loader.h"
|
||||
#include "app/gui/color.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui/imgui_internal.h"
|
||||
#include "util/log.h"
|
||||
|
||||
45
src/app/zelda3/zelda3_library.cmake
Normal file
45
src/app/zelda3/zelda3_library.cmake
Normal file
@@ -0,0 +1,45 @@
|
||||
# ==============================================================================
|
||||
# Yaze Zelda3 Library
|
||||
# ==============================================================================
|
||||
# This library contains all Zelda3-specific game logic:
|
||||
# - Overworld system (maps, tiles, sprites)
|
||||
# - Dungeon system (rooms, objects, sprites)
|
||||
# - Screen modules (title, inventory, dungeon map)
|
||||
# - Sprite management
|
||||
# - Music/tracker system
|
||||
#
|
||||
# Dependencies: yaze_gfx, yaze_util
|
||||
# ==============================================================================
|
||||
|
||||
add_library(yaze_zelda3 STATIC ${YAZE_APP_ZELDA3_SRC})
|
||||
|
||||
target_include_directories(yaze_zelda3 PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(yaze_zelda3 PUBLIC
|
||||
yaze_gfx
|
||||
yaze_util
|
||||
yaze_common
|
||||
${ABSL_TARGETS}
|
||||
)
|
||||
|
||||
set_target_properties(yaze_zelda3 PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
||||
# Platform-specific compile definitions
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_compile_definitions(yaze_zelda3 PRIVATE linux stricmp=strcasecmp)
|
||||
elseif(APPLE)
|
||||
target_compile_definitions(yaze_zelda3 PRIVATE MACOS)
|
||||
elseif(WIN32)
|
||||
target_compile_definitions(yaze_zelda3 PRIVATE WINDOWS)
|
||||
endif()
|
||||
|
||||
message(STATUS "✓ yaze_zelda3 library configured")
|
||||
@@ -1,3 +1,69 @@
|
||||
include(FetchContent)
|
||||
|
||||
function(_yaze_ensure_yaml_cpp _out_target)
|
||||
if(TARGET yaml-cpp::yaml-cpp)
|
||||
set(${_out_target} yaml-cpp::yaml-cpp PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(TARGET yaml-cpp)
|
||||
set(${_out_target} yaml-cpp PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(yaml-cpp CONFIG QUIET)
|
||||
|
||||
if(TARGET yaml-cpp::yaml-cpp)
|
||||
set(${_out_target} yaml-cpp::yaml-cpp PARENT_SCOPE)
|
||||
return()
|
||||
elseif(TARGET yaml-cpp)
|
||||
set(${_out_target} yaml-cpp PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "yaml-cpp not found via package config, fetching from source")
|
||||
|
||||
FetchContent_Declare(yaml-cpp
|
||||
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
|
||||
GIT_TAG 0.8.0
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(yaml-cpp)
|
||||
if(NOT yaml-cpp_POPULATED)
|
||||
FetchContent_Populate(yaml-cpp)
|
||||
|
||||
set(_yaml_cpp_cmakelists "${yaml-cpp_SOURCE_DIR}/CMakeLists.txt")
|
||||
if(EXISTS "${_yaml_cpp_cmakelists}")
|
||||
file(READ "${_yaml_cpp_cmakelists}" _yaml_cpp_cmake_contents)
|
||||
if(_yaml_cpp_cmake_contents MATCHES "cmake_minimum_required\\(VERSION 3\\.4\\)")
|
||||
string(REPLACE "cmake_minimum_required(VERSION 3.4)"
|
||||
"cmake_minimum_required(VERSION 3.5)"
|
||||
_yaml_cpp_cmake_contents "${_yaml_cpp_cmake_contents}")
|
||||
file(WRITE "${_yaml_cpp_cmakelists}" "${_yaml_cpp_cmake_contents}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "Disable yaml-cpp tests" FORCE)
|
||||
set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "Disable yaml-cpp contrib" FORCE)
|
||||
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "Disable yaml-cpp tools" FORCE)
|
||||
set(YAML_CPP_INSTALL OFF CACHE BOOL "Disable yaml-cpp install" FORCE)
|
||||
set(YAML_CPP_FORMAT_SOURCE OFF CACHE BOOL "Disable yaml-cpp format target" FORCE)
|
||||
|
||||
add_subdirectory(${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
|
||||
if(NOT TARGET yaml-cpp)
|
||||
message(FATAL_ERROR "yaml-cpp target was not created after fetching")
|
||||
endif()
|
||||
|
||||
# Ensure the fetched target exposes its public headers
|
||||
target_include_directories(yaml-cpp PUBLIC ${yaml-cpp_SOURCE_DIR}/include)
|
||||
endif()
|
||||
|
||||
set(${_out_target} yaml-cpp PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
_yaze_ensure_yaml_cpp(YAZE_YAML_CPP_TARGET)
|
||||
|
||||
set(YAZE_AGENT_SOURCES
|
||||
cli/handlers/agent/tool_commands.cc
|
||||
cli/service/agent/conversational_agent_service.cc
|
||||
@@ -20,13 +86,14 @@ endif()
|
||||
|
||||
add_library(yaze_agent STATIC ${YAZE_AGENT_SOURCES})
|
||||
|
||||
target_link_libraries(yaze_agent
|
||||
PUBLIC
|
||||
yaze_common
|
||||
${ABSL_TARGETS}
|
||||
yaml-cpp
|
||||
set(_yaze_agent_link_targets
|
||||
yaze_common
|
||||
${ABSL_TARGETS}
|
||||
${YAZE_YAML_CPP_TARGET}
|
||||
)
|
||||
|
||||
target_link_libraries(yaze_agent PUBLIC ${_yaze_agent_link_targets})
|
||||
|
||||
target_include_directories(yaze_agent
|
||||
PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
@@ -36,6 +103,13 @@ target_include_directories(yaze_agent
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
)
|
||||
|
||||
if(YAZE_YAML_CPP_TARGET)
|
||||
get_target_property(_yaze_yaml_include_dirs ${YAZE_YAML_CPP_TARGET} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if(_yaze_yaml_include_dirs)
|
||||
target_include_directories(yaze_agent PUBLIC ${_yaze_yaml_include_dirs})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2_INCLUDE_DIR)
|
||||
target_include_directories(yaze_agent PUBLIC ${SDL2_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
@@ -118,15 +118,31 @@ target_include_directories(
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
z3ed PRIVATE
|
||||
yaze_core
|
||||
ftxui::component
|
||||
ftxui::screen
|
||||
ftxui::dom
|
||||
absl::flags
|
||||
absl::flags_parse
|
||||
)
|
||||
if(YAZE_USE_MODULAR_BUILD)
|
||||
target_link_libraries(
|
||||
z3ed PRIVATE
|
||||
yaze_util
|
||||
yaze_gfx
|
||||
yaze_zelda3
|
||||
yaze_core_lib
|
||||
yaze_agent
|
||||
ftxui::component
|
||||
ftxui::screen
|
||||
ftxui::dom
|
||||
absl::flags
|
||||
absl::flags_parse
|
||||
)
|
||||
else()
|
||||
target_link_libraries(
|
||||
z3ed PRIVATE
|
||||
yaze_core
|
||||
ftxui::component
|
||||
ftxui::screen
|
||||
ftxui::dom
|
||||
absl::flags
|
||||
absl::flags_parse
|
||||
)
|
||||
endif()
|
||||
|
||||
# ============================================================================
|
||||
# Optional gRPC Support for CLI Agent Test Command
|
||||
|
||||
47
src/util/util.cmake
Normal file
47
src/util/util.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# ==============================================================================
|
||||
# Yaze Utility Library
|
||||
# ==============================================================================
|
||||
# This library contains low-level utilities used throughout the codebase:
|
||||
# - BPS patch handling
|
||||
# - Command-line flag parsing
|
||||
# - Hexadecimal utilities
|
||||
#
|
||||
# This library has no dependencies on GUI, graphics, or game-specific code,
|
||||
# making it the foundation of the dependency hierarchy.
|
||||
# ==============================================================================
|
||||
|
||||
set(YAZE_UTIL_SRC
|
||||
util/bps.cc
|
||||
util/flag.cc
|
||||
util/hex.cc
|
||||
)
|
||||
|
||||
add_library(yaze_util STATIC ${YAZE_UTIL_SRC})
|
||||
|
||||
target_include_directories(yaze_util PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(yaze_util PUBLIC
|
||||
yaze_common
|
||||
${ABSL_TARGETS}
|
||||
)
|
||||
|
||||
set_target_properties(yaze_util PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
||||
# Platform-specific compile definitions
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_compile_definitions(yaze_util PRIVATE linux stricmp=strcasecmp)
|
||||
elseif(APPLE)
|
||||
target_compile_definitions(yaze_util PRIVATE MACOS)
|
||||
elseif(WIN32)
|
||||
target_compile_definitions(yaze_util PRIVATE WINDOWS)
|
||||
endif()
|
||||
|
||||
message(STATUS "✓ yaze_util library configured")
|
||||
Reference in New Issue
Block a user