Exemplo n.º 1
0
        public static void GetSimulatorCompilerFlags(CompilerFlags flags, bool is_assembler, Application app, string language = null)
        {
            GetCompilerFlags(app, flags, is_assembler, language);

            string sim_platform = Driver.GetPlatformDirectory(app);
            string plist        = Path.Combine(sim_platform, "Info.plist");

            var dict = Driver.FromPList(plist);
            var dp   = dict.Get <PDictionary> ("DefaultProperties");

            if (dp.GetString("GCC_OBJC_LEGACY_DISPATCH") == "YES")
            {
                flags.AddOtherFlag("-fobjc-legacy-dispatch");
            }
            string objc_abi = dp.GetString("OBJC_ABI_VERSION");

            if (!String.IsNullOrWhiteSpace(objc_abi))
            {
                flags.AddOtherFlag($"-fobjc-abi-version={objc_abi}");
            }

            plist = Path.Combine(Driver.GetFrameworkDirectory(app), "SDKSettings.plist");
            string min_prefix = app.CompilerPath.Contains("clang") ? Driver.GetTargetMinSdkName(app) : "iphoneos";

            dict = Driver.FromPList(plist);
            dp   = dict.Get <PDictionary> ("DefaultProperties");
            if (app.DeploymentTarget == new Version())
            {
                string target = dp.GetString("IPHONEOS_DEPLOYMENT_TARGET");
                if (!String.IsNullOrWhiteSpace(target))
                {
                    flags.AddOtherFlag($"-m{min_prefix}-version-min={target}");
                }
            }
            else
            {
                flags.AddOtherFlag($"-m{min_prefix}-version-min={app.DeploymentTarget}");
            }
            string defines = dp.GetString("GCC_PRODUCT_TYPE_PREPROCESSOR_DEFINITIONS");

            if (!String.IsNullOrWhiteSpace(defines))
            {
                flags.AddDefine(defines.Replace(" ", String.Empty));
            }
        }