Skip to content

Commit

Permalink
Merge branch 'apple-dwarf-dsym-fastbuild' into 'main'
Browse files Browse the repository at this point in the history
Add support for Options.XCode.Compiler.DebugInformationFormat.DwarfWithDSym in fastbuild targets

See merge request Sharpmake/sharpmake!539
  • Loading branch information
jspelletier committed Aug 7, 2024
2 parents 9572059 + a4b9ae2 commit 16972bb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,29 @@ public void SetupExtraLinkerSettings(IFileGenerator fileGenerator, Project.Confi

public IEnumerable<Project.Configuration.BuildStepBase> GetExtraPostBuildEvents(Project.Configuration configuration, string fastBuildOutputFile)
{
return Enumerable.Empty<Project.Configuration.BuildStepBase>();
if (Util.GetExecutingPlatform() == Platform.mac)
{
// Note: We only generate dsym for applications and bundles
if (configuration.IsFastBuild &&
(configuration.Output == Project.Configuration.OutputType.AppleApp ||
configuration.Output == Project.Configuration.OutputType.Exe ||
configuration.Output == Project.Configuration.OutputType.AppleBundle ||
configuration.Output == Project.Configuration.OutputType.Dll
))
{
var debugFormat = Options.GetObject<Sharpmake.Options.XCode.Compiler.DebugInformationFormat>(configuration);
if (debugFormat == Options.XCode.Compiler.DebugInformationFormat.DwarfWithDSym)
{
string outputPath = Path.Combine(configuration.TargetPath, configuration.TargetFileFullNameWithExtension + ".dSYM");
yield return new Project.Configuration.BuildStepExecutable(
"/usr/bin/dsymutil",
fastBuildOutputFile,
Path.Combine(configuration.IntermediatePath, configuration.TargetFileName + ".dsymdone"),
$"{fastBuildOutputFile} -o {outputPath}",
useStdOutAsOutput: true);
}
}
}
}

public IEnumerable<Project.Configuration.BuildStepExecutable> GetExtraStampEvents(Project.Configuration configuration, string fastBuildOutputFile)
Expand Down
5 changes: 5 additions & 0 deletions samples/HelloXCode/HelloXCode.CommonProject.sharpmake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public virtual void ConfigureAll(Configuration conf, CommonTarget target)

conf.Output = Configuration.OutputType.Lib; // defaults to creating static libs
conf.Options.Add(Options.XCode.Editor.Indent.Spaces);

if (target.Optimization == Optimization.Debug)
conf.Options.Add(Sharpmake.Options.XCode.Compiler.DebugInformationFormat.DwarfWithDSym);
else
conf.Options.Add(Sharpmake.Options.XCode.Compiler.DebugInformationFormat.Dwarf);
}

////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 16972bb

Please sign in to comment.