diff --git a/Sharpmake.Generators/Apple/XCodeProj.Template.cs b/Sharpmake.Generators/Apple/XCodeProj.Template.cs index 9b7e00c57..13e66284a 100644 --- a/Sharpmake.Generators/Apple/XCodeProj.Template.cs +++ b/Sharpmake.Generators/Apple/XCodeProj.Template.cs @@ -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]; diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.Bff.Template.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.Bff.Template.cs index aab99600b..cda2ca568 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.Bff.Template.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.Bff.Template.cs @@ -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 = @" diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs index 359811db0..92f9caf80 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs @@ -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( diff --git a/Sharpmake/Options.XCode.cs b/Sharpmake/Options.XCode.cs index 917c44754..07d17467b 100644 --- a/Sharpmake/Options.XCode.cs +++ b/Sharpmake/Options.XCode.cs @@ -233,6 +233,7 @@ public enum EnableBitcode Disable } + [Obsolete("Deprecated. Use `CppExceptions`, `ObjCExceptions`, or `ObjCARCExceptions` instead.", error: true)] public enum Exceptions { [Default] @@ -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)