Beispiel #1
0
            public override void GeneratePlatformSpecificProjectDescription(IVcxprojGenerationContext context, IFileGenerator generator)
            {
                if (GlobalSettings.OverridenDurangoXDK)
                {
                    string durangoXdkKitPath        = FileGeneratorUtilities.RemoveLineTag;
                    string xdkEditionTarget         = FileGeneratorUtilities.RemoveLineTag;
                    string targetPlatformSdkPath    = FileGeneratorUtilities.RemoveLineTag;
                    string durangoXdkCompilers      = FileGeneratorUtilities.RemoveLineTag;
                    string gameOSFilePath           = FileGeneratorUtilities.RemoveLineTag;
                    string durangoXdkTasks          = FileGeneratorUtilities.RemoveLineTag;
                    string targetPlatformIdentifier = FileGeneratorUtilities.RemoveLineTag;
                    string platformFolder           = MSBuildGlobalSettings.GetCppPlatformFolder(context.DevelopmentEnvironmentsRange.MinDevEnv, Platform.durango);
                    string xdkEditionRootVS2015     = FileGeneratorUtilities.RemoveLineTag;
                    string xdkEditionRootVS2017     = FileGeneratorUtilities.RemoveLineTag;
                    string enableLegacyXdkHeaders   = FileGeneratorUtilities.RemoveLineTag;

                    if (!Util.IsDurangoSideBySideXDK())
                    {
                        durangoXdkKitPath = Sharpmake.Util.EnsureTrailingSeparator(Path.Combine(GlobalSettings.DurangoXDK, "xdk"));

                        // Set only if the machine has a SideBySide XDK installed, but we don't generate for one
                        if (Util.IsDurangoSideBySideXDKInstalled())
                        {
                            if (context.ProjectConfigurations.Any(conf => !conf.IsFastBuild))
                            {
                                durangoXdkCompilers = durangoXdkKitPath;
                            }

                            gameOSFilePath = Path.Combine(GlobalSettings.DurangoXDK, "sideload", "era.xvd");

                            // Use the tasks of the system
                            durangoXdkTasks          = Sharpmake.Util.EnsureTrailingSeparator(Path.Combine(Util.GetDurangoXDKInstallPath(), Util.GetLatestDurangoSideBySideXDKInstalled(), "PC", "tasks"));
                            targetPlatformIdentifier = "Xbox.xdk";
                        }
                    }
                    else
                    {
                        xdkEditionTarget      = GlobalSettings.XdkEditionTarget;
                        targetPlatformSdkPath = Util.GetDurangoExtensionXDK();
                    }

                    generator.Write(Vcxproj.Template.Project.ProjectDescriptionStartPlatformConditional);
                    {
                        if (!string.IsNullOrEmpty(platformFolder))
                        {
                            using (generator.Declare("custompropertyname", "_PlatformFolder"))
                                using (generator.Declare("custompropertyvalue", Sharpmake.Util.EnsureTrailingSeparator(platformFolder))) // _PlatformFolder require the path to end with a "\"
                                    generator.Write(Vcxproj.Template.Project.CustomProperty);
                        }

                        if (DevEnv.vs2015 >= context.DevelopmentEnvironmentsRange.MinDevEnv && DevEnv.vs2015 <= context.DevelopmentEnvironmentsRange.MaxDevEnv)
                        {
                            var vs2015PlatformFolder = MSBuildGlobalSettings.GetCppPlatformFolder(DevEnv.vs2015, Platform.durango);
                            if (!string.IsNullOrEmpty(vs2015PlatformFolder))
                            {
                                xdkEditionRootVS2015 = vs2015PlatformFolder;
                            }
                        }

                        if (DevEnv.vs2017 >= context.DevelopmentEnvironmentsRange.MinDevEnv && DevEnv.vs2017 <= context.DevelopmentEnvironmentsRange.MaxDevEnv)
                        {
                            var vs2017PlatformFolder = MSBuildGlobalSettings.GetCppPlatformFolder(DevEnv.vs2017, Platform.durango);
                            if (!string.IsNullOrEmpty(vs2017PlatformFolder))
                            {
                                xdkEditionRootVS2017 = vs2017PlatformFolder;
                            }

                            int  xdkEdition;
                            bool isMinFeb2018Xdk = Util.TryParseXdkEditionTarget(GlobalSettings.XdkEditionTarget, out xdkEdition) && xdkEdition >= GlobalSettings._feb2018XdkEditionTarget;
                            if (GlobalSettings.EnableLegacyXdkHeaders && isMinFeb2018Xdk)
                            {
                                enableLegacyXdkHeaders = "true";
                            }
                        }

                        using (generator.Declare("durangoXdkInstallPath", GlobalSettings.DurangoXDK))
                            using (generator.Declare("sdkReferenceDirectoryRoot", GlobalSettings.XboxOneExtensionSDK))
                                using (generator.Declare("durangoXdkKitPath", durangoXdkKitPath))
                                    using (generator.Declare("xdkEditionTarget", xdkEditionTarget))
                                        using (generator.Declare("targetPlatformSdkPath", targetPlatformSdkPath))
                                            using (generator.Declare("durangoXdkCompilers", durangoXdkCompilers))
                                                using (generator.Declare("gameOSFilePath", gameOSFilePath))
                                                    using (generator.Declare("durangoXdkTasks", durangoXdkTasks))
                                                        using (generator.Declare("targetPlatformIdentifier", targetPlatformIdentifier))
                                                            using (generator.Declare("xdkEditionRootVS2015", xdkEditionRootVS2015))
                                                                using (generator.Declare("xdkEditionRootVS2017", xdkEditionRootVS2017))
                                                                    using (generator.Declare("enableLegacyXdkHeaders", enableLegacyXdkHeaders))
                                                                    {
                                                                        generator.Write(_projectDescriptionPlatformSpecific);
                                                                    }
                    }
                    generator.Write(Vcxproj.Template.Project.PropertyGroupEnd);
                }
            }