backend-infra-engineer: Release v0.3.9-hotfix7 snapshot
This commit is contained in:
@@ -19,9 +19,16 @@ set(YAZE_FTXUI_TARGETS "")
|
||||
set(YAZE_TESTING_TARGETS "")
|
||||
|
||||
# Core dependencies (always required)
|
||||
include(cmake/dependencies/sdl2.cmake)
|
||||
# Debug: message(STATUS "After SDL2 setup, YAZE_SDL2_TARGETS = '${YAZE_SDL2_TARGETS}'")
|
||||
list(APPEND YAZE_ALL_DEPENDENCIES ${YAZE_SDL2_TARGETS})
|
||||
# SDL selection: SDL2 (default) or SDL3 (experimental)
|
||||
if(YAZE_USE_SDL3)
|
||||
include(cmake/dependencies/sdl3.cmake)
|
||||
# Debug: message(STATUS "After SDL3 setup, YAZE_SDL3_TARGETS = '${YAZE_SDL3_TARGETS}'")
|
||||
list(APPEND YAZE_ALL_DEPENDENCIES ${YAZE_SDL3_TARGETS})
|
||||
else()
|
||||
include(cmake/dependencies/sdl2.cmake)
|
||||
# Debug: message(STATUS "After SDL2 setup, YAZE_SDL2_TARGETS = '${YAZE_SDL2_TARGETS}'")
|
||||
list(APPEND YAZE_ALL_DEPENDENCIES ${YAZE_SDL2_TARGETS})
|
||||
endif()
|
||||
|
||||
include(cmake/dependencies/yaml.cmake)
|
||||
list(APPEND YAZE_ALL_DEPENDENCIES ${YAZE_YAML_TARGETS})
|
||||
|
||||
@@ -26,8 +26,28 @@ CPMAddPackage(
|
||||
# We'll create our own interface target and link when available
|
||||
add_library(yaze_ftxui INTERFACE)
|
||||
|
||||
# Note: FTXUI targets will be available after the build phase
|
||||
# For now, we'll create a placeholder that can be linked later
|
||||
# Link to the actual FTXUI targets
|
||||
if(TARGET ftxui::screen AND TARGET ftxui::dom AND TARGET ftxui::component)
|
||||
target_link_libraries(yaze_ftxui INTERFACE
|
||||
ftxui::screen
|
||||
ftxui::dom
|
||||
ftxui::component
|
||||
)
|
||||
else()
|
||||
# Fallback for when targets aren't namespaced
|
||||
target_link_libraries(yaze_ftxui INTERFACE
|
||||
screen
|
||||
dom
|
||||
component
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add include path with compile options for Ninja Multi-Config compatibility
|
||||
# The -isystem-after flag doesn't work properly with some generator/compiler combinations
|
||||
if(ftxui_SOURCE_DIR)
|
||||
add_compile_options(-I${ftxui_SOURCE_DIR}/include)
|
||||
message(STATUS " Added FTXUI include: ${ftxui_SOURCE_DIR}/include")
|
||||
endif()
|
||||
|
||||
# Export FTXUI targets for use in other CMake files
|
||||
set(YAZE_FTXUI_TARGETS yaze_ftxui)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# gRPC and Protobuf dependency management
|
||||
# Uses CPM.cmake for consistent cross-platform builds
|
||||
# Uses CPM.cmake for consistent cross-platform builds, with optional system package fallback
|
||||
|
||||
if(NOT YAZE_ENABLE_GRPC)
|
||||
return()
|
||||
@@ -9,24 +9,147 @@ endif()
|
||||
include(cmake/CPM.cmake)
|
||||
include(cmake/dependencies.lock)
|
||||
|
||||
message(STATUS "Setting up gRPC ${GRPC_VERSION} with CPM.cmake")
|
||||
message(STATUS "Setting up gRPC ${GRPC_VERSION}")
|
||||
|
||||
# Try to use system packages first if requested
|
||||
if(YAZE_USE_SYSTEM_DEPS)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(GRPC_PC grpc++)
|
||||
if(GRPC_PC_FOUND)
|
||||
message(STATUS "Using system gRPC via pkg-config")
|
||||
add_library(grpc::grpc++ INTERFACE IMPORTED)
|
||||
target_include_directories(grpc::grpc++ INTERFACE ${GRPC_PC_INCLUDE_DIRS})
|
||||
target_link_libraries(grpc::grpc++ INTERFACE ${GRPC_PC_LIBRARIES})
|
||||
target_compile_options(grpc::grpc++ INTERFACE ${GRPC_PC_CFLAGS_OTHER})
|
||||
return()
|
||||
#-----------------------------------------------------------------------
|
||||
# Option: YAZE_PREFER_SYSTEM_GRPC - Use system-installed gRPC/protobuf/abseil
|
||||
# when available (e.g., from Homebrew, apt, vcpkg).
|
||||
#
|
||||
# Benefits: Much faster configure/build times for local development
|
||||
# Trade-off: May have version mismatches between system packages
|
||||
#
|
||||
# Example: cmake --preset mac-ai-fast (uses system packages)
|
||||
#-----------------------------------------------------------------------
|
||||
option(YAZE_PREFER_SYSTEM_GRPC "Prefer system-installed gRPC/protobuf over CPM" OFF)
|
||||
|
||||
if(YAZE_PREFER_SYSTEM_GRPC OR YAZE_USE_SYSTEM_DEPS)
|
||||
message(STATUS "Attempting to use system gRPC/protobuf packages...")
|
||||
|
||||
# Try CMake's find_package first (works with Homebrew on macOS)
|
||||
find_package(gRPC CONFIG QUIET)
|
||||
find_package(Protobuf CONFIG QUIET)
|
||||
find_package(absl CONFIG QUIET)
|
||||
|
||||
if(gRPC_FOUND AND Protobuf_FOUND AND absl_FOUND)
|
||||
message(STATUS "✓ Found system gRPC: ${gRPC_VERSION}")
|
||||
message(STATUS "✓ Found system Protobuf: ${Protobuf_VERSION}")
|
||||
message(STATUS "✓ Found system Abseil")
|
||||
|
||||
# Find protoc and grpc_cpp_plugin executables
|
||||
find_program(PROTOC_EXECUTABLE protoc)
|
||||
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
|
||||
|
||||
if(PROTOC_EXECUTABLE AND GRPC_CPP_PLUGIN)
|
||||
message(STATUS "✓ Found protoc: ${PROTOC_EXECUTABLE}")
|
||||
message(STATUS "✓ Found grpc_cpp_plugin: ${GRPC_CPP_PLUGIN}")
|
||||
|
||||
# Create imported targets for the executables if they don't exist
|
||||
if(NOT TARGET protoc)
|
||||
add_executable(protoc IMPORTED)
|
||||
set_target_properties(protoc PROPERTIES IMPORTED_LOCATION "${PROTOC_EXECUTABLE}")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET grpc_cpp_plugin)
|
||||
add_executable(grpc_cpp_plugin IMPORTED)
|
||||
set_target_properties(grpc_cpp_plugin PROPERTIES IMPORTED_LOCATION "${GRPC_CPP_PLUGIN}")
|
||||
endif()
|
||||
|
||||
# Create convenience interface for basic gRPC linking
|
||||
add_library(yaze_grpc_deps INTERFACE)
|
||||
target_link_libraries(yaze_grpc_deps INTERFACE
|
||||
gRPC::grpc++
|
||||
gRPC::grpc++_reflection
|
||||
protobuf::libprotobuf
|
||||
)
|
||||
|
||||
# Ensure Abseil include directories are available
|
||||
# Homebrew's abseil may not properly export include dirs
|
||||
get_target_property(_ABSL_BASE_INCLUDE absl::base INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if(_ABSL_BASE_INCLUDE)
|
||||
target_include_directories(yaze_grpc_deps INTERFACE ${_ABSL_BASE_INCLUDE})
|
||||
message(STATUS " Added Abseil include: ${_ABSL_BASE_INCLUDE}")
|
||||
elseif(APPLE)
|
||||
# Fallback for Homebrew on macOS
|
||||
target_include_directories(yaze_grpc_deps INTERFACE /opt/homebrew/include)
|
||||
message(STATUS " Added Homebrew Abseil include: /opt/homebrew/include")
|
||||
endif()
|
||||
|
||||
# Create interface libraries for compatibility with CPM target names
|
||||
# CPM gRPC creates lowercase 'grpc++' targets
|
||||
# System gRPC (Homebrew) creates namespaced 'gRPC::grpc++' targets
|
||||
# We create interface libs (not aliases) so we can add include directories
|
||||
if(NOT TARGET grpc++)
|
||||
add_library(grpc++ INTERFACE)
|
||||
target_link_libraries(grpc++ INTERFACE gRPC::grpc++)
|
||||
# Add abseil includes for targets linking to grpc++
|
||||
if(_ABSL_BASE_INCLUDE)
|
||||
target_include_directories(grpc++ INTERFACE ${_ABSL_BASE_INCLUDE})
|
||||
elseif(APPLE)
|
||||
target_include_directories(grpc++ INTERFACE /opt/homebrew/include)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT TARGET grpc++_reflection)
|
||||
add_library(grpc++_reflection INTERFACE)
|
||||
target_link_libraries(grpc++_reflection INTERFACE gRPC::grpc++_reflection)
|
||||
endif()
|
||||
if(NOT TARGET grpc::grpc++)
|
||||
add_library(grpc::grpc++ ALIAS gRPC::grpc++)
|
||||
endif()
|
||||
if(NOT TARGET grpc::grpc++_reflection)
|
||||
add_library(grpc::grpc++_reflection ALIAS gRPC::grpc++_reflection)
|
||||
endif()
|
||||
|
||||
# Export targets
|
||||
set(YAZE_GRPC_TARGETS
|
||||
gRPC::grpc++
|
||||
gRPC::grpc++_reflection
|
||||
protobuf::libprotobuf
|
||||
)
|
||||
|
||||
# Setup protobuf generation directory
|
||||
set(_gRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens CACHE INTERNAL "Protobuf generated files directory")
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/gens)
|
||||
|
||||
# Get protobuf include directory from package
|
||||
get_target_property(_PROTOBUF_INCLUDE_DIRS protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if(_PROTOBUF_INCLUDE_DIRS)
|
||||
list(GET _PROTOBUF_INCLUDE_DIRS 0 _gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR)
|
||||
set(_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR ${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR} CACHE INTERNAL "Protobuf include directory")
|
||||
endif()
|
||||
|
||||
# Add global include directories for system packages
|
||||
# This ensures all targets can find abseil headers even if target propagation fails
|
||||
# Use add_compile_options for reliable include path propagation with Ninja Multi-Config
|
||||
if(_ABSL_BASE_INCLUDE)
|
||||
add_compile_options(-I${_ABSL_BASE_INCLUDE})
|
||||
message(STATUS " Added Abseil include via compile options: ${_ABSL_BASE_INCLUDE}")
|
||||
elseif(APPLE)
|
||||
add_compile_options(-I/opt/homebrew/include)
|
||||
message(STATUS " Added Homebrew include via compile options: /opt/homebrew/include")
|
||||
endif()
|
||||
|
||||
message(STATUS "✓ Using SYSTEM gRPC stack - fast configure!")
|
||||
message(STATUS " Protobuf gens dir: ${_gRPC_PROTO_GENS_DIR}")
|
||||
message(STATUS " Protobuf include dir: ${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR}")
|
||||
set(_YAZE_USING_SYSTEM_GRPC TRUE)
|
||||
else()
|
||||
message(STATUS "○ System gRPC found but protoc/grpc_cpp_plugin missing, falling back to CPM")
|
||||
set(_YAZE_USING_SYSTEM_GRPC FALSE)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "○ System gRPC/protobuf not found, falling back to CPM")
|
||||
set(_YAZE_USING_SYSTEM_GRPC FALSE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If we're using system gRPC, skip CPM entirely and jump to function definition
|
||||
if(_YAZE_USING_SYSTEM_GRPC)
|
||||
message(STATUS "Skipping CPM gRPC build - using system packages")
|
||||
else()
|
||||
# CPM build path
|
||||
message(STATUS "Building gRPC from source via CPM (this takes 15-20 minutes on first build)")
|
||||
message(STATUS " Tip: Install gRPC via Homebrew and use -DYAZE_PREFER_SYSTEM_GRPC=ON for faster builds")
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Guard CMake's package lookup so CPM always downloads a consistent gRPC
|
||||
# toolchain instead of picking up partially-installed Homebrew/apt copies.
|
||||
@@ -371,7 +494,10 @@ set(YAZE_PROTOBUF_TARGETS
|
||||
protobuf::libprotobuf
|
||||
)
|
||||
|
||||
endif() # End of CPM build path (if NOT _YAZE_USING_SYSTEM_GRPC)
|
||||
|
||||
# Function to add protobuf/gRPC code generation to a target
|
||||
# This function works with both system and CPM-built gRPC
|
||||
function(target_add_protobuf target)
|
||||
if(NOT TARGET ${target})
|
||||
message(FATAL_ERROR "Target ${target} doesn't exist")
|
||||
@@ -381,6 +507,28 @@ function(target_add_protobuf target)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Determine protoc and grpc_cpp_plugin paths
|
||||
# For IMPORTED targets (system gRPC), use IMPORTED_LOCATION
|
||||
# For built targets (CPM gRPC), use TARGET_FILE generator expression
|
||||
get_target_property(_PROTOC_IMPORTED protoc IMPORTED)
|
||||
get_target_property(_GRPC_PLUGIN_IMPORTED grpc_cpp_plugin IMPORTED)
|
||||
|
||||
if(_PROTOC_IMPORTED)
|
||||
get_target_property(_PROTOC_EXECUTABLE protoc IMPORTED_LOCATION)
|
||||
set(_PROTOC_DEPENDS "") # No build dependency for system protoc
|
||||
else()
|
||||
set(_PROTOC_EXECUTABLE "$<TARGET_FILE:protoc>")
|
||||
set(_PROTOC_DEPENDS "protoc")
|
||||
endif()
|
||||
|
||||
if(_GRPC_PLUGIN_IMPORTED)
|
||||
get_target_property(_GRPC_PLUGIN_EXECUTABLE grpc_cpp_plugin IMPORTED_LOCATION)
|
||||
set(_GRPC_PLUGIN_DEPENDS "") # No build dependency for system plugin
|
||||
else()
|
||||
set(_GRPC_PLUGIN_EXECUTABLE "$<TARGET_FILE:grpc_cpp_plugin>")
|
||||
set(_GRPC_PLUGIN_DEPENDS "grpc_cpp_plugin")
|
||||
endif()
|
||||
|
||||
set(_protobuf_include_path -I ${CMAKE_SOURCE_DIR}/src -I ${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR})
|
||||
foreach(FIL ${ARGN})
|
||||
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
|
||||
@@ -392,7 +540,7 @@ function(target_add_protobuf target)
|
||||
else()
|
||||
set(RELFIL_WE "${REL_DIR}/${FIL_WE}")
|
||||
endif()
|
||||
|
||||
|
||||
message(STATUS " Proto file: ${FIL_WE}")
|
||||
message(STATUS " ABS_FIL = ${ABS_FIL}")
|
||||
message(STATUS " REL_FIL = ${REL_FIL}")
|
||||
@@ -406,13 +554,13 @@ function(target_add_protobuf target)
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h"
|
||||
COMMAND $<TARGET_FILE:protoc>
|
||||
COMMAND ${_PROTOC_EXECUTABLE}
|
||||
ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR}
|
||||
--cpp_out=${_gRPC_PROTO_GENS_DIR}
|
||||
--plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin>
|
||||
--plugin=protoc-gen-grpc=${_GRPC_PLUGIN_EXECUTABLE}
|
||||
${_protobuf_include_path}
|
||||
${ABS_FIL}
|
||||
DEPENDS ${ABS_FIL} protoc grpc_cpp_plugin
|
||||
DEPENDS ${ABS_FIL} ${_PROTOC_DEPENDS} ${_GRPC_PLUGIN_DEPENDS}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src
|
||||
COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}"
|
||||
VERBATIM)
|
||||
|
||||
@@ -6,6 +6,21 @@ message(STATUS "Setting up Dear ImGui from bundled sources")
|
||||
# Use the bundled ImGui from ext/imgui
|
||||
set(IMGUI_DIR ${CMAKE_SOURCE_DIR}/ext/imgui)
|
||||
|
||||
# Select ImGui backend sources based on SDL version
|
||||
if(YAZE_USE_SDL3)
|
||||
set(IMGUI_BACKEND_SOURCES
|
||||
${IMGUI_DIR}/backends/imgui_impl_sdl3.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_sdlrenderer3.cpp
|
||||
)
|
||||
message(STATUS "Using ImGui SDL3 backend")
|
||||
else()
|
||||
set(IMGUI_BACKEND_SOURCES
|
||||
${IMGUI_DIR}/backends/imgui_impl_sdl2.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_sdlrenderer2.cpp
|
||||
)
|
||||
message(STATUS "Using ImGui SDL2 backend")
|
||||
endif()
|
||||
|
||||
# Create ImGui library with core files from bundled source
|
||||
add_library(ImGui STATIC
|
||||
${IMGUI_DIR}/imgui.cpp
|
||||
@@ -13,9 +28,8 @@ add_library(ImGui STATIC
|
||||
${IMGUI_DIR}/imgui_draw.cpp
|
||||
${IMGUI_DIR}/imgui_tables.cpp
|
||||
${IMGUI_DIR}/imgui_widgets.cpp
|
||||
# SDL2 backend
|
||||
${IMGUI_DIR}/backends/imgui_impl_sdl2.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_sdlrenderer2.cpp
|
||||
# SDL backend (version-dependent)
|
||||
${IMGUI_BACKEND_SOURCES}
|
||||
# C++ stdlib helpers (for std::string support)
|
||||
${IMGUI_DIR}/misc/cpp/imgui_stdlib.cpp
|
||||
)
|
||||
@@ -28,8 +42,12 @@ target_include_directories(ImGui PUBLIC
|
||||
# Set C++ standard requirement (ImGui 1.90+ requires C++11, we use C++17 for consistency)
|
||||
target_compile_features(ImGui PUBLIC cxx_std_17)
|
||||
|
||||
# Link to SDL2
|
||||
target_link_libraries(ImGui PUBLIC ${YAZE_SDL2_TARGETS})
|
||||
# Link to SDL (version-dependent)
|
||||
if(YAZE_USE_SDL3)
|
||||
target_link_libraries(ImGui PUBLIC ${YAZE_SDL3_TARGETS})
|
||||
else()
|
||||
target_link_libraries(ImGui PUBLIC ${YAZE_SDL2_TARGETS})
|
||||
endif()
|
||||
|
||||
message(STATUS "Created ImGui target from bundled source at ${IMGUI_DIR}")
|
||||
|
||||
@@ -56,7 +74,11 @@ if(YAZE_BUILD_TESTS)
|
||||
${CMAKE_SOURCE_DIR}/ext
|
||||
)
|
||||
target_compile_features(ImGuiTestEngine PUBLIC cxx_std_17)
|
||||
target_link_libraries(ImGuiTestEngine PUBLIC ImGui ${YAZE_SDL2_TARGETS})
|
||||
if(YAZE_USE_SDL3)
|
||||
target_link_libraries(ImGuiTestEngine PUBLIC ImGui ${YAZE_SDL3_TARGETS})
|
||||
else()
|
||||
target_link_libraries(ImGuiTestEngine PUBLIC ImGui ${YAZE_SDL2_TARGETS})
|
||||
endif()
|
||||
target_compile_definitions(ImGuiTestEngine PUBLIC
|
||||
IMGUI_ENABLE_TEST_ENGINE=1
|
||||
IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL=1
|
||||
|
||||
110
cmake/dependencies/sdl3.cmake
Normal file
110
cmake/dependencies/sdl3.cmake
Normal file
@@ -0,0 +1,110 @@
|
||||
# SDL3 dependency management
|
||||
# Uses CPM.cmake for consistent cross-platform builds
|
||||
|
||||
include(cmake/CPM.cmake)
|
||||
include(cmake/dependencies.lock)
|
||||
|
||||
message(STATUS "Setting up SDL3 (experimental) with CPM.cmake")
|
||||
|
||||
# SDL3 specific version (using latest stable 3.2 release)
|
||||
set(SDL3_VERSION "3.2.26")
|
||||
|
||||
# Try to use system packages first if requested
|
||||
if(YAZE_USE_SYSTEM_DEPS)
|
||||
find_package(SDL3 QUIET)
|
||||
if(SDL3_FOUND)
|
||||
message(STATUS "Using system SDL3")
|
||||
if(NOT TARGET yaze_sdl3)
|
||||
add_library(yaze_sdl3 INTERFACE)
|
||||
target_link_libraries(yaze_sdl3 INTERFACE SDL3::SDL3)
|
||||
if(TARGET SDL3::SDL3main)
|
||||
target_link_libraries(yaze_sdl3 INTERFACE SDL3::SDL3main)
|
||||
endif()
|
||||
endif()
|
||||
set(YAZE_SDL3_TARGETS yaze_sdl3 CACHE INTERNAL "")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use CPM to fetch SDL3
|
||||
CPMAddPackage(
|
||||
NAME SDL3
|
||||
VERSION ${SDL3_VERSION}
|
||||
GITHUB_REPOSITORY libsdl-org/SDL
|
||||
GIT_TAG release-${SDL3_VERSION}
|
||||
OPTIONS
|
||||
"SDL_SHARED OFF"
|
||||
"SDL_STATIC ON"
|
||||
"SDL_TEST OFF"
|
||||
"SDL_INSTALL OFF"
|
||||
"SDL_CMAKE_DEBUG_POSTFIX d"
|
||||
"SDL3_DISABLE_INSTALL ON"
|
||||
"SDL3_DISABLE_UNINSTALL ON"
|
||||
)
|
||||
|
||||
# Verify SDL3 targets are available
|
||||
if(NOT TARGET SDL3-static AND NOT TARGET SDL3::SDL3-static AND NOT TARGET SDL3::SDL3)
|
||||
message(FATAL_ERROR "SDL3 target not found after CPM fetch")
|
||||
endif()
|
||||
|
||||
# Create convenience targets for the rest of the project
|
||||
if(NOT TARGET yaze_sdl3)
|
||||
add_library(yaze_sdl3 INTERFACE)
|
||||
# SDL3 from CPM might use SDL3-static or SDL3::SDL3-static
|
||||
if(TARGET SDL3-static)
|
||||
message(STATUS "Using SDL3-static target")
|
||||
target_link_libraries(yaze_sdl3 INTERFACE SDL3-static)
|
||||
# Also explicitly add include directories if they exist
|
||||
if(SDL3_SOURCE_DIR)
|
||||
target_include_directories(yaze_sdl3 INTERFACE ${SDL3_SOURCE_DIR}/include)
|
||||
message(STATUS "Added SDL3 include: ${SDL3_SOURCE_DIR}/include")
|
||||
endif()
|
||||
elseif(TARGET SDL3::SDL3-static)
|
||||
message(STATUS "Using SDL3::SDL3-static target")
|
||||
target_link_libraries(yaze_sdl3 INTERFACE SDL3::SDL3-static)
|
||||
# For local Homebrew SDL3, also add include path explicitly
|
||||
if(APPLE AND EXISTS "/opt/homebrew/opt/sdl3/include/SDL3")
|
||||
target_include_directories(yaze_sdl3 INTERFACE /opt/homebrew/opt/sdl3/include/SDL3)
|
||||
message(STATUS "Added Homebrew SDL3 include path: /opt/homebrew/opt/sdl3/include/SDL3")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using SDL3::SDL3 target")
|
||||
target_link_libraries(yaze_sdl3 INTERFACE SDL3::SDL3)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Add platform-specific libraries
|
||||
if(WIN32)
|
||||
target_link_libraries(yaze_sdl3 INTERFACE
|
||||
winmm
|
||||
imm32
|
||||
version
|
||||
setupapi
|
||||
wbemuuid
|
||||
)
|
||||
target_compile_definitions(yaze_sdl3 INTERFACE SDL_MAIN_HANDLED)
|
||||
elseif(APPLE)
|
||||
target_link_libraries(yaze_sdl3 INTERFACE
|
||||
"-framework Cocoa"
|
||||
"-framework IOKit"
|
||||
"-framework CoreVideo"
|
||||
"-framework CoreHaptics"
|
||||
"-framework ForceFeedback"
|
||||
"-framework GameController"
|
||||
)
|
||||
target_compile_definitions(yaze_sdl3 INTERFACE SDL_MAIN_HANDLED)
|
||||
elseif(UNIX)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
||||
target_link_libraries(yaze_sdl3 INTERFACE ${GTK3_LIBRARIES})
|
||||
target_include_directories(yaze_sdl3 INTERFACE ${GTK3_INCLUDE_DIRS})
|
||||
target_compile_options(yaze_sdl3 INTERFACE ${GTK3_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
# Export SDL3 targets for use in other CMake files
|
||||
set(YAZE_SDL3_TARGETS yaze_sdl3)
|
||||
|
||||
# Set a flag to indicate SDL3 is being used
|
||||
set(YAZE_SDL2_TARGETS ${YAZE_SDL3_TARGETS}) # For compatibility with existing code
|
||||
|
||||
message(STATUS "SDL3 setup complete - YAZE_SDL3_TARGETS = ${YAZE_SDL3_TARGETS}")
|
||||
@@ -52,8 +52,22 @@ if(_YAZE_USE_SYSTEM_YAML)
|
||||
find_package(yaml-cpp QUIET)
|
||||
if(yaml-cpp_FOUND)
|
||||
message(STATUS "Using system yaml-cpp")
|
||||
add_library(yaze_yaml INTERFACE IMPORTED)
|
||||
target_link_libraries(yaze_yaml INTERFACE yaml-cpp)
|
||||
add_library(yaze_yaml INTERFACE)
|
||||
if(TARGET yaml-cpp::yaml-cpp)
|
||||
message(STATUS "Linking yaze_yaml against yaml-cpp::yaml-cpp")
|
||||
target_link_libraries(yaze_yaml INTERFACE yaml-cpp::yaml-cpp)
|
||||
|
||||
# HACK: Explicitly add the library directory for Homebrew if detected
|
||||
# This fixes 'ld: library not found for -lyaml-cpp' when the imported target
|
||||
# doesn't propagate the library path correctly to the linker command line
|
||||
if(EXISTS "/opt/homebrew/opt/yaml-cpp/lib")
|
||||
link_directories("/opt/homebrew/opt/yaml-cpp/lib")
|
||||
message(STATUS "Added yaml-cpp link directory: /opt/homebrew/opt/yaml-cpp/lib")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Linking yaze_yaml against yaml-cpp (legacy)")
|
||||
target_link_libraries(yaze_yaml INTERFACE yaml-cpp)
|
||||
endif()
|
||||
set(YAZE_YAML_TARGETS yaze_yaml)
|
||||
return()
|
||||
elseif(YAZE_USE_SYSTEM_DEPS)
|
||||
|
||||
@@ -12,7 +12,7 @@ option(YAZE_BUILD_TESTS "Build test suite" ON)
|
||||
# Feature flags
|
||||
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)
|
||||
option(YAZE_ENABLE_AI "Enable AI agent features" OFF)
|
||||
|
||||
# Advanced feature toggles
|
||||
option(YAZE_ENABLE_REMOTE_AUTOMATION
|
||||
@@ -48,9 +48,11 @@ option(YAZE_UNITY_BUILD "Enable Unity (Jumbo) builds" OFF)
|
||||
# Platform-specific options
|
||||
option(YAZE_USE_VCPKG "Use vcpkg for Windows dependencies" OFF)
|
||||
option(YAZE_USE_SYSTEM_DEPS "Use system package manager for dependencies" OFF)
|
||||
option(YAZE_USE_SDL3 "Use SDL3 instead of SDL2 (experimental)" OFF)
|
||||
|
||||
# Development options
|
||||
option(YAZE_ENABLE_ROM_TESTS "Enable tests that require ROM files" OFF)
|
||||
option(YAZE_ENABLE_BENCHMARK_TESTS "Enable benchmark/performance tests" OFF)
|
||||
option(YAZE_MINIMAL_BUILD "Minimal build for CI (disable optional features)" OFF)
|
||||
option(YAZE_VERBOSE_BUILD "Verbose build output" OFF)
|
||||
|
||||
@@ -103,6 +105,11 @@ 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}")
|
||||
if(YAZE_USE_SDL3)
|
||||
message(STATUS "SDL Version: SDL3 (experimental)")
|
||||
else()
|
||||
message(STATUS "SDL Version: SDL2 (stable)")
|
||||
endif()
|
||||
message(STATUS "gRPC Support: ${YAZE_ENABLE_GRPC}")
|
||||
message(STATUS "Remote Automation: ${YAZE_ENABLE_REMOTE_AUTOMATION}")
|
||||
message(STATUS "JSON Support: ${YAZE_ENABLE_JSON}")
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
# CPack Configuration
|
||||
# Cross-platform packaging using CPack
|
||||
# NOTE: include(CPack) MUST be called at the END of this file,
|
||||
# after all CPACK_ variables and install() rules are defined.
|
||||
# CPack Configuration - flat packages for all platforms
|
||||
#
|
||||
# Structure:
|
||||
# root/
|
||||
# yaze(.exe)
|
||||
# z3ed(.exe) (if built)
|
||||
# README.md
|
||||
# LICENSE
|
||||
# assets/...
|
||||
|
||||
# Set package information
|
||||
set(CPACK_PACKAGE_NAME "yaze")
|
||||
set(CPACK_PACKAGE_VENDOR "scawful")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Yet Another Zelda3 Editor")
|
||||
@@ -11,82 +15,93 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${YAZE_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${YAZE_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${YAZE_VERSION_PATCH})
|
||||
set(CPACK_PACKAGE_VERSION "${YAZE_VERSION_MAJOR}.${YAZE_VERSION_MINOR}.${YAZE_VERSION_PATCH}")
|
||||
|
||||
# Set package directory
|
||||
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/packages")
|
||||
|
||||
# Platform-specific packaging
|
||||
if(APPLE)
|
||||
include(cmake/packaging/macos.cmake)
|
||||
elseif(WIN32)
|
||||
include(cmake/packaging/windows.cmake)
|
||||
elseif(UNIX)
|
||||
include(cmake/packaging/linux.cmake)
|
||||
endif()
|
||||
|
||||
# Common files to include
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
|
||||
|
||||
# Set default component
|
||||
set(CPACK_COMPONENTS_ALL yaze)
|
||||
set(CPACK_COMPONENT_YAZE_DISPLAY_NAME "YAZE Editor")
|
||||
set(CPACK_COMPONENT_YAZE_DESCRIPTION "Main YAZE application and libraries")
|
||||
|
||||
# Install rules - these define what CPack packages
|
||||
include(GNUInstallDirs)
|
||||
# Populate runtime library list (needed on Windows)
|
||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
|
||||
set(CMAKE_INSTALL_UCRT_LIBRARIES ON)
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
||||
# Platform-specific install paths
|
||||
# The asset paths must match what platform_paths.cc FindAsset() searches for
|
||||
if(WIN32)
|
||||
# Windows: flat structure (exe and assets/ at same level)
|
||||
set(YAZE_INSTALL_BINDIR ".")
|
||||
set(YAZE_INSTALL_DATADIR ".")
|
||||
set(YAZE_INSTALL_DOCDIR ".")
|
||||
elseif(APPLE)
|
||||
# macOS: flat structure for DMG (app bundle handles its own resources)
|
||||
set(YAZE_INSTALL_BINDIR ".")
|
||||
set(YAZE_INSTALL_DATADIR ".")
|
||||
set(YAZE_INSTALL_DOCDIR ".")
|
||||
else()
|
||||
# Linux: FHS structure - assets at share/yaze/assets (matches FindAsset search)
|
||||
set(YAZE_INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR})
|
||||
set(YAZE_INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}/yaze")
|
||||
set(YAZE_INSTALL_DOCDIR "${CMAKE_INSTALL_DOCDIR}")
|
||||
endif()
|
||||
|
||||
# Install main executable
|
||||
if(APPLE)
|
||||
include(cmake/packaging/macos.cmake)
|
||||
|
||||
install(TARGETS yaze
|
||||
RUNTIME DESTINATION ${YAZE_INSTALL_BINDIR}
|
||||
BUNDLE DESTINATION .
|
||||
COMPONENT yaze
|
||||
)
|
||||
else()
|
||||
COMPONENT yaze)
|
||||
|
||||
if(TARGET z3ed)
|
||||
install(TARGETS z3ed
|
||||
RUNTIME DESTINATION .
|
||||
COMPONENT yaze)
|
||||
endif()
|
||||
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/assets/
|
||||
DESTINATION assets
|
||||
COMPONENT yaze)
|
||||
|
||||
install(FILES
|
||||
${CMAKE_SOURCE_DIR}/README.md
|
||||
${CMAKE_SOURCE_DIR}/LICENSE
|
||||
DESTINATION .
|
||||
COMPONENT yaze)
|
||||
|
||||
elseif(WIN32)
|
||||
include(cmake/packaging/windows.cmake)
|
||||
|
||||
install(TARGETS yaze
|
||||
RUNTIME DESTINATION ${YAZE_INSTALL_BINDIR}
|
||||
COMPONENT yaze
|
||||
)
|
||||
RUNTIME DESTINATION .
|
||||
COMPONENT yaze)
|
||||
|
||||
if(TARGET z3ed)
|
||||
install(TARGETS z3ed
|
||||
RUNTIME DESTINATION .
|
||||
COMPONENT yaze)
|
||||
endif()
|
||||
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/assets/
|
||||
DESTINATION assets
|
||||
COMPONENT yaze)
|
||||
|
||||
install(FILES
|
||||
${CMAKE_SOURCE_DIR}/README.md
|
||||
${CMAKE_SOURCE_DIR}/LICENSE
|
||||
DESTINATION .
|
||||
COMPONENT yaze)
|
||||
|
||||
if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
|
||||
install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
|
||||
DESTINATION .
|
||||
COMPONENT yaze)
|
||||
endif()
|
||||
|
||||
else()
|
||||
include(cmake/packaging/linux.cmake)
|
||||
|
||||
install(TARGETS yaze
|
||||
RUNTIME DESTINATION .
|
||||
COMPONENT yaze)
|
||||
|
||||
if(TARGET z3ed)
|
||||
install(TARGETS z3ed
|
||||
RUNTIME DESTINATION .
|
||||
COMPONENT yaze)
|
||||
endif()
|
||||
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/assets/
|
||||
DESTINATION assets
|
||||
COMPONENT yaze)
|
||||
|
||||
install(FILES
|
||||
${CMAKE_SOURCE_DIR}/README.md
|
||||
${CMAKE_SOURCE_DIR}/LICENSE
|
||||
DESTINATION .
|
||||
COMPONENT yaze)
|
||||
endif()
|
||||
|
||||
# Install assets
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/assets/
|
||||
DESTINATION ${YAZE_INSTALL_DATADIR}/assets
|
||||
COMPONENT yaze
|
||||
PATTERN "*.png"
|
||||
PATTERN "*.ttf"
|
||||
PATTERN "*.asm"
|
||||
)
|
||||
|
||||
# Install documentation
|
||||
install(FILES
|
||||
${CMAKE_SOURCE_DIR}/README.md
|
||||
${CMAKE_SOURCE_DIR}/LICENSE
|
||||
DESTINATION ${YAZE_INSTALL_DOCDIR}
|
||||
COMPONENT yaze
|
||||
)
|
||||
|
||||
# IMPORTANT: include(CPack) must be called LAST, after all CPACK_ variables
|
||||
# and install() rules are defined. This is a CPack requirement.
|
||||
include(CPack)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user