From 8a87bdb7696dc7deff126f097e5b75043a13fb7d Mon Sep 17 00:00:00 2001 From: Christian Helmich Date: Thu, 11 May 2023 19:33:17 +0000 Subject: [PATCH] feature (Xcode): add option SupportsMaccatalyst --- .../Apple/BaseApplePlatform.cs | 3 +++ .../Apple/MacCatalystPlatform.cs | 10 ++++++++-- .../Sharpmake.CommonPlatforms/Apple/iOsPlatform.cs | 12 ++++++++++-- Sharpmake/Options.XCode.cs | 12 ++++++++++++ .../XCodeProjects.CommonProject.sharpmake.cs | 1 + 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs index fbf26e54c..747028170 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs @@ -863,6 +863,9 @@ public virtual void SelectCompilerOptions(IGenerationContext context) options["SpecificSimulatorLibraryPaths"] = XCodeUtil.XCodeFormatList(specificSimulatorLibraryPaths, 4); options["WarningOptions"] = FileGeneratorUtilities.RemoveLineTag; + + options["SupportsMaccatalyst"] = FileGeneratorUtilities.RemoveLineTag; + options["SupportsMacDesignedForIphoneIpad"] = FileGeneratorUtilities.RemoveLineTag; } public virtual void SelectPrecompiledHeaderOptions(IGenerationContext context) diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/MacCatalystPlatform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/MacCatalystPlatform.cs index c5878aa6f..7bc148c3e 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/MacCatalystPlatform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/MacCatalystPlatform.cs @@ -77,8 +77,14 @@ public override void SelectCompilerOptions(IGenerationContext context) cmdLineOptions["IPhoneOSDeploymentTarget"] = FileGeneratorUtilities.RemoveLineTag; } - options["SupportsMaccatalyst"] = "YES"; - options["SupportsMacDesignedForIphoneIpad"] = "YES"; + context.SelectOptionWithFallback( + () => options["SupportsMaccatalyst"] = "YES", + Options.Option(Options.XCode.Compiler.SupportsMaccatalyst.Disable, () => options["SupportsMaccatalyst"] = "NO") + ); + context.SelectOptionWithFallback( + () => options["SupportsMacDesignedForIphoneIpad"] = "YES", + Options.Option(Options.XCode.Compiler.SupportsMacDesignedForIphoneIpad.Disable, () => options["SupportsMacDesignedForIphoneIpad"] = "NO") + ); } public override void SelectLinkerOptions(IGenerationContext context) diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/iOsPlatform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/iOsPlatform.cs index f2ff7758c..e00ca8939 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/iOsPlatform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/iOsPlatform.cs @@ -77,8 +77,16 @@ public override void SelectCompilerOptions(IGenerationContext context) cmdLineOptions["IPhoneOSDeploymentTarget"] = FileGeneratorUtilities.RemoveLineTag; } - options["SupportsMaccatalyst"] = "NO"; - options["SupportsMacDesignedForIphoneIpad"] = "NO"; + context.SelectOptionWithFallback( + () => options["SupportsMaccatalyst"] = FileGeneratorUtilities.RemoveLineTag, + Options.Option(Options.XCode.Compiler.SupportsMaccatalyst.Disable, () => options["SupportsMaccatalyst"] = "NO"), + Options.Option(Options.XCode.Compiler.SupportsMaccatalyst.Enable, () => options["SupportsMaccatalyst"] = "YES") + ); + context.SelectOptionWithFallback( + () => options["SupportsMacDesignedForIphoneIpad"] = FileGeneratorUtilities.RemoveLineTag, + Options.Option(Options.XCode.Compiler.SupportsMacDesignedForIphoneIpad.Disable, () => options["SupportsMacDesignedForIphoneIpad"] = "NO"), + Options.Option(Options.XCode.Compiler.SupportsMacDesignedForIphoneIpad.Enable, () => options["SupportsMacDesignedForIphoneIpad"] = "YES") + ); } public override void SelectLinkerOptions(IGenerationContext context) diff --git a/Sharpmake/Options.XCode.cs b/Sharpmake/Options.XCode.cs index af563178c..96d4930b2 100644 --- a/Sharpmake/Options.XCode.cs +++ b/Sharpmake/Options.XCode.cs @@ -635,6 +635,18 @@ public enum TreatWarningsAsErrors [Default] Disable } + + public enum SupportsMaccatalyst + { + Enable, + Disable + } + + public enum SupportsMacDesignedForIphoneIpad + { + Enable, + Disable + } } public static class Linker diff --git a/samples/XCodeProjects/XCodeProjects.CommonProject.sharpmake.cs b/samples/XCodeProjects/XCodeProjects.CommonProject.sharpmake.cs index 6694d084d..1843dbdcd 100644 --- a/samples/XCodeProjects/XCodeProjects.CommonProject.sharpmake.cs +++ b/samples/XCodeProjects/XCodeProjects.CommonProject.sharpmake.cs @@ -130,6 +130,7 @@ public virtual void ConfigureIOS(Configuration conf, CommonTarget target) { conf.LibraryPaths.Add(Path.Combine(Globals.LibrariesDirectory, "iOS")); conf.Options.Add(Options.XCode.Compiler.TargetedDeviceFamily.IosAndIpad); + conf.Options.Add(Options.XCode.Compiler.SupportsMacDesignedForIphoneIpad.Enable); conf.Options.Add(new Sharpmake.Options.XCode.Compiler.SystemFrameworks("UIKit")); }