diff --git a/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs b/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs
index 89eb94eae..d55994763 100644
--- a/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs
+++ b/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs
@@ -638,13 +638,18 @@ namespace Flax.Build
Log.Verbose("No target selected for build");
return;
}
- if (!target.Platforms.Contains(buildData.Platform.Target) || !target.Architectures.Contains(buildData.Architecture))
- {
- Log.Verbose($"Referenced target {reference.Project.Name} doesn't support {buildData.Platform.Target} {buildData.Architecture}");
- return;
- }
if (!buildContext.TryGetValue(target, out var referencedBuildData))
{
+ if (!target.CanBuild(buildData.TargetOptions))
+ {
+ Log.Verbose($"Referenced target {reference.Project.Name} doesn't build for {buildData.Platform.Target} {buildData.Architecture} {buildData.Configuration}");
+ return;
+ }
+ if (!target.Platforms.Contains(buildData.Platform.Target) || !target.Architectures.Contains(buildData.Architecture))
+ {
+ Log.Verbose($"Referenced target {reference.Project.Name} doesn't support {buildData.Platform.Target} {buildData.Architecture}");
+ return;
+ }
Log.Info($"Building referenced target {reference.Project.Name}");
// Build target
@@ -706,6 +711,11 @@ namespace Flax.Build
}
if (!buildContext.TryGetValue(target, out var referencedBuildData))
{
+ if (!target.CanBuild(buildData.TargetOptions))
+ {
+ Log.Verbose($"Referenced target {reference.Project.Name} doesn't build for {buildData.Platform.Target} {buildData.Architecture} {buildData.Configuration}");
+ return;
+ }
Log.Info($"Building referenced target {reference.Project.Name}");
// Build target
diff --git a/Source/Tools/Flax.Build/Build/Target.cs b/Source/Tools/Flax.Build/Build/Target.cs
index b43ad82f0..7fa086491 100644
--- a/Source/Tools/Flax.Build/Build/Target.cs
+++ b/Source/Tools/Flax.Build/Build/Target.cs
@@ -207,6 +207,16 @@ namespace Flax.Build
return projectTargets.Length != 0 ? projectTargets[0] : null;
}
+ ///
+ /// Checks if this target can be built for a given build options. Can be used to skip compiling for unsupported platforms or unused configurations (eg. development-only plugins).
+ ///
+ /// The build options.
+ /// True if can build target, otherwise false.
+ public virtual bool CanBuild(BuildOptions options)
+ {
+ return true;
+ }
+
///
/// Gets the output file path.
///