From dfaa7a92b366c57badd689dcd92e734378cc7b24 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 27 Dec 2021 14:46:20 +0100 Subject: [PATCH] Add Mac build platform detection in build tool --- Source/Tools/Flax.Build/Build/Platform.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Source/Tools/Flax.Build/Build/Platform.cs b/Source/Tools/Flax.Build/Build/Platform.cs index a2c875eb0..a95c9c56c 100644 --- a/Source/Tools/Flax.Build/Build/Platform.cs +++ b/Source/Tools/Flax.Build/Build/Platform.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Diagnostics; using Flax.Build.NativeCpp; namespace Flax.Build @@ -33,7 +34,24 @@ namespace Flax.Build case PlatformID.Win32S: case PlatformID.Win32Windows: case PlatformID.WinCE: return TargetPlatform.Windows; - case PlatformID.Unix: return TargetPlatform.Linux; + case PlatformID.Unix: + { + var p = new Process + { + StartInfo = new ProcessStartInfo + { + UseShellExecute = false, + RedirectStandardOutput = true, + FileName = "uname", + Arguments = "-s", + } + }; + p.Start(); + string uname = p.StandardOutput.ReadToEnd().Trim(); + if (uname == "Darwin") + return TargetPlatform.Mac; + return TargetPlatform.Linux; + } case PlatformID.MacOSX: return TargetPlatform.Mac; default: throw new NotImplementedException(string.Format("Unsupported build platform {0}.", platformId)); }