chore: enhance clangd and CI configurations for improved development experience
- Updated `.clangd` configuration to include additional include paths and feature flags tailored for ROM hacking workflows, optimizing IntelliSense support. - Introduced `.pre-commit-config.yaml` for managing code quality checks and formatting, ensuring consistent code style across the project. - Added `cmake-format.yaml` for CMake formatting configuration, promoting adherence to style guidelines. - Enhanced CI workflows to include new actions for testing and building, improving overall reliability and efficiency in the development process. Benefits: - Streamlines development setup and improves code quality through automated checks. - Facilitates better collaboration by ensuring consistent coding standards and configurations.
This commit is contained in:
35
cmake/dependencies/ftxui.cmake
Normal file
35
cmake/dependencies/ftxui.cmake
Normal file
@@ -0,0 +1,35 @@
|
||||
# FTXUI dependency management for CLI tools
|
||||
# Uses CPM.cmake for consistent cross-platform builds
|
||||
|
||||
if(NOT YAZE_BUILD_CLI)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(cmake/CPM.cmake)
|
||||
include(cmake/dependencies.lock)
|
||||
|
||||
message(STATUS "Setting up FTXUI ${FTXUI_VERSION} with CPM.cmake")
|
||||
|
||||
# Use CPM to fetch FTXUI
|
||||
CPMAddPackage(
|
||||
NAME ftxui
|
||||
VERSION ${FTXUI_VERSION}
|
||||
GITHUB_REPOSITORY ArthurSonzogni/ftxui
|
||||
GIT_TAG v${FTXUI_VERSION}
|
||||
OPTIONS
|
||||
"FTXUI_BUILD_EXAMPLES OFF"
|
||||
"FTXUI_BUILD_TESTS OFF"
|
||||
"FTXUI_ENABLE_INSTALL OFF"
|
||||
)
|
||||
|
||||
# FTXUI targets are created during the build phase
|
||||
# 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
|
||||
|
||||
# Export FTXUI targets for use in other CMake files
|
||||
set(YAZE_FTXUI_TARGETS yaze_ftxui)
|
||||
|
||||
message(STATUS "FTXUI setup complete")
|
||||
98
cmake/dependencies/grpc.cmake
Normal file
98
cmake/dependencies/grpc.cmake
Normal file
@@ -0,0 +1,98 @@
|
||||
# gRPC and Protobuf dependency management
|
||||
# Uses CPM.cmake for consistent cross-platform builds
|
||||
|
||||
if(NOT YAZE_ENABLE_GRPC)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Include CPM and dependencies lock
|
||||
include(cmake/CPM.cmake)
|
||||
include(cmake/dependencies.lock)
|
||||
|
||||
message(STATUS "Setting up gRPC ${GRPC_VERSION} with CPM.cmake")
|
||||
|
||||
# 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()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use CPM to fetch gRPC with bundled dependencies
|
||||
CPMAddPackage(
|
||||
NAME grpc
|
||||
VERSION ${GRPC_VERSION}
|
||||
GITHUB_REPOSITORY grpc/grpc
|
||||
GIT_TAG v${GRPC_VERSION}
|
||||
OPTIONS
|
||||
"gRPC_BUILD_TESTS OFF"
|
||||
"gRPC_BUILD_CODEGEN ON"
|
||||
"gRPC_BUILD_GRPC_CPP_PLUGIN ON"
|
||||
"gRPC_BUILD_CSHARP_EXT OFF"
|
||||
"gRPC_BUILD_GRPC_CSHARP_PLUGIN OFF"
|
||||
"gRPC_BUILD_GRPC_NODE_PLUGIN OFF"
|
||||
"gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN OFF"
|
||||
"gRPC_BUILD_GRPC_PHP_PLUGIN OFF"
|
||||
"gRPC_BUILD_GRPC_PYTHON_PLUGIN OFF"
|
||||
"gRPC_BUILD_GRPC_RUBY_PLUGIN OFF"
|
||||
"gRPC_BUILD_REFLECTION OFF"
|
||||
"gRPC_BUILD_GRPC_REFLECTION OFF"
|
||||
"gRPC_BUILD_GRPC_CPP_REFLECTION OFF"
|
||||
"gRPC_BUILD_GRPCPP_REFLECTION OFF"
|
||||
"gRPC_BENCHMARK_PROVIDER none"
|
||||
"gRPC_ZLIB_PROVIDER package"
|
||||
"gRPC_PROTOBUF_PROVIDER module"
|
||||
"gRPC_ABSL_PROVIDER module"
|
||||
"protobuf_BUILD_TESTS OFF"
|
||||
"protobuf_BUILD_CONFORMANCE OFF"
|
||||
"protobuf_BUILD_EXAMPLES OFF"
|
||||
"protobuf_BUILD_PROTOC_BINARIES ON"
|
||||
"protobuf_WITH_ZLIB ON"
|
||||
"ABSL_PROPAGATE_CXX_STD ON"
|
||||
"ABSL_ENABLE_INSTALL ON"
|
||||
"ABSL_BUILD_TESTING OFF"
|
||||
"utf8_range_BUILD_TESTS OFF"
|
||||
"utf8_range_INSTALL OFF"
|
||||
)
|
||||
|
||||
# Verify gRPC targets are available
|
||||
if(NOT TARGET grpc::grpc++)
|
||||
message(FATAL_ERROR "gRPC target not found after CPM fetch")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET protoc)
|
||||
message(FATAL_ERROR "protoc target not found after gRPC setup")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET grpc_cpp_plugin)
|
||||
message(FATAL_ERROR "grpc_cpp_plugin target not found after gRPC setup")
|
||||
endif()
|
||||
|
||||
# Create convenience targets for the rest of the project
|
||||
add_library(yaze_grpc_support INTERFACE)
|
||||
target_link_libraries(yaze_grpc_support INTERFACE
|
||||
grpc::grpc++
|
||||
grpc::grpc++_reflection
|
||||
protobuf::libprotobuf
|
||||
)
|
||||
|
||||
# Export gRPC targets for use in other CMake files
|
||||
set(YAZE_GRPC_TARGETS
|
||||
grpc::grpc++
|
||||
grpc::grpc++_reflection
|
||||
protobuf::libprotobuf
|
||||
protoc
|
||||
grpc_cpp_plugin
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
message(STATUS "gRPC setup complete - targets available: ${YAZE_GRPC_TARGETS}")
|
||||
39
cmake/dependencies/imgui.cmake
Normal file
39
cmake/dependencies/imgui.cmake
Normal file
@@ -0,0 +1,39 @@
|
||||
# Dear ImGui dependency management
|
||||
# Uses CPM.cmake for consistent cross-platform builds
|
||||
|
||||
include(cmake/CPM.cmake)
|
||||
include(cmake/dependencies.lock)
|
||||
|
||||
message(STATUS "Setting up Dear ImGui ${IMGUI_VERSION} with CPM.cmake")
|
||||
|
||||
# Use CPM to fetch Dear ImGui
|
||||
CPMAddPackage(
|
||||
NAME imgui
|
||||
VERSION ${IMGUI_VERSION}
|
||||
GITHUB_REPOSITORY ocornut/imgui
|
||||
GIT_TAG v${IMGUI_VERSION}
|
||||
OPTIONS
|
||||
"IMGUI_BUILD_EXAMPLES OFF"
|
||||
"IMGUI_BUILD_DEMO OFF"
|
||||
)
|
||||
|
||||
# ImGui doesn't create targets during CPM fetch, they're created during build
|
||||
# We'll create our own interface target and link to ImGui when it's available
|
||||
add_library(yaze_imgui INTERFACE)
|
||||
|
||||
# Note: ImGui targets will be available after the build phase
|
||||
# For now, we'll create a placeholder that can be linked later
|
||||
|
||||
# Add platform-specific backends
|
||||
if(TARGET imgui_impl_sdl2)
|
||||
target_link_libraries(yaze_imgui INTERFACE imgui_impl_sdl2)
|
||||
endif()
|
||||
|
||||
if(TARGET imgui_impl_opengl3)
|
||||
target_link_libraries(yaze_imgui INTERFACE imgui_impl_opengl3)
|
||||
endif()
|
||||
|
||||
# Export ImGui targets for use in other CMake files
|
||||
set(YAZE_IMGUI_TARGETS yaze_imgui)
|
||||
|
||||
message(STATUS "Dear ImGui setup complete")
|
||||
76
cmake/dependencies/sdl2.cmake
Normal file
76
cmake/dependencies/sdl2.cmake
Normal file
@@ -0,0 +1,76 @@
|
||||
# SDL2 dependency management
|
||||
# Uses CPM.cmake for consistent cross-platform builds
|
||||
|
||||
include(cmake/CPM.cmake)
|
||||
include(cmake/dependencies.lock)
|
||||
|
||||
message(STATUS "Setting up SDL2 ${SDL2_VERSION} with CPM.cmake")
|
||||
|
||||
# Try to use system packages first if requested
|
||||
if(YAZE_USE_SYSTEM_DEPS)
|
||||
find_package(SDL2 QUIET)
|
||||
if(SDL2_FOUND)
|
||||
message(STATUS "Using system SDL2")
|
||||
add_library(yaze_sdl2 INTERFACE IMPORTED)
|
||||
target_link_libraries(yaze_sdl2 INTERFACE SDL2::SDL2)
|
||||
if(TARGET SDL2::SDL2main)
|
||||
target_link_libraries(yaze_sdl2 INTERFACE SDL2::SDL2main)
|
||||
endif()
|
||||
set(YAZE_SDL2_TARGETS yaze_sdl2 PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use CPM to fetch SDL2
|
||||
CPMAddPackage(
|
||||
NAME SDL2
|
||||
VERSION ${SDL2_VERSION}
|
||||
GITHUB_REPOSITORY libsdl-org/SDL
|
||||
GIT_TAG release-${SDL2_VERSION}
|
||||
OPTIONS
|
||||
"SDL_SHARED OFF"
|
||||
"SDL_STATIC ON"
|
||||
"SDL_TEST OFF"
|
||||
"SDL_INSTALL OFF"
|
||||
"SDL_CMAKE_DEBUG_POSTFIX d"
|
||||
)
|
||||
|
||||
# Verify SDL2 targets are available
|
||||
if(NOT TARGET SDL2::SDL2)
|
||||
message(FATAL_ERROR "SDL2 target not found after CPM fetch")
|
||||
endif()
|
||||
|
||||
# Create convenience targets for the rest of the project
|
||||
add_library(yaze_sdl2 INTERFACE)
|
||||
target_link_libraries(yaze_sdl2 INTERFACE SDL2::SDL2)
|
||||
|
||||
# Add platform-specific libraries
|
||||
if(WIN32)
|
||||
target_link_libraries(yaze_sdl2 INTERFACE
|
||||
winmm
|
||||
imm32
|
||||
version
|
||||
setupapi
|
||||
wbemuuid
|
||||
)
|
||||
target_compile_definitions(yaze_sdl2 INTERFACE SDL_MAIN_HANDLED)
|
||||
elseif(APPLE)
|
||||
target_link_libraries(yaze_sdl2 INTERFACE
|
||||
"-framework Cocoa"
|
||||
"-framework IOKit"
|
||||
"-framework CoreVideo"
|
||||
"-framework ForceFeedback"
|
||||
)
|
||||
target_compile_definitions(yaze_sdl2 INTERFACE SDL_MAIN_HANDLED)
|
||||
elseif(UNIX)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
||||
target_link_libraries(yaze_sdl2 INTERFACE ${GTK3_LIBRARIES})
|
||||
target_include_directories(yaze_sdl2 INTERFACE ${GTK3_INCLUDE_DIRS})
|
||||
target_compile_options(yaze_sdl2 INTERFACE ${GTK3_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
# Export SDL2 targets for use in other CMake files
|
||||
set(YAZE_SDL2_TARGETS yaze_sdl2)
|
||||
|
||||
message(STATUS "SDL2 setup complete")
|
||||
60
cmake/dependencies/testing.cmake
Normal file
60
cmake/dependencies/testing.cmake
Normal file
@@ -0,0 +1,60 @@
|
||||
# Testing dependencies (GTest, Benchmark)
|
||||
# Uses CPM.cmake for consistent cross-platform builds
|
||||
|
||||
if(NOT YAZE_BUILD_TESTS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(cmake/CPM.cmake)
|
||||
include(cmake/dependencies.lock)
|
||||
|
||||
message(STATUS "Setting up testing dependencies with CPM.cmake")
|
||||
|
||||
# Google Test
|
||||
CPMAddPackage(
|
||||
NAME googletest
|
||||
VERSION ${GTEST_VERSION}
|
||||
GITHUB_REPOSITORY google/googletest
|
||||
GIT_TAG v${GTEST_VERSION}
|
||||
OPTIONS
|
||||
"BUILD_GMOCK OFF"
|
||||
"INSTALL_GTEST OFF"
|
||||
"gtest_force_shared_crt ON"
|
||||
)
|
||||
|
||||
# Verify GTest targets are available
|
||||
if(NOT TARGET gtest)
|
||||
message(FATAL_ERROR "GTest target not found after CPM fetch")
|
||||
endif()
|
||||
|
||||
# Google Benchmark (optional, for performance tests)
|
||||
if(YAZE_ENABLE_COVERAGE OR DEFINED ENV{YAZE_ENABLE_BENCHMARKS})
|
||||
CPMAddPackage(
|
||||
NAME benchmark
|
||||
VERSION ${BENCHMARK_VERSION}
|
||||
GITHUB_REPOSITORY google/benchmark
|
||||
GIT_TAG v${BENCHMARK_VERSION}
|
||||
OPTIONS
|
||||
"BENCHMARK_ENABLE_TESTING OFF"
|
||||
"BENCHMARK_ENABLE_INSTALL OFF"
|
||||
)
|
||||
|
||||
if(NOT TARGET benchmark::benchmark)
|
||||
message(FATAL_ERROR "Benchmark target not found after CPM fetch")
|
||||
endif()
|
||||
|
||||
set(YAZE_BENCHMARK_TARGETS benchmark::benchmark PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# Create convenience targets for the rest of the project
|
||||
add_library(yaze_testing INTERFACE)
|
||||
target_link_libraries(yaze_testing INTERFACE gtest)
|
||||
|
||||
if(TARGET benchmark::benchmark)
|
||||
target_link_libraries(yaze_testing INTERFACE benchmark::benchmark)
|
||||
endif()
|
||||
|
||||
# Export testing targets for use in other CMake files
|
||||
set(YAZE_TESTING_TARGETS yaze_testing)
|
||||
|
||||
message(STATUS "Testing dependencies setup complete")
|
||||
46
cmake/dependencies/yaml.cmake
Normal file
46
cmake/dependencies/yaml.cmake
Normal file
@@ -0,0 +1,46 @@
|
||||
# yaml-cpp dependency management
|
||||
# Uses CPM.cmake for consistent cross-platform builds
|
||||
|
||||
include(cmake/CPM.cmake)
|
||||
include(cmake/dependencies.lock)
|
||||
|
||||
message(STATUS "Setting up yaml-cpp ${YAML_CPP_VERSION} with CPM.cmake")
|
||||
|
||||
# Try to use system packages first if requested
|
||||
if(YAZE_USE_SYSTEM_DEPS)
|
||||
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)
|
||||
set(YAZE_YAML_TARGETS yaze_yaml PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use CPM to fetch yaml-cpp
|
||||
CPMAddPackage(
|
||||
NAME yaml-cpp
|
||||
VERSION ${YAML_CPP_VERSION}
|
||||
GITHUB_REPOSITORY jbeder/yaml-cpp
|
||||
GIT_TAG 0.8.0
|
||||
OPTIONS
|
||||
"YAML_CPP_BUILD_TESTS OFF"
|
||||
"YAML_CPP_BUILD_CONTRIB OFF"
|
||||
"YAML_CPP_BUILD_TOOLS OFF"
|
||||
"YAML_CPP_INSTALL OFF"
|
||||
)
|
||||
|
||||
# Verify yaml-cpp targets are available
|
||||
if(NOT TARGET yaml-cpp)
|
||||
message(FATAL_ERROR "yaml-cpp target not found after CPM fetch")
|
||||
endif()
|
||||
|
||||
# Create convenience targets for the rest of the project
|
||||
add_library(yaze_yaml INTERFACE)
|
||||
target_link_libraries(yaze_yaml INTERFACE yaml-cpp)
|
||||
|
||||
# Export yaml-cpp targets for use in other CMake files
|
||||
set(YAZE_YAML_TARGETS yaze_yaml)
|
||||
|
||||
message(STATUS "yaml-cpp setup complete")
|
||||
Reference in New Issue
Block a user