Skip to content

Commit

Permalink
Merge branch 'xcode-fastbuild-support-exceptions' into 'main'
Browse files Browse the repository at this point in the history
deprecate XCode.Compiler.Exceptions and support exceptions for xcode fastbuild

See merge request Sharpmake/sharpmake!453
  • Loading branch information
jspelletier committed Sep 13, 2023
2 parents 0ee475e + 6962898 commit 965bb6d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 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 @@ -280,6 +280,7 @@ private static class Template
GCC_ENABLE_CPP_EXCEPTIONS = [item.Options.CppExceptionHandling];
GCC_ENABLE_CPP_RTTI = [item.Options.RuntimeTypeInfo];
GCC_ENABLE_OBJC_EXCEPTIONS = [item.Options.ObjCExceptionHandling];
CLANG_ENABLE_OBJC_ARC_EXCEPTIONS = [item.Options.ObjCARCExceptionHandling];
GCC_GENERATE_DEBUGGING_SYMBOLS = [item.Options.GenerateDebuggingSymbols];
GCC_INLINES_ARE_PRIVATE_EXTERN = [item.Options.PrivateInlines];
GCC_MODEL_TUNING = [item.Options.ModelTuning];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public abstract partial class BaseApplePlatform
+ ' [cmdLineOptions.WarningReturnType]'
+ ' [cmdLineOptions.RuntimeTypeInfo]'
+ ' [cmdLineOptions.ClangEnableObjC_ARC]'
+ ' [cmdLineOptions.CppExceptions]'
+ ' [cmdLineOptions.ObjCExceptions]'
+ ' [cmdLineOptions.ObjCARCExceptions]'
";

private const string _compilerExtraOptionsAdditional = @"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,10 +658,18 @@ public virtual void SelectCompilerOptions(IGenerationContext context)
);

context.SelectOption(
Options.Option(Options.XCode.Compiler.Exceptions.Disable, () => { options["CppExceptionHandling"] = "NO"; options["ObjCExceptionHandling"] = "NO"; }),
Options.Option(Options.XCode.Compiler.Exceptions.Enable, () => { options["CppExceptionHandling"] = "YES"; options["ObjCExceptionHandling"] = "YES"; }),
Options.Option(Options.XCode.Compiler.Exceptions.EnableCpp, () => { options["CppExceptionHandling"] = "YES"; options["ObjCExceptionHandling"] = "NO"; }),
Options.Option(Options.XCode.Compiler.Exceptions.EnableObjC, () => { options["CppExceptionHandling"] = "NO"; options["ObjCExceptionHandling"] = "YES"; })
Options.Option(Options.XCode.Compiler.CppExceptions.Disable, () => { options["CppExceptionHandling"] = "NO"; cmdLineOptions["CppExceptions"] = FileGeneratorUtilities.RemoveLineTag; }),
Options.Option(Options.XCode.Compiler.CppExceptions.Enable, () => { options["CppExceptionHandling"] = "YES"; cmdLineOptions["CppExceptions"] = "-fcxx-exceptions"; })
);

context.SelectOption(
Options.Option(Options.XCode.Compiler.ObjCExceptions.Disable, () => { options["ObjCExceptionHandling"] = "NO"; cmdLineOptions["ObjCExceptions"] = FileGeneratorUtilities.RemoveLineTag; }),
Options.Option(Options.XCode.Compiler.ObjCExceptions.Enable, () => { options["ObjCExceptionHandling"] = "YES"; cmdLineOptions["ObjCExceptions"] = "-fobjc-exceptions"; })
);

context.SelectOption(
Options.Option(Options.XCode.Compiler.ObjCARCExceptions.Disable, () => { options["ObjCARCExceptionHandling"] = "NO"; cmdLineOptions["ObjCARCExceptions"] = FileGeneratorUtilities.RemoveLineTag; }),
Options.Option(Options.XCode.Compiler.ObjCARCExceptions.Enable, () => { options["ObjCARCExceptionHandling"] = "YES"; cmdLineOptions["ObjCARCExceptions"] = "-fobjc-arc-exceptions"; })
);

context.SelectOption(
Expand Down
22 changes: 22 additions & 0 deletions Sharpmake/Options.XCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public enum EnableBitcode
Disable
}

[Obsolete("Deprecated. Use `CppExceptions`, `ObjCExceptions`, or `ObjCARCExceptions` instead.", error: true)]
public enum Exceptions
{
[Default]
Expand All @@ -242,6 +243,27 @@ public enum Exceptions
EnableObjC,
}

public enum CppExceptions
{
[Default]
Disable,
Enable
}

public enum ObjCExceptions
{
[Default]
Disable,
Enable
}

public enum ObjCARCExceptions
{
[Default]
Disable,
Enable
}

public class ExternalResourceFolders : Strings
{
public ExternalResourceFolders(params string[] paths)
Expand Down

0 comments on commit 965bb6d

Please sign in to comment.