Skip to content

Commit 8566206

Browse files
Add Wayland protocol generation before lime rebuild (WIP)
Co-authored-by: NotHyper-474 <40342021+nothyper-474@users.noreply.github.com>
1 parent 866e09e commit 8566206

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tools/platforms/LinuxPlatform.hx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,38 @@ class LinuxPlatform extends PlatformTarget
465465
}
466466
}
467467

468+
/**
469+
* Generates the Wayland Protocols into the project obj folder before rebuild.
470+
*/
471+
private function generateWaylandProtocols():Void
472+
{
473+
Log.println("Generating Wayland Protocols");
474+
var outputDir = project.config.get("project.rebuild.path") + "/obj/generated/wayland";
475+
var sdlPath = project.config.get("project.rebuild.path") + "/lib/sdl/wayland-protocols";
476+
477+
if (!FileSystem.exists(outputDir)) FileSystem.createDirectory(outputDir);
478+
479+
if (FileSystem.exists(sdlPath))
480+
{
481+
var xmls:Array<String> = FileSystem.readDirectory(sdlPath);
482+
for (xml in xmls)
483+
{
484+
if (!StringTools.endsWith(xml, ".xml")) continue;
485+
486+
var name = xml.substring(0, xml.lastIndexOf("."));
487+
var xmlPath = '$sdlPath/$xml';
488+
489+
Log.println(' - obj/generated/wayland/$xml');
490+
System.runCommand("", "wayland-scanner", ["client-header", xmlPath, '$outputDir/$name-client-protocol.h']);
491+
System.runCommand("", "wayland-scanner", ["private-code", xmlPath, '$outputDir/$name-client-protocol.c']);
492+
}
493+
}
494+
}
495+
468496
public override function rebuild():Void
469497
{
498+
generateWaylandProtocols();
499+
470500
var commands = [];
471501

472502
if (System.hostArchitecture == ARM64 )

0 commit comments

Comments
 (0)