[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.
This commit is contained in:
Ethan Lee 2024-02-10 13:06:33 -05:00
parent f96ce6475d
commit d48b8767fa
5 changed files with 13 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#include <windows.h>
#include <SDL2/SDL.h>
#include <SDL.h>
namespace dxvk::wsi {
@ -22,4 +22,4 @@ namespace dxvk::wsi {
return reinterpret_cast<HMONITOR>(static_cast<intptr_t>(displayId + 1));
}
}
}

View File

@ -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

View File

@ -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 ])

View File

@ -1,6 +1,6 @@
#pragma once
#include <SDL2/SDL.h>
#include <SDL.h>
#include "../wsi_platform.h"

View File

@ -9,7 +9,7 @@
#include "../../util/log/log.h"
#include <windows.h>
#include <SDL2/SDL_vulkan.h>
#include <SDL_vulkan.h>
namespace dxvk::wsi {