Add support for binary modules with native-code only

This commit is contained in:
Wojtek Figat
2021-02-25 13:01:15 +01:00
parent 3da6f9186c
commit b193a7abc4
21 changed files with 123 additions and 27 deletions

View File

@@ -23,6 +23,8 @@ namespace Flax.Build
var buildOptions = buildData.TargetOptions;
foreach (var binaryModule in buildData.BinaryModules)
{
if (binaryModule.All(x => !x.BuildCSharp))
continue;
var binaryModuleName = binaryModule.Key;
using (new ProfileEventScope(binaryModuleName))
{
@@ -71,6 +73,7 @@ namespace Flax.Build
var dependencyModule = buildData.Rules.GetModule(dependencyName);
if (dependencyModule != null &&
!string.IsNullOrEmpty(dependencyModule.BinaryModuleName) &&
dependencyModule.BuildCSharp &&
dependencyModule.BinaryModuleName != binaryModuleName &&
buildData.Modules.TryGetValue(dependencyModule, out var dependencyModuleOptions))
{

View File

@@ -37,6 +37,11 @@ namespace Flax.Build
/// </summary>
public bool BuildNativeCode = true;
/// <summary>
/// True if module has C# code to build. Can be used for native modules without C# bindings nor code.
/// </summary>
public bool BuildCSharp = true;
/// <summary>
/// Initializes a new instance of the <see cref="Module"/> class.
/// </summary>

View File

@@ -831,6 +831,11 @@ namespace Flax.Build
// C#-only binary module
binaryModuleInfo.NativePath = string.Empty;
}
if (!binaryModule.Any(x => x.BuildCSharp))
{
// Skip C#
binaryModuleInfo.ManagedPath = string.Empty;
}
break;
}
case TargetLinkType.Modular:
@@ -850,6 +855,11 @@ namespace Flax.Build
// C#-only binary module
binaryModuleInfo.NativePath = string.Empty;
}
if (!module.BuildCSharp)
{
// Skip C#
binaryModuleInfo.ManagedPath = string.Empty;
}
break;
}
default: throw new ArgumentOutOfRangeException();