Commit 10913533 authored by Niklas Haas's avatar Niklas Haas
Browse files

demos: build both glfw and sdl

Apparently GLFW has a habit of not working on Wayland, because they
hard-code the platform at compile time. Might as well just provide all
four variants, who really cares about a few extra binaries?

The proper solution would be to make loading the windowing system
dynamic at runtime, but that probably requires handling command line
arguments and I can't really be bothered.

Also suppress a warning in the sdl code by rewriting it slightly.
parent 8e535ed2
Pipeline #80254 passed with stages
in 9 minutes and 36 seconds
......@@ -24,12 +24,10 @@ nuklear = declare_dependency(
apis = {}
# Enable all supported combinations of API and windowing system, preferring
# GLFW and falling back to SDL if the former is not supported
# Enable all supported combinations of API and windowing system
if glfw.found()
if vulkan.found()
apis += {'vk': declare_dependency(
apis += {'glfw-vk': declare_dependency(
sources: 'window_glfw.c',
compile_args: '-DUSE_VK',
dependencies: [libplacebo, vulkan, glfw],
......@@ -37,17 +35,17 @@ if glfw.found()
endif
if opengl.found()
apis += {'gl': declare_dependency(
apis += {'glfw-gl': declare_dependency(
sources: 'window_glfw.c',
compile_args: '-DUSE_GL',
dependencies: [libplacebo, glfw],
)}
endif
endif
elif sdl.found()
if sdl.found()
if vulkan.found()
apis += {'vk': declare_dependency(
apis += {'sdl-vk': declare_dependency(
sources: 'window_sdl.c',
compile_args: '-DUSE_VK',
dependencies: [libplacebo, vulkan, sdl],
......@@ -55,13 +53,12 @@ elif sdl.found()
endif
if opengl.found()
apis += {'gl': declare_dependency(
apis += {'sdl-gl': declare_dependency(
sources: 'window_sdl.c',
compile_args: '-DUSE_GL',
dependencies: [libplacebo, sdl],
)}
endif
endif
if apis.keys().length() == 0
......
......@@ -73,12 +73,9 @@ struct window *window_create(struct pl_context *ctx, const char *title,
}
const char **exts = malloc(num * sizeof(const char *));
SDL_Vulkan_GetInstanceExtensions(p->win, &num, exts);
iparams.extensions = exts;
iparams.num_extensions = num;
assert(exts);
bool ok = SDL_Vulkan_GetInstanceExtensions(p->win, &num, exts);
assert(ok);
p->vk_inst = pl_vk_inst_create(ctx, &iparams);
free(exts);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment