From 09ec4f6e225fb1634a800a58c28a87fe3733b343 Mon Sep 17 00:00:00 2001 From: Matthieu Bouron Date: Tue, 11 Apr 2023 10:21:55 +0200 Subject: [PATCH] dependencies: allow to fallback on CMake to find the SDL2 library On Windows, the SDL2 library is generally provided with only CMake config files. This commit allows meson to fallback on CMake as a last resort to find the SDL2 library. --- docs/markdown/Dependencies.md | 6 +++--- mesonbuild/dependencies/ui.py | 3 ++- test cases/frameworks/16 sdl2/meson_options.txt | 2 +- test cases/frameworks/16 sdl2/test.json | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/markdown/Dependencies.md b/docs/markdown/Dependencies.md index 356b181df..29894ac56 100644 --- a/docs/markdown/Dependencies.md +++ b/docs/markdown/Dependencies.md @@ -728,10 +728,10 @@ your own risk. ## SDL2 SDL2 can be located using `pkg-confg`, the `sdl2-config` config tool, -or as an OSX framework. +as an OSX framework, or `cmake`. -`method` may be `auto`, `config-tool`, `extraframework` or -`pkg-config`. +`method` may be `auto`, `config-tool`, `extraframework`, +`pkg-config` or `cmake`. ## Shaderc diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py index 71ea1d1d2..f3879bec0 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py @@ -252,8 +252,9 @@ gl_factory = DependencyFactory( sdl2_factory = DependencyFactory( 'sdl2', - [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK], + [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK, DependencyMethods.CMAKE], configtool_class=SDL2DependencyConfigTool, + cmake_name='SDL2', ) vulkan_factory = DependencyFactory( diff --git a/test cases/frameworks/16 sdl2/meson_options.txt b/test cases/frameworks/16 sdl2/meson_options.txt index 176af1775..039a3f52c 100644 --- a/test cases/frameworks/16 sdl2/meson_options.txt +++ b/test cases/frameworks/16 sdl2/meson_options.txt @@ -1,6 +1,6 @@ option( 'method', type : 'combo', - choices : ['auto', 'pkg-config', 'config-tool', 'sdlconfig', 'extraframework'], + choices : ['auto', 'pkg-config', 'config-tool', 'sdlconfig', 'extraframework', 'cmake'], value : 'auto', ) diff --git a/test cases/frameworks/16 sdl2/test.json b/test cases/frameworks/16 sdl2/test.json index 57a3f21b6..ee4112ae3 100644 --- a/test cases/frameworks/16 sdl2/test.json +++ b/test cases/frameworks/16 sdl2/test.json @@ -6,7 +6,8 @@ { "val": "pkg-config" }, { "val": "config-tool" }, { "val": "sdlconfig" }, - { "val": "extraframework", "skip_on_os": ["!darwin"], "skip_on_jobname": ["macos"] } + { "val": "extraframework", "skip_on_os": ["!darwin"], "skip_on_jobname": ["macos"] }, + { "val": "cmake", "skip_on_jobname": ["bionic"] } ] } },