backend-infra-engineer: Release v0.3.2 snapshot
This commit is contained in:
@@ -1,54 +1,66 @@
|
||||
# SDL2
|
||||
if (UNIX OR MINGW OR WIN32)
|
||||
# On Windows with vcpkg, prefer vcpkg packages for faster builds
|
||||
if(WIN32)
|
||||
# Disable pkgconfig for SDL on Windows (prevents MSYS2 download failures in vcpkg)
|
||||
set(SDL_PKGCONFIG OFF CACHE BOOL "Disable pkgconfig on Windows" FORCE)
|
||||
|
||||
# Try to find SDL2 via vcpkg first if toolchain is available
|
||||
if(DEFINED CMAKE_TOOLCHAIN_FILE AND EXISTS "${CMAKE_TOOLCHAIN_FILE}")
|
||||
find_package(SDL2 CONFIG QUIET)
|
||||
if(SDL2_FOUND OR TARGET SDL2::SDL2)
|
||||
# Use vcpkg SDL2
|
||||
if(TARGET SDL2::SDL2)
|
||||
set(SDL_TARGETS SDL2::SDL2)
|
||||
if(TARGET SDL2::SDL2main)
|
||||
list(PREPEND SDL_TARGETS SDL2::SDL2main)
|
||||
endif()
|
||||
list(APPEND SDL_TARGETS ws2_32)
|
||||
add_definitions("-DSDL_MAIN_HANDLED")
|
||||
message(STATUS "✓ Using vcpkg SDL2")
|
||||
|
||||
# Get SDL2 include directories for reference
|
||||
get_target_property(SDL2_INCLUDE_DIR SDL2::SDL2 INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Fall back to bundled SDL if vcpkg not available or SDL2 not found
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/src/lib/SDL/CMakeLists.txt")
|
||||
message(STATUS "○ vcpkg SDL2 not found, using bundled SDL2")
|
||||
add_subdirectory(src/lib/SDL)
|
||||
set(SDL_TARGETS SDL2-static)
|
||||
set(SDL2_INCLUDE_DIR
|
||||
${CMAKE_SOURCE_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include-config-${CMAKE_BUILD_TYPE}
|
||||
)
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
||||
if(TARGET SDL2main)
|
||||
list(PREPEND SDL_TARGETS SDL2main)
|
||||
endif()
|
||||
list(APPEND SDL_TARGETS ws2_32)
|
||||
add_definitions("-DSDL_MAIN_HANDLED")
|
||||
else()
|
||||
message(FATAL_ERROR "SDL2 not found via vcpkg and bundled SDL2 not available. Please install via vcpkg or ensure submodules are initialized.")
|
||||
endif()
|
||||
elseif(UNIX OR MINGW)
|
||||
# Non-Windows: use bundled SDL
|
||||
add_subdirectory(src/lib/SDL)
|
||||
# When using bundled SDL, use the static target and set include directories
|
||||
set(SDL_TARGETS SDL2-static)
|
||||
set(SDL2_INCLUDE_DIR
|
||||
${CMAKE_SOURCE_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include-config-${CMAKE_BUILD_TYPE}
|
||||
)
|
||||
# Also set for consistency with bundled SDL
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
||||
message(STATUS "Using bundled SDL2")
|
||||
else()
|
||||
find_package(SDL2)
|
||||
# When using system SDL, use the imported targets
|
||||
# Fallback: try to find system SDL
|
||||
find_package(SDL2 REQUIRED)
|
||||
set(SDL_TARGETS SDL2::SDL2)
|
||||
if(WIN32)
|
||||
list(PREPEND SDL_TARGETS SDL2::SDL2main ws2_32)
|
||||
add_definitions("-DSDL_MAIN_HANDLED")
|
||||
endif()
|
||||
message(STATUS "Using system SDL2")
|
||||
endif()
|
||||
|
||||
# libpng and ZLIB dependencies
|
||||
if(WIN32)
|
||||
# Windows builds with vcpkg (OpenGL/GLEW removed to avoid MSYS2 issues)
|
||||
if(NOT YAZE_MINIMAL_BUILD)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
else()
|
||||
# For CI/minimal 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()
|
||||
endif()
|
||||
elseif(YAZE_MINIMAL_BUILD)
|
||||
# For CI builds on other platforms, 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()
|
||||
# PNG and ZLIB dependencies removed
|
||||
Reference in New Issue
Block a user