Skip to content

Commit 5b2ed71

Browse files
committed
Add Wayland protocol generation before lime rebuild (WIP)
1 parent bc8fdb3 commit 5b2ed71

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
@@ -451,8 +451,38 @@ class LinuxPlatform extends PlatformTarget
451451
}
452452
}
453453

454+
/**
455+
* Generates the Wayland Protocols into the project obj folder before rebuild.
456+
*/
457+
private function generateWaylandProtocols():Void
458+
{
459+
Log.println("Generating Wayland Protocols");
460+
var outputDir = "../project/obj/generated/wayland";
461+
var sdlPath = "../project/lib/sdl/wayland-protocols";
462+
463+
if (!FileSystem.exists(outputDir)) FileSystem.createDirectory(outputDir);
464+
465+
if (FileSystem.exists(sdlPath))
466+
{
467+
var xmls:Array<String> = FileSystem.readDirectory(sdlPath);
468+
for (xml in xmls)
469+
{
470+
if (!StringTools.endsWith(xml, ".xml")) continue;
471+
472+
var name = xml.substring(0, xml.lastIndexOf("."));
473+
var xmlPath = '$sdlPath/$xml';
474+
475+
Log.println(' - obj/generated/wayland/$xml');
476+
System.runCommand("", "wayland-scanner", ["client-header", xmlPath, '$outputDir/$name-client-protocol.h']);
477+
System.runCommand("", "wayland-scanner", ["private-code", xmlPath, '$outputDir/$name-client-protocol.c']);
478+
}
479+
}
480+
}
481+
454482
public override function rebuild():Void
455483
{
484+
generateWaylandProtocols();
485+
456486
var commands = [];
457487

458488
if (System.hostArchitecture == ARM64 )

0 commit comments

Comments
 (0)