Enhance CMake configuration for PNG support and introduce vcpkg.json

- Updated CMakeLists.txt to conditionally enable PNG support based on the presence of the PNG library, improving compatibility for minimal builds.
- Added vcpkg.json to manage project dependencies, including zlib, libpng, sdl2, and abseil, streamlining package management.
- Modified CI workflow in ci.yml to simplify CMake configuration commands for better readability.
- Enhanced CMake scripts to ensure proper handling of dependencies in both minimal and regular builds, improving build reliability.
This commit is contained in:
scawful
2025-09-25 09:56:32 -04:00
parent 163aa9e121
commit d26f58be2f
8 changed files with 72 additions and 19 deletions

View File

@@ -1,7 +1,15 @@
if (MINGW)
if (MINGW OR WIN32)
add_subdirectory(src/lib/abseil-cpp)
elseif(YAZE_MINIMAL_BUILD)
# For CI builds, always use submodule to avoid dependency issues
add_subdirectory(src/lib/abseil-cpp)
else()
find_package(absl)
# Try system package first, fallback to submodule
find_package(absl QUIET)
if(NOT absl_FOUND)
message(STATUS "System Abseil not found, using submodule")
add_subdirectory(src/lib/abseil-cpp)
endif()
endif()
set(ABSL_PROPAGATE_CXX_STD ON)
set(ABSL_CXX_STANDARD 17)

View File

@@ -12,5 +12,23 @@ if(WIN32 OR MINGW)
add_definitions("-DSDL_MAIN_HANDLED")
endif()
# libpng
find_package(PNG REQUIRED)
# libpng and ZLIB dependencies
if(WIN32 AND NOT YAZE_MINIMAL_BUILD)
# Use vcpkg on Windows
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
elseif(YAZE_MINIMAL_BUILD)
# For CI builds, try to find but don't require
find_package(ZLIB QUIET)
find_package(PNG QUIET)
if(NOT ZLIB_FOUND OR NOT PNG_FOUND)
message(STATUS "PNG/ZLIB not found in minimal build, some features may be disabled")
set(PNG_FOUND FALSE)
set(PNG_LIBRARIES "")
set(PNG_INCLUDE_DIRS "")
endif()
else()
# Regular builds require these dependencies
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
endif()