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:
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")
|
||||
Reference in New Issue
Block a user