Skip to content

Commit

Permalink
Merge branch 'xcode-add-option' into 'main'
Browse files Browse the repository at this point in the history
Add Metal API Validation XCode configuration option

See merge request Sharpmake/sharpmake!436
  • Loading branch information
jspelletier committed Aug 24, 2023
2 parents c8947a0 + b60d0c3 commit a9033b4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sharpmake.Generators/Apple/XCodeProj.Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ private static class Template
ignoresPersistentStateOnLaunch = ""NO""
debugDocumentVersioning = ""YES""
enableGPUFrameCaptureMode = ""[options.EnableGpuFrameCaptureMode]""
enableGPUValidationMode = ""[options.MetalAPIValidation]""
allowLocationSimulation = ""YES"">
<BuildableProductRunnable>
<BuildableReference
Expand Down
7 changes: 7 additions & 0 deletions Sharpmake.Generators/Apple/XCodeProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@ string projectFile
Options.Option(Options.XCode.Compiler.EnableGpuFrameCaptureMode.OpenGLOnly, () => options["EnableGpuFrameCaptureMode"] = "2"),
Options.Option(Options.XCode.Compiler.EnableGpuFrameCaptureMode.Disable, () => options["EnableGpuFrameCaptureMode"] = "3")
);
// An empty line means ON, "1" means OFF
// https://gitlab.kitware.com/cmake/cmake/-/issues/23857
Options.SelectOption(configurations[0],
Options.Option(Options.XCode.Scheme.MetalAPIValidation.Enable, () => options["MetalAPIValidation"] = RemoveLineTag),
Options.Option(Options.XCode.Scheme.MetalAPIValidation.Disable, () => options["MetalAPIValidation"] = "1")
);

using (fileGenerator.Declare("projectFile", projectFile))
using (fileGenerator.Declare("item", defaultTarget))
using (fileGenerator.Declare("options", options))
Expand Down
16 changes: 16 additions & 0 deletions Sharpmake/Options.XCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,22 @@ public PrelinkLibraries(string path)
}
}
}

/// <summary>
/// This exposes the scheme settings to Sharpmake
/// These settings have their own group for better grouping
/// https://developer.apple.com/documentation/xcode/customizing-the-build-schemes-for-a-project
/// Option class naming follows their equivalent key.
/// </summary>
public static class Scheme
{
public enum MetalAPIValidation
{
[Default]
Enable,
Disable
}
}
}
}
}

0 comments on commit a9033b4

Please sign in to comment.