When building the engine if you don't have iOS SDK Installed then don't build it

Currently when you try and build macOS editor it assumes you also want to build iOS because of the way this check works which assumes if you have Xcode Installed you are ready to go. This really should not be the case, so instead lets check to see if you have the iophonesdk installed for your current Xcode if not then skip it.
This commit is contained in:
Andrew Spiering
2023-09-17 22:26:50 -07:00
parent ffec2f751d
commit 9f4429f87c

View File

@@ -1,5 +1,8 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using System;
using System.IO;
namespace Flax.Build.Platforms
{
/// <summary>
@@ -11,6 +14,9 @@ namespace Flax.Build.Platforms
/// <inheritdoc />
public override TargetPlatform Target => TargetPlatform.iOS;
/// <inheritdoc />
public override bool HasRequiredSDKsInstalled { get; }
/// <inheritdoc />
public override bool HasDynamicCodeExecutionSupport => false;
@@ -21,11 +27,19 @@ namespace Flax.Build.Platforms
{
if (Platform.BuildTargetPlatform != TargetPlatform.Mac)
return;
if (!HasRequiredSDKsInstalled)
if (!XCode.Instance.IsValid)
{
Log.Warning("Missing XCode. Cannot build for iOS platform.");
return;
}
// We should check and see if the actual iphoneSDK is installed
string iphoneSDKPath = Utilities.ReadProcessOutput("/usr/bin/xcrun", "--sdk iphoneos --show-sdk-path");
if (string.IsNullOrEmpty(iphoneSDKPath) || !Directory.Exists(iphoneSDKPath)) {
Log.Warning("Missing iPhoneSDK. Cannot build for iOS platform.");
HasRequiredSDKsInstalled = false;
}
}
/// <inheritdoc />