Skip to content

Commit

Permalink
[meson] Use dependency() instead of find_library() for SDL2/GLFW dete…
Browse files Browse the repository at this point in the history
…ction.

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.
  • Loading branch information
flibitijibibo authored and misyltoad committed May 13, 2024
1 parent d5d236a commit 6259e86
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/native/wsi/native_sdl2.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <windows.h>

#include <SDL2/SDL.h>
#include <SDL.h>

namespace dxvk::wsi {

Expand All @@ -22,4 +22,4 @@ namespace dxvk::wsi {
return reinterpret_cast<HMONITOR>(static_cast<intptr_t>(displayId + 1));
}

}
}
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/wsi/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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 ])
Expand Down
2 changes: 1 addition & 1 deletion src/wsi/sdl2/wsi_platform_sdl2.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <SDL2/SDL.h>
#include <SDL.h>

#include "../wsi_platform.h"

Expand Down
2 changes: 1 addition & 1 deletion src/wsi/sdl2/wsi_window_sdl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "../../util/log/log.h"

#include <windows.h>
#include <SDL2/SDL_vulkan.h>
#include <SDL_vulkan.h>

namespace dxvk::wsi {

Expand Down

0 comments on commit 6259e86

Please sign in to comment.