Skip to content

Commit 3837a6e

Browse files
authored
Adding Custom Working Directory for XCode (#404)
* Adding Custom Working Directory * Moved CustomDirectory into options * removed whitespace * removed changes to targetName
1 parent 6ffdbdb commit 3837a6e

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Sharpmake.Generators/Apple/XCodeProj.Template.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,8 @@ private static class Template
607607
selectedDebuggerIdentifier = ""Xcode.DebuggerFoundation.Debugger.LLDB""
608608
selectedLauncherIdentifier = ""Xcode.DebuggerFoundation.Launcher.LLDB""
609609
launchStyle = ""0""
610-
useCustomWorkingDirectory = ""NO""
610+
useCustomWorkingDirectory = ""[UseCustomDir]""
611+
customWorkingDirectory = ""[options.CustomDirectory]""
611612
ignoresPersistentStateOnLaunch = ""NO""
612613
debugDocumentVersioning = ""YES""
613614
enableGPUFrameCaptureMode = ""[options.EnableGpuFrameCaptureMode]""

Sharpmake.Generators/Apple/XCodeProj.cs

+4
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ string projectFile
336336
Options.Option(Options.XCode.Scheme.MetalAPIValidation.Disable, () => options["MetalAPIValidation"] = "1")
337337
);
338338

339+
options["CustomDirectory"] = Options.PathOption.Get<Options.XCode.Scheme.CustomWorkingDirectory>(activeConfiguration);
340+
var useCustomDirectory = options["CustomDirectory"] != RemoveLineTag ? "YES" : "NO";
341+
339342
string targetName = $"&quot;{activeConfiguration.Target.Name}&quot;";
340343
string buildImplicitDependencies = activeConfiguration.IsFastBuild ? "NO" : "YES";
341344
bool useBuildableProductRunnableSection = true;
@@ -375,6 +378,7 @@ string projectFile
375378
using (fileGenerator.Declare("options", options))
376379
using (fileGenerator.Declare("testableElements", testableElements))
377380
using (fileGenerator.Declare("DefaultTarget", targetName))
381+
using (fileGenerator.Declare("UseCustomDir", useCustomDirectory))
378382
using (fileGenerator.Declare("commandLineArguments", commandLineArguments))
379383
using (fileGenerator.Declare("environmentVariables", environmentVariablesBuilder))
380384
using (fileGenerator.Declare("buildImplicitDependencies", buildImplicitDependencies))

Sharpmake/Options.XCode.cs

+11
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,17 @@ public CustomRunnablePath(string path) : base(path)
12541254
{
12551255
}
12561256
}
1257+
1258+
/// <summary>
1259+
/// This option can be used to set a custom working directory
1260+
/// </summary>
1261+
public class CustomWorkingDirectory : PathOption
1262+
{
1263+
public CustomWorkingDirectory(string path) : base(path)
1264+
{
1265+
}
1266+
}
1267+
12571268
}
12581269
}
12591270
}

0 commit comments

Comments
 (0)