- Added new entries to `.pre-commit-config.yaml`, `cmake-format.yaml`, and `.github/dependabot.yml` to improve code quality checks and dependency updates. - Enhanced GitHub Actions workflows by adding new steps for testing and build retention. - Introduced support for the nlohmann_json library in CMake, allowing for conditional inclusion based on the `YAZE_ENABLE_JSON` option. - Updated CMake configurations to streamline SDL2 and gRPC integration, ensuring proper linking and target management. Benefits: - Improves code quality and consistency through automated checks and formatting. - Enhances dependency management and build reliability across platforms. - Provides flexibility for users to enable optional features, improving overall functionality.
35 lines
989 B
CMake
35 lines
989 B
CMake
# nlohmann_json dependency management
|
|
|
|
if(NOT YAZE_ENABLE_JSON)
|
|
return()
|
|
endif()
|
|
|
|
message(STATUS "Setting up nlohmann_json with local third_party")
|
|
|
|
# Use the bundled nlohmann_json from third_party
|
|
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)
|
|
|
|
# Verify target is available
|
|
if(TARGET nlohmann_json::nlohmann_json)
|
|
message(STATUS "nlohmann_json target found")
|
|
elseif(TARGET nlohmann_json)
|
|
# Create alias if only non-namespaced target exists
|
|
add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json)
|
|
message(STATUS "Created nlohmann_json::nlohmann_json alias")
|
|
else()
|
|
message(FATAL_ERROR "nlohmann_json target not found after add_subdirectory")
|
|
endif()
|
|
|
|
# Export for use in other CMake files
|
|
set(YAZE_JSON_TARGETS
|
|
nlohmann_json::nlohmann_json
|
|
PARENT_SCOPE
|
|
)
|
|
|
|
message(STATUS "nlohmann_json setup complete")
|
|
|