From 22915489b73f9dce2a1edd682e7c2f224bf028dc Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 27 Dec 2021 17:06:26 +0100 Subject: [PATCH] Mac progress --- .../VisualStudioCodeInstance.cs | 23 +++++++++++++++ .../VisualStudioCodeProjectGenerator.cs | 29 +++++++++++++++++++ .../Projects/XCodeProjectGenerator.cs | 7 +++++ 3 files changed, 59 insertions(+) diff --git a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeInstance.cs b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeInstance.cs index 10e2942dc..846801c22 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeInstance.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeInstance.cs @@ -1,5 +1,6 @@ // Copyright (c) 2012-2020 Flax Engine. All rights reserved. +using System; using System.IO; using Flax.Build.Platforms; @@ -67,6 +68,28 @@ namespace Flax.Build.Projects.VisualStudioCode } break; } + case TargetPlatform.Mac: + { + var userFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); + var paths = new string[] + { + "/Applications/Visual Studio Code.app", + userFolder + "/Visual Studio Code.app", + userFolder + "/Downloads/Visual Studio Code.app", + }; + foreach (var path in paths) + { + if (Directory.Exists(path)) + { + _instance = new VisualStudioCodeInstance + { + Path = path, + }; + break; + } + } + break; + } } if (_instance != null) diff --git a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs index 77d34c1d7..37d05066e 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs @@ -240,6 +240,35 @@ namespace Flax.Build.Projects.VisualStudioCode json.EndObject(); break; } + case TargetPlatform.Mac: + { + VisualStudioCodeInstance.GetInstance(); + json.AddField("command", "mono"); // TODO: use bundled mono + json.BeginArray("args"); + { + json.AddUnnamedField(buildToolPath); + json.AddUnnamedField("--build"); + json.AddUnnamedField("--log"); + json.AddUnnamedField("--mutex"); + json.AddUnnamedField(string.Format("--workspace=\\\"{0}\\\"", buildToolWorkspace)); + json.AddUnnamedField(string.Format("--arch={0}", configuration.Architecture)); + json.AddUnnamedField(string.Format("--configuration={0}", configuration.ConfigurationName)); + json.AddUnnamedField(string.Format("--platform={0}", configuration.PlatformName)); + json.AddUnnamedField(string.Format("--buildTargets={0}", target.Name)); + if (!string.IsNullOrEmpty(Configuration.Compiler)) + json.AddUnnamedField(string.Format("--compiler={0}", Configuration.Compiler)); + } + json.EndArray(); + + json.AddField("type", "shell"); + + json.BeginObject("options"); + { + json.AddField("cwd", buildToolWorkspace); + } + json.EndObject(); + break; + } default: throw new Exception("Visual Code project generator does not support current platform."); } diff --git a/Source/Tools/Flax.Build/Projects/XCodeProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/XCodeProjectGenerator.cs index a5bcfcf3f..bc138e772 100644 --- a/Source/Tools/Flax.Build/Projects/XCodeProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/XCodeProjectGenerator.cs @@ -71,11 +71,18 @@ namespace Flax.Build.Projects contents.AppendLine("\tobjectVersion = 55;"); contents.AppendLine("\tobjects = {"); + contents.AppendLine(""); + var sourceGroupId = "04FD634B277A16FE000EA5CA"; + contents.AppendLine("/* Begin PBXFileReference section */"); + contents.AppendLine("\t\t" + sourceGroupId + " /* Source */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Source; sourceTree = \"\"; };"); + contents.AppendLine("/* End PBXFileReference section */"); + contents.AppendLine(""); contents.AppendLine("/* Begin PBXGroup section */"); contents.AppendLine("\t\t" + groupId + " = {"); contents.AppendLine("\t\t\tisa = PBXGroup;"); contents.AppendLine("\t\t\tchildren = ("); + contents.AppendLine("\t\t\t\t" + sourceGroupId + ","); contents.AppendLine("\t\t\t);"); contents.AppendLine("\t\t\tsourceTree = \"\";"); contents.AppendLine("\t\t};");