mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-05 00:50:53 +00:00
Unfinished Wayland PR (#1)
moved from the github repo. current progress: <img width="389" alt="image.png" src="attachments/6a2cb365-7348-44b4-8fa7-9980df965a67"> Other notes: - took the opportunity to remove MwLLSetBackground which I was told was deprecated - Updated .gitignore to more accurately cover/remove example binaries - Uses OpenGL as the backend. - New LL function for swapping buffers, MwLLEndDraw - [TODO] Uses weak linking for all libraries so that systems that don't support Wayland or even have it installed can launch without it. Reviewed-on: https://gitea.nishi.boats/pyrite-dev/milsko/pulls/1 Co-authored-by: IoIxD <alphaproject217@gmail.com> Co-committed-by: IoIxD <alphaproject217@gmail.com>
This commit is contained in:
25
pl/rules.pl
25
pl/rules.pl
@@ -26,6 +26,26 @@ if (grep(/^gdi$/, @backends)) {
|
||||
$gl_libs = "-lopengl32 -lglu32";
|
||||
}
|
||||
|
||||
if (grep(/^wayland$/, @backends)) {
|
||||
add_cflags("-DUSE_WAYLAND");
|
||||
new_object("src/backend/wayland.c");
|
||||
if ($cross) {
|
||||
add_libs("-lGL -lEGL -lwayland-egl -lwayland-client -lxkbcommon");
|
||||
}
|
||||
else {
|
||||
add_libs("-lGL -lEGL");
|
||||
add_cflags(`pkg-config --cflags wayland-egl wayland-client xkbcommon`);
|
||||
add_libs(`pkg-config --libs wayland-egl wayland-client xkbcommon`);
|
||||
}
|
||||
|
||||
scan_wayland_protocol("stable", "xdg-shell", "");
|
||||
scan_wayland_protocol("stable", "tablet", "-v2");
|
||||
scan_wayland_protocol("staging", "cursor-shape", "-v1");
|
||||
scan_wayland_protocol("unstable", "xdg-decoration", "-unstable-v1");
|
||||
|
||||
$gl_libs = "-lGL -lGLU";
|
||||
}
|
||||
|
||||
if (param_get("stb-image")) {
|
||||
add_cflags("-DUSE_STB_IMAGE");
|
||||
}
|
||||
@@ -34,7 +54,10 @@ if (param_get("stb-truetype")) {
|
||||
}
|
||||
if (param_get("freetype2")) {
|
||||
add_cflags("-DUSE_FREETYPE2");
|
||||
if (not($cross)) {
|
||||
if ($cross) {
|
||||
add_libs("-lfreetype");
|
||||
}
|
||||
else {
|
||||
add_cflags(`pkg-config --cflags freetype2`);
|
||||
add_libs(`pkg-config --libs freetype2`);
|
||||
}
|
||||
|
||||
32
pl/utils.pl
32
pl/utils.pl
@@ -54,6 +54,38 @@ sub use_backend {
|
||||
}
|
||||
}
|
||||
|
||||
sub scan_wayland_protocol {
|
||||
my $tier = $_[0];
|
||||
my $proto = $_[1];
|
||||
my $ver = $_[2];
|
||||
|
||||
my $proto_c = "src/backend/wayland-${proto}-protocol.c";
|
||||
|
||||
if (
|
||||
system(
|
||||
"wayland-scanner private-code /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml ${proto_c}"
|
||||
) != 0
|
||||
)
|
||||
{
|
||||
print(
|
||||
"^ Error on getting private code for /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml\n"
|
||||
);
|
||||
}
|
||||
else {
|
||||
new_object($proto_c);
|
||||
}
|
||||
if (
|
||||
system(
|
||||
"wayland-scanner client-header /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml include/Mw/LowLevel/Wayland/${proto}-client-protocol.h"
|
||||
)
|
||||
)
|
||||
{
|
||||
print(
|
||||
"^ Error on getting client header for /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
our %params = ();
|
||||
|
||||
sub param_set {
|
||||
|
||||
Reference in New Issue
Block a user