Skip to content

Commit 16972bb

Browse files
committed
Merge branch 'apple-dwarf-dsym-fastbuild' into 'main'
Add support for Options.XCode.Compiler.DebugInformationFormat.DwarfWithDSym in fastbuild targets See merge request Sharpmake/sharpmake!539
2 parents 9572059 + a4b9ae2 commit 16972bb

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,29 @@ public void SetupExtraLinkerSettings(IFileGenerator fileGenerator, Project.Confi
166166

167167
public IEnumerable<Project.Configuration.BuildStepBase> GetExtraPostBuildEvents(Project.Configuration configuration, string fastBuildOutputFile)
168168
{
169-
return Enumerable.Empty<Project.Configuration.BuildStepBase>();
169+
if (Util.GetExecutingPlatform() == Platform.mac)
170+
{
171+
// Note: We only generate dsym for applications and bundles
172+
if (configuration.IsFastBuild &&
173+
(configuration.Output == Project.Configuration.OutputType.AppleApp ||
174+
configuration.Output == Project.Configuration.OutputType.Exe ||
175+
configuration.Output == Project.Configuration.OutputType.AppleBundle ||
176+
configuration.Output == Project.Configuration.OutputType.Dll
177+
))
178+
{
179+
var debugFormat = Options.GetObject<Sharpmake.Options.XCode.Compiler.DebugInformationFormat>(configuration);
180+
if (debugFormat == Options.XCode.Compiler.DebugInformationFormat.DwarfWithDSym)
181+
{
182+
string outputPath = Path.Combine(configuration.TargetPath, configuration.TargetFileFullNameWithExtension + ".dSYM");
183+
yield return new Project.Configuration.BuildStepExecutable(
184+
"/usr/bin/dsymutil",
185+
fastBuildOutputFile,
186+
Path.Combine(configuration.IntermediatePath, configuration.TargetFileName + ".dsymdone"),
187+
$"{fastBuildOutputFile} -o {outputPath}",
188+
useStdOutAsOutput: true);
189+
}
190+
}
191+
}
170192
}
171193

172194
public IEnumerable<Project.Configuration.BuildStepExecutable> GetExtraStampEvents(Project.Configuration configuration, string fastBuildOutputFile)

samples/HelloXCode/HelloXCode.CommonProject.sharpmake.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ public virtual void ConfigureAll(Configuration conf, CommonTarget target)
5959

6060
conf.Output = Configuration.OutputType.Lib; // defaults to creating static libs
6161
conf.Options.Add(Options.XCode.Editor.Indent.Spaces);
62+
63+
if (target.Optimization == Optimization.Debug)
64+
conf.Options.Add(Sharpmake.Options.XCode.Compiler.DebugInformationFormat.DwarfWithDSym);
65+
else
66+
conf.Options.Add(Sharpmake.Options.XCode.Compiler.DebugInformationFormat.Dwarf);
6267
}
6368

6469
////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)