From d48b8767fab136d73395fdc6ffa0a46a547360ff Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sat, 10 Feb 2024 13:06:33 -0500 Subject: [PATCH] [meson] Use dependency() instead of find_library() for SDL2/GLFW detection. Since we're not linking to the libraries anymore, it doesn't make much sense to use find_library, and in fact we need to use dependency() in order to get the right CFLAGS for includes, defines, etc, so use that instead. As a result, we can remove the 'SDL2/' folders from the includes, making the SDL includes more correct. --- include/native/wsi/native_sdl2.h | 4 ++-- meson.build | 4 ++-- src/wsi/meson.build | 7 +++++++ src/wsi/sdl2/wsi_platform_sdl2.h | 2 +- src/wsi/sdl2/wsi_window_sdl2.cpp | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/include/native/wsi/native_sdl2.h b/include/native/wsi/native_sdl2.h index b197d952..7ece3a55 100644 --- a/include/native/wsi/native_sdl2.h +++ b/include/native/wsi/native_sdl2.h @@ -1,6 +1,6 @@ #include -#include +#include namespace dxvk::wsi { @@ -22,4 +22,4 @@ namespace dxvk::wsi { return reinterpret_cast(static_cast(displayId + 1)); } -} \ No newline at end of file +} diff --git a/meson.build b/meson.build index 1a82e4bc..fe503562 100644 --- a/meson.build +++ b/meson.build @@ -127,8 +127,8 @@ else './include/native/directx' ] - lib_sdl2 = cpp.find_library('SDL2', required: false) - lib_glfw = cpp.find_library('glfw', required: false) + lib_sdl2 = dependency('SDL2', required: false) + lib_glfw = dependency('glfw', required: false) if lib_sdl2.found() compiler_args += ['-DDXVK_WSI_SDL2'] endif diff --git a/src/wsi/meson.build b/src/wsi/meson.build index f60840b9..4cfb13a8 100644 --- a/src/wsi/meson.build +++ b/src/wsi/meson.build @@ -14,6 +14,13 @@ wsi_src = [ wsi_deps = [ dep_displayinfo ] +if platform != 'windows' + wsi_deps += [ + lib_sdl2.partial_dependency(compile_args: true, includes: true), + lib_glfw.partial_dependency(compile_args: true, includes: true), + ] +endif + wsi_lib = static_library('wsi', wsi_src, dependencies : wsi_deps, include_directories : [ dxvk_include_path ]) diff --git a/src/wsi/sdl2/wsi_platform_sdl2.h b/src/wsi/sdl2/wsi_platform_sdl2.h index fc3ce353..1a6ac8aa 100644 --- a/src/wsi/sdl2/wsi_platform_sdl2.h +++ b/src/wsi/sdl2/wsi_platform_sdl2.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include "../wsi_platform.h" diff --git a/src/wsi/sdl2/wsi_window_sdl2.cpp b/src/wsi/sdl2/wsi_window_sdl2.cpp index 68e90229..33084dc3 100644 --- a/src/wsi/sdl2/wsi_window_sdl2.cpp +++ b/src/wsi/sdl2/wsi_window_sdl2.cpp @@ -9,7 +9,7 @@ #include "../../util/log/log.h" #include -#include +#include namespace dxvk::wsi {