Files
FlaxEngine/Source/Tools/Flax.Build/Deps/Dependencies/Wayland.cs
Ari Vuollet c0fcb97e9a
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled
Add support for building dependencies with specific architecture
2025-10-12 17:19:10 +03:00

82 lines
2.8 KiB
C#

// Copyright (c) Wojciech Figat. All rights reserved.
using System.Collections.Generic;
using System.IO;
using Flax.Build;
namespace Flax.Deps.Dependencies
{
/// <summary>
/// Wayland protocols.
/// </summary>
/// <seealso cref="Flax.Deps.Dependency" />
class Wayland : Dependency
{
/// <inheritdoc />
public override TargetPlatform[] Platforms
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Linux:
return new[]
{
TargetPlatform.Linux,
};
default: return new TargetPlatform[0];
}
}
}
/// <inheritdoc />
public override TargetArchitecture[] Architectures
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Linux:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}
}
/// <inheritdoc />
public override void Build(BuildOptions options)
{
var dstPath = Path.Combine(options.ThirdPartyFolder, "Wayland");
var protocolsPath = Path.Combine(dstPath, "protocols");
var includePath = Path.Combine(dstPath, "include");
foreach (var platform in options.Platforms)
{
BuildStarted(platform, TargetArchitecture.AnyCPU);
switch (platform)
{
case TargetPlatform.Linux:
if (!Directory.Exists(Path.Combine(includePath, "wayland")))
Directory.CreateDirectory(Path.Combine(includePath, "wayland"));
string[] protocolFiles = Directory.GetFiles(protocolsPath, "*.xml", SearchOption.TopDirectoryOnly);
foreach (var protocolPath in protocolFiles)
{
var headerFile = Path.ChangeExtension(Path.GetFileName(protocolPath), "h");
var glueFile = Path.ChangeExtension(Path.GetFileName(protocolPath), "c");
Utilities.Run("wayland-scanner", $"client-header {protocolPath} include/wayland/{headerFile}", null, dstPath, Utilities.RunOptions.DefaultTool);
Utilities.Run("wayland-scanner", $"private-code {protocolPath} {glueFile}", null, dstPath, Utilities.RunOptions.DefaultTool);
}
break;
}
}
Utilities.FileCopy("/usr/share/licenses/wayland/COPYING", Path.Combine(dstPath, "LICENSE.txt"));
}
}
}