Skip to content

Commit

Permalink
Stop dropping Wayland files into Kinc's directory
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Feb 9, 2022
1 parent a38b8dc commit 8effa20
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 78 deletions.
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,3 @@
**/Deployment/MultiWindow
compile_commands.json
.vscode/**

Backends/System/Linux/Sources/kinc/backend/wayland/wayland-protocol.*
Backends/System/Linux/Sources/kinc/backend/wayland/wayland-viewporter.*
Backends/System/Linux/Sources/kinc/backend/wayland/xdg-decoration.*
Backends/System/Linux/Sources/kinc/backend/wayland/xdg-shell.*
Backends/System/Linux/Sources/kinc/backend/wayland/wayland-tablet.*
Backends/System/Linux/Sources/kinc/backend/wayland/wayland-pointer-constraint.*
Backends/System/Linux/Sources/kinc/backend/wayland/wayland-relative-pointer.*
14 changes: 7 additions & 7 deletions Backends/System/Linux/Sources/kinc/backend/linuxunit.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#ifndef KINC_NO_WAYLAND
#include "wayland/display.c.h"
#include "wayland/system.c.h"
#include "wayland/wayland-pointer-constraint.c.h"
#include "wayland/wayland-protocol.c.h"
#include "wayland/wayland-relative-pointer.c.h"
#include "wayland/wayland-tablet.c.h"
#include "wayland/wayland-viewporter.c.h"
#include <wayland-generated/wayland-pointer-constraint.c.h>
#include <wayland-generated/wayland-protocol.c.h>
#include <wayland-generated/wayland-relative-pointer.c.h>
#include <wayland-generated/wayland-tablet.c.h>
#include <wayland-generated/wayland-viewporter.c.h>
#include "wayland/window.c.h"
#include "wayland/xdg-decoration.c.h"
#include "wayland/xdg-shell.c.h"
#include <wayland-generated/xdg-decoration.c.h>
#include <wayland-generated/xdg-shell.c.h>
#endif

#ifndef KINC_NO_X11
Expand Down
8 changes: 4 additions & 4 deletions Backends/System/Linux/Sources/kinc/backend/wayland/system.c.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "kinc/backend/wayland/wayland-pointer-constraint.h"
#include "kinc/backend/wayland/wayland-relative-pointer.h"
#include "kinc/backend/wayland/wayland-tablet.h"
#include "kinc/backend/wayland/xdg-shell.h"
#include <wayland-generated/wayland-pointer-constraint.h>
#include <wayland-generated/wayland-relative-pointer.h>
#include <wayland-generated/wayland-tablet.h>
#include <wayland-generated/xdg-shell.h>
#include "kinc/input/pen.h"
#include "kinc/log.h"
#include "kinc/memory.h"
Expand Down
12 changes: 6 additions & 6 deletions Backends/System/Linux/Sources/kinc/backend/wayland/wayland.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ struct kinc_wl_procs {

extern struct kinc_wl_procs wl;

#include "wayland-pointer-constraint.h"
#include "wayland-relative-pointer.h"
#include "wayland-tablet.h"
#include "wayland-viewporter.h"
#include "xdg-decoration.h"
#include "xdg-shell.h"
#include <wayland-generated/wayland-pointer-constraint.h>
#include <wayland-generated/wayland-relative-pointer.h>
#include <wayland-generated/wayland-tablet.h>
#include <wayland-generated/wayland-viewporter.h>
#include <wayland-generated/xdg-decoration.h>
#include <wayland-generated/xdg-shell.h>
#include <wayland-client-protocol.h>

#include <xkbcommon/xkbcommon.h>
Expand Down
2 changes: 1 addition & 1 deletion Tools/kincmake
66 changes: 40 additions & 26 deletions kfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,41 +321,55 @@ else if (platform === Platform.Linux || platform === Platform.FreeBSD) {
project.addLib('asound');
project.addLib('dl');

const child_process = require("child_process");

function wl_protocol(protocol, file) {
const backend_path = path.resolve(__dirname, "Backends/System/Linux/Sources/kinc/backend/wayland");
const protocol_path = path.resolve("/usr/share/wayland-protocols", protocol);
child_process.spawn("wayland-scanner", ["private-code", protocol_path, path.resolve(backend_path, file + ".c.h")]).on("exit", code => {
if (code != 0) {
console.warn("Failed to generate wayland protocol files for", protocol);
}
});
child_process.spawn("wayland-scanner", ["client-header", protocol_path, path.resolve(backend_path, file + ".h")]).on("exit", code => {
if (code != 0) {
console.warn("Failed to generate wayland protocol header for", protocol);
}
});
}

child_process.spawn("wayland-scanner", ["private-code", "/usr/share/wayland/wayland.xml", path.resolve(__dirname, "Backends/System/Linux/Sources/kinc/backend/wayland/wayland-protocol.c.h")]);
child_process.spawn("wayland-scanner", ["client-header", "/usr/share/wayland/wayland.xml", path.resolve(__dirname, "Backends/System/Linux/Sources/kinc/backend/wayland/wayland-protocol.h")]);
wl_protocol("stable/viewporter/viewporter.xml", "wayland-viewporter");
wl_protocol("stable/xdg-shell/xdg-shell.xml", "xdg-shell");
wl_protocol("unstable/xdg-decoration/xdg-decoration-unstable-v1.xml", "xdg-decoration");
wl_protocol("unstable/tablet/tablet-unstable-v2.xml", "wayland-tablet");
wl_protocol("unstable/pointer-constraints/pointer-constraints-unstable-v1.xml", "wayland-pointer-constraint");
wl_protocol("unstable/relative-pointer/relative-pointer-unstable-v1.xml", "wayland-relative-pointer");

if (platform === Platform.Linux) {
project.addLib('udev');

if (!fs.existsSync(targetDirectory)) {
fs.mkdirSync(targetDirectory);
}
if (!fs.existsSync(path.join(targetDirectory, 'wayland'))) {
fs.mkdirSync(path.join(targetDirectory, 'wayland'));
}
const waylandDir = path.join(targetDirectory, 'wayland', 'wayland-generated');
if (!fs.existsSync(waylandDir)) {
fs.mkdirSync(waylandDir);
}

const child_process = require("child_process");

function wl_protocol(protocol, file) {
const backend_path = path.resolve(waylandDir);
const protocol_path = path.resolve("/usr/share/wayland-protocols", protocol);
child_process.spawn("wayland-scanner", ["private-code", protocol_path, path.resolve(backend_path, file + ".c.h")]).on("exit", code => {
if (code != 0) {
console.warn("Failed to generate wayland protocol files for", protocol);
}
});
child_process.spawn("wayland-scanner", ["client-header", protocol_path, path.resolve(backend_path, file + ".h")]).on("exit", code => {
if (code != 0) {
console.warn("Failed to generate wayland protocol header for", protocol);
}
});
}

child_process.spawn("wayland-scanner", ["private-code", "/usr/share/wayland/wayland.xml", path.resolve(waylandDir, "wayland-protocol.c.h")]);
child_process.spawn("wayland-scanner", ["client-header", "/usr/share/wayland/wayland.xml", path.resolve(waylandDir, "wayland-protocol.h")]);
wl_protocol("stable/viewporter/viewporter.xml", "wayland-viewporter");
wl_protocol("stable/xdg-shell/xdg-shell.xml", "xdg-shell");
wl_protocol("unstable/xdg-decoration/xdg-decoration-unstable-v1.xml", "xdg-decoration");
wl_protocol("unstable/tablet/tablet-unstable-v2.xml", "wayland-tablet");
wl_protocol("unstable/pointer-constraints/pointer-constraints-unstable-v1.xml", "wayland-pointer-constraint");
wl_protocol("unstable/relative-pointer/relative-pointer-unstable-v1.xml", "wayland-relative-pointer");

project.addIncludeDir(path.join(targetDirectory, 'wayland'));
}
else if (platform === Platform.FreeBSD) {
addBackend('System/FreeBSD');
project.addExclude('Backends/System/Linux/Sources/kinc/backend/input/gamepad.cpp');
project.addExclude('Backends/System/Linux/Sources/kinc/backend/input/gamepad.h');
project.addDefine("KINC_NO_WAYLAND");
}

if (graphics === GraphicsApi.Vulkan) {
g4 = true;
g5 = true;
Expand Down
66 changes: 40 additions & 26 deletions kincfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,41 +321,55 @@ else if (platform === Platform.Linux || platform === Platform.FreeBSD) {
project.addLib('asound');
project.addLib('dl');

const child_process = require("child_process");

function wl_protocol(protocol, file) {
const backend_path = path.resolve(__dirname, "Backends/System/Linux/Sources/kinc/backend/wayland");
const protocol_path = path.resolve("/usr/share/wayland-protocols", protocol);
child_process.spawn("wayland-scanner", ["private-code", protocol_path, path.resolve(backend_path, file + ".c.h")]).on("exit", code => {
if (code != 0) {
console.warn("Failed to generate wayland protocol files for", protocol);
}
});
child_process.spawn("wayland-scanner", ["client-header", protocol_path, path.resolve(backend_path, file + ".h")]).on("exit", code => {
if (code != 0) {
console.warn("Failed to generate wayland protocol header for", protocol);
}
});
}

child_process.spawn("wayland-scanner", ["private-code", "/usr/share/wayland/wayland.xml", path.resolve(__dirname, "Backends/System/Linux/Sources/kinc/backend/wayland/wayland-protocol.c.h")]);
child_process.spawn("wayland-scanner", ["client-header", "/usr/share/wayland/wayland.xml", path.resolve(__dirname, "Backends/System/Linux/Sources/kinc/backend/wayland/wayland-protocol.h")]);
wl_protocol("stable/viewporter/viewporter.xml", "wayland-viewporter");
wl_protocol("stable/xdg-shell/xdg-shell.xml", "xdg-shell");
wl_protocol("unstable/xdg-decoration/xdg-decoration-unstable-v1.xml", "xdg-decoration");
wl_protocol("unstable/tablet/tablet-unstable-v2.xml", "wayland-tablet");
wl_protocol("unstable/pointer-constraints/pointer-constraints-unstable-v1.xml", "wayland-pointer-constraint");
wl_protocol("unstable/relative-pointer/relative-pointer-unstable-v1", "wayland-relative-pointer");

if (platform === Platform.Linux) {
project.addLib('udev');

if (!fs.existsSync(targetDirectory)) {
fs.mkdirSync(targetDirectory);
}
if (!fs.existsSync(path.join(targetDirectory, 'wayland'))) {
fs.mkdirSync(path.join(targetDirectory, 'wayland'));
}
const waylandDir = path.join(targetDirectory, 'wayland', 'wayland-generated');
if (!fs.existsSync(waylandDir)) {
fs.mkdirSync(waylandDir);
}

const child_process = require("child_process");

function wl_protocol(protocol, file) {
const backend_path = path.resolve(waylandDir);
const protocol_path = path.resolve("/usr/share/wayland-protocols", protocol);
child_process.spawn("wayland-scanner", ["private-code", protocol_path, path.resolve(backend_path, file + ".c.h")]).on("exit", code => {
if (code != 0) {
console.warn("Failed to generate wayland protocol files for", protocol);
}
});
child_process.spawn("wayland-scanner", ["client-header", protocol_path, path.resolve(backend_path, file + ".h")]).on("exit", code => {
if (code != 0) {
console.warn("Failed to generate wayland protocol header for", protocol);
}
});
}

child_process.spawn("wayland-scanner", ["private-code", "/usr/share/wayland/wayland.xml", path.resolve(waylandDir, "wayland-protocol.c.h")]);
child_process.spawn("wayland-scanner", ["client-header", "/usr/share/wayland/wayland.xml", path.resolve(waylandDir, "wayland-protocol.h")]);
wl_protocol("stable/viewporter/viewporter.xml", "wayland-viewporter");
wl_protocol("stable/xdg-shell/xdg-shell.xml", "xdg-shell");
wl_protocol("unstable/xdg-decoration/xdg-decoration-unstable-v1.xml", "xdg-decoration");
wl_protocol("unstable/tablet/tablet-unstable-v2.xml", "wayland-tablet");
wl_protocol("unstable/pointer-constraints/pointer-constraints-unstable-v1.xml", "wayland-pointer-constraint");
wl_protocol("unstable/relative-pointer/relative-pointer-unstable-v1.xml", "wayland-relative-pointer");

project.addIncludeDir(path.join(targetDirectory, 'wayland'));
}
else if (platform === Platform.FreeBSD) {
addBackend('System/FreeBSD');
project.addExclude('Backends/System/Linux/Sources/kinc/backend/input/gamepad.cpp');
project.addExclude('Backends/System/Linux/Sources/kinc/backend/input/gamepad.h');
project.addDefine("KINC_NO_WAYLAND");
}

if (graphics === GraphicsApi.Vulkan) {
g4 = true;
g5 = true;
Expand Down

0 comments on commit 8effa20

Please sign in to comment.