add cmake options to perfer system libs to sdl and sdl_image
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled

This commit is contained in:
Green Sky 2025-04-06 16:49:50 +02:00
parent 9b40c417a2
commit de75a067a3
No known key found for this signature in database
GPG Key ID: DBE05085D874AB4A
3 changed files with 57 additions and 24 deletions

View File

@ -1,9 +1,8 @@
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
include(FetchContent)
if (NOT TARGET Freetype::Freetype)
find_package(Freetype 2.12 CONFIG GLOBAL QUIET)
endif()
if (NOT TARGET Freetype::Freetype)
find_package(Freetype 2.12 GLOBAL QUIET)
@ -25,5 +24,3 @@ if (NOT TARGET Freetype::Freetype)
else()
message(STATUS "freetype not found")
endif()
endif()

View File

@ -2,10 +2,26 @@ cmake_minimum_required(VERSION 3.16...3.24 FATAL_ERROR)
include(FetchContent)
option(TOMATO_DEP_SDL_USE_SYSTEM "Prefer system provided SDL" OFF)
if (TOMATO_DEP_SDL_USE_SYSTEM)
if (NOT TARGET SDL3::SDL3)
#find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3-shared)
find_package(SDL3 REQUIRED CONFIG GLOBAL QUIET)
endif()
if (TARGET SDL3::SDL3)
message(STATUS "found system SDL3")
else()
message(STATUS "system SDL3 not found")
endif()
endif()
if (NOT TARGET SDL3::SDL3)
message(STATUS "using bundled SDL3")
# bundle sdl static
set(SDL_SHARED OFF CACHE INTERNAL "")
set(SDL_STATIC ON CACHE INTERNAL "")
#TODO: pic ?
set(SDL_DISABLE_ANDROID_JAR OFF CACHE INTERNAL "")
FetchContent_Declare(SDL3

View File

@ -2,6 +2,26 @@ cmake_minimum_required(VERSION 3.16...3.24 FATAL_ERROR)
include(FetchContent)
option(TOMATO_DEP_SDL_IMAGE_USE_SYSTEM "Prefer system provided SDL_image" OFF)
if (TOMATO_DEP_SDL_IMAGE_USE_SYSTEM)
if (NOT TARGET SDL3_image::SDL3_image)
find_package(SDL3_image REQUIRED CONFIG GLOBAL QUIET)
endif()
if (TARGET SDL3_image::SDL3_image)
message(STATUS "found system SDL3_image")
else()
message(STATUS "system SDL3_image not found")
endif()
endif()
if (SDLIMAGE_BACKEND_STB)
# mandatory security
# technically its only used if no proper libjpeg and libpng where found/configured
message(FATAL_ERROR "SDL3_image has the STBI backend enabled")
endif()
if (NOT TARGET SDL3_image::SDL3_image)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
# TODO: make pr to make this an option