Beispiel #1
0
        public static string GetWindowsExecutablePath(this DevEnv visualVersion, Platform platform)
        {
            KitsRootEnum kitsRoot = KitsRootPaths.GetUseKitsRootForDevEnv(visualVersion);

            string targetPlatform = (platform == Platform.win64) ? "x64" : "x86";

            var paths = new List <string>();

            paths.Add(visualVersion.GetVisualStudioBinPath(platform));

            switch (kitsRoot)
            {
            case KitsRootEnum.KitsRoot:
                paths.Add(Path.Combine(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot), "bin", targetPlatform));
                break;

            case KitsRootEnum.KitsRoot81:
                paths.Add(Path.Combine(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot81), "bin", targetPlatform));
                break;

            case KitsRootEnum.KitsRoot10:
                paths.Add(Path.Combine(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot10), "bin", targetPlatform));
                if (KitsRootPaths.GetWindowsTargetPlatformVersionForDevEnv(visualVersion) <= Options.Vc.General.WindowsTargetPlatformVersion.v10_0_10240_0)
                {
                    paths.Add(Path.Combine(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot81), "bin", targetPlatform));
                }
                break;

            default:
                throw new NotImplementedException("No GetWindowsExecutablePath associated with " + kitsRoot);
            }

            paths.Add("$(PATH)");
            return(string.Join(";", paths));
        }
Beispiel #2
0
            public override void AddCompilerSettings(
                IDictionary <string, CompilerSettings> masterCompilerSettings,
                string compilerName,
                string rootPath,
                DevEnv devEnv,
                string projectRootPath
                )
            {
                var fastBuildCompilerSettings = PlatformRegistry.Get <IWindowsFastBuildCompilerSettings>(Platform.win64);

                if (!fastBuildCompilerSettings.BinPath.ContainsKey(devEnv))
                {
                    fastBuildCompilerSettings.BinPath.Add(devEnv, devEnv.GetVisualStudioBinPath(Platform.win64));
                }
                if (!fastBuildCompilerSettings.LinkerPath.ContainsKey(devEnv))
                {
                    fastBuildCompilerSettings.LinkerPath.Add(devEnv, fastBuildCompilerSettings.BinPath[devEnv]);
                }
                if (!fastBuildCompilerSettings.ResCompiler.ContainsKey(devEnv))
                {
                    fastBuildCompilerSettings.ResCompiler.Add(devEnv, devEnv.GetWindowsResourceCompiler(Platform.win64));
                }

                CompilerSettings compilerSettings = GetMasterCompilerSettings(masterCompilerSettings, compilerName, rootPath, devEnv, projectRootPath, false);

                compilerSettings.PlatformFlags |= Platform.win64;
                SetConfiguration(compilerSettings.Configurations, string.Empty, projectRootPath, devEnv, false);
            }
Beispiel #3
0
            public override void SetConfiguration(IDictionary <string, CompilerSettings.Configuration> configurations, string compilerName, string projectRootPath, DevEnv devEnv, bool useCCompiler)
            {
                string configName = ".win64Config";

                if (!configurations.ContainsKey(configName))
                {
                    var    fastBuildCompilerSettings = PlatformRegistry.Get <IWindowsFastBuildCompilerSettings>(Platform.win64);
                    string binPath;
                    if (!fastBuildCompilerSettings.BinPath.TryGetValue(devEnv, out binPath))
                    {
                        binPath = devEnv.GetVisualStudioBinPath(Platform.win64);
                    }

                    string linkerPath;
                    if (!fastBuildCompilerSettings.LinkerPath.TryGetValue(devEnv, out linkerPath))
                    {
                        linkerPath = binPath;
                    }

                    string linkerExe;
                    if (!fastBuildCompilerSettings.LinkerExe.TryGetValue(devEnv, out linkerExe))
                    {
                        linkerExe = "link.exe";
                    }

                    string librarianExe;
                    if (!fastBuildCompilerSettings.LibrarianExe.TryGetValue(devEnv, out librarianExe))
                    {
                        librarianExe = "lib.exe";
                    }

                    string resCompiler;
                    if (!fastBuildCompilerSettings.ResCompiler.TryGetValue(devEnv, out resCompiler))
                    {
                        resCompiler = devEnv.GetWindowsResourceCompiler(Platform.win64);
                    }

                    configurations.Add(
                        configName,
                        new CompilerSettings.Configuration(
                            Platform.win64,
                            binPath: Util.GetCapitalizedPath(Util.PathGetAbsolute(projectRootPath, binPath)),
                            linkerPath: Util.GetCapitalizedPath(Util.PathGetAbsolute(projectRootPath, linkerPath)),
                            resourceCompiler: Util.GetCapitalizedPath(Util.PathGetAbsolute(projectRootPath, resCompiler)),
                            librarian: Path.Combine(@"$LinkerPath$", librarianExe),
                            linker: Path.Combine(@"$LinkerPath$", linkerExe)
                            )
                        );

                    configurations.Add(
                        ".win64ConfigMasm",
                        new CompilerSettings.Configuration(
                            Platform.win64,
                            compiler: @"$BinPath$\ml64.exe",
                            usingOtherConfiguration: @".win64Config"
                            )
                        );
                }
            }
Beispiel #4
0
        public static string GetDurangoBinPath(this DevEnv visualVersion)
        {
            switch (visualVersion)
            {
            case DevEnv.vs2012:
            {
                if (Durango.Util.IsDurangoSideBySideXDK())
                {
                    return(Path.Combine(GlobalSettings.DurangoXDK, GlobalSettings.XdkEditionTarget, @"Compilers\dev11.1\vc\bin\amd64"));
                }

                return(Path.Combine(GlobalSettings.DurangoXDK, "xdk", "VC", "bin", "amd64"));
            }

            case DevEnv.vs2015:
            case DevEnv.vs2017:
                return(visualVersion.GetVisualStudioBinPath(Platform.win64));
            }

            throw new NotImplementedException("This devEnv (" + visualVersion + ") is not supported on durango!");
        }
Beispiel #5
0
            private void SetConfiguration(
                Project.Configuration conf,
                IDictionary <string, CompilerSettings.Configuration> configurations,
                string configName,
                string projectRootPath,
                DevEnv devEnv,
                bool useCCompiler)
            {
                if (configurations.ContainsKey(configName))
                {
                    return;
                }

                string linkerPathOverride   = null;
                string linkerExeOverride    = null;
                string librarianExeOverride = null;

                GetLinkerExecutableInfo(conf, out linkerPathOverride, out linkerExeOverride, out librarianExeOverride);

                var    fastBuildCompilerSettings = PlatformRegistry.Get <IWindowsFastBuildCompilerSettings>(Platform.win64);
                string binPath;

                if (!fastBuildCompilerSettings.BinPath.TryGetValue(devEnv, out binPath))
                {
                    binPath = devEnv.GetVisualStudioBinPath(Platform.win64);
                }

                string linkerPath;

                if (!string.IsNullOrEmpty(linkerPathOverride))
                {
                    linkerPath = linkerPathOverride;
                }
                else if (!fastBuildCompilerSettings.LinkerPath.TryGetValue(devEnv, out linkerPath))
                {
                    linkerPath = binPath;
                }

                string linkerExe;

                if (!string.IsNullOrEmpty(linkerExeOverride))
                {
                    linkerExe = linkerExeOverride;
                }
                else if (!fastBuildCompilerSettings.LinkerExe.TryGetValue(devEnv, out linkerExe))
                {
                    linkerExe = "link.exe";
                }

                string librarianExe;

                if (!string.IsNullOrEmpty(librarianExeOverride))
                {
                    librarianExe = librarianExeOverride;
                }
                else if (!fastBuildCompilerSettings.LibrarianExe.TryGetValue(devEnv, out librarianExe))
                {
                    librarianExe = "lib.exe";
                }

                string resCompiler;

                if (!fastBuildCompilerSettings.ResCompiler.TryGetValue(devEnv, out resCompiler))
                {
                    resCompiler = devEnv.GetWindowsResourceCompiler(Platform.win64);
                }

                string capitalizedBinPath = Util.GetCapitalizedPath(Util.PathGetAbsolute(projectRootPath, binPath));

                configurations.Add(
                    configName,
                    new CompilerSettings.Configuration(
                        Platform.win64,
                        binPath: capitalizedBinPath,
                        linkerPath: Util.GetCapitalizedPath(Util.PathGetAbsolute(projectRootPath, linkerPath)),
                        resourceCompiler: Util.GetCapitalizedPath(Util.PathGetAbsolute(projectRootPath, resCompiler)),
                        librarian: Path.Combine(@"$LinkerPath$", librarianExe),
                        linker: Path.Combine(@"$LinkerPath$", linkerExe)
                        )
                    );

                string masmConfigurationName = configName + "Masm";
                var    masmConfiguration     = new CompilerSettings.Configuration(
                    Platform.win64,
                    compiler: "ML" + masmConfigurationName,
                    usingOtherConfiguration: configName
                    );

                masmConfiguration.Masm = Path.Combine(capitalizedBinPath, "ml64.exe");

                configurations.Add(
                    masmConfigurationName,
                    masmConfiguration
                    );
            }
Beispiel #6
0
            public override CompilerSettings GetMasterCompilerSettings(
                IDictionary <string, CompilerSettings> masterCompilerSettings,
                string compilerName,
                string rootPath,
                DevEnv devEnv,
                string projectRootPath,
                bool useCCompiler
                )
            {
                CompilerSettings compilerSettings;

                if (masterCompilerSettings.ContainsKey(compilerName))
                {
                    compilerSettings = masterCompilerSettings[compilerName];
                }
                else
                {
                    string pathToCompiler = devEnv.GetVisualStudioBinPath(Platform.win64);
                    if (pathToCompiler.StartsWith(rootPath, StringComparison.OrdinalIgnoreCase))
                    {
                        string rootRelative = pathToCompiler.Substring(rootPath.Length).TrimStart(Util._pathSeparators);
                        pathToCompiler = Path.Combine("$RootPath$", rootRelative);
                    }

                    Strings extraFiles = new Strings();

                    extraFiles.Add(
                        Path.Combine(pathToCompiler, "c1.dll"),
                        Path.Combine(pathToCompiler, "c1xx.dll"),
                        Path.Combine(pathToCompiler, "c2.dll"),
                        Path.Combine(pathToCompiler, "mspdbcore.dll"),
                        Path.Combine(pathToCompiler, "mspdbsrv.exe"),
                        Path.Combine(pathToCompiler, @"1033\clui.dll")
                        );

                    switch (devEnv)
                    {
                    case DevEnv.vs2012:
                    {
                        extraFiles.Add(
                            Path.Combine(pathToCompiler, "c1ast.dll"),
                            Path.Combine(pathToCompiler, "c1xxast.dll"),
                            Path.Combine(pathToCompiler, "mspft110.dll"),
                            Path.Combine(pathToCompiler, "msobj110.dll"),
                            Path.Combine(pathToCompiler, "mspdb110.dll"),
                            @"$RootPath$\redist\x64\Microsoft.VC110.CRT\msvcp110.dll",
                            @"$RootPath$\redist\x64\Microsoft.VC110.CRT\msvcr110.dll",
                            @"$RootPath$\redist\x64\Microsoft.VC110.CRT\vccorlib110.dll"
                            );
                    }
                    break;

                    case DevEnv.vs2013:
                    {
                        extraFiles.Add(
                            Path.Combine(pathToCompiler, "c1ast.dll"),
                            Path.Combine(pathToCompiler, "c1xxast.dll"),
                            Path.Combine(pathToCompiler, "mspft120.dll"),
                            Path.Combine(pathToCompiler, "msobj120.dll"),
                            Path.Combine(pathToCompiler, "mspdb120.dll"),
                            @"$RootPath$\redist\x64\Microsoft.VC120.CRT\msvcp120.dll",
                            @"$RootPath$\redist\x64\Microsoft.VC120.CRT\msvcr120.dll",
                            @"$RootPath$\redist\x64\Microsoft.VC120.CRT\vccorlib120.dll"
                            );
                    }
                    break;

                    case DevEnv.vs2015:
                    case DevEnv.vs2017:
                    {
                        string systemDllPath = FastBuildSettings.SystemDllRoot;
                        if (systemDllPath == null)
                        {
                            systemDllPath = KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot10) + @"Redist\ucrt\DLLs\x64\";
                        }

                        if (!Path.IsPathRooted(systemDllPath))
                        {
                            systemDllPath = Util.SimplifyPath(Path.Combine(projectRootPath, systemDllPath));
                        }

                        extraFiles.Add(
                            Path.Combine(pathToCompiler, "msobj140.dll"),
                            Path.Combine(pathToCompiler, "mspft140.dll"),
                            Path.Combine(pathToCompiler, "mspdb140.dll")
                            );

                        if (devEnv == DevEnv.vs2015)
                        {
                            extraFiles.Add(

                                Path.Combine(pathToCompiler, "vcvars64.bat"),
                                @"$RootPath$\redist\x64\Microsoft.VC140.CRT\concrt140.dll",
                                @"$RootPath$\redist\x64\Microsoft.VC140.CRT\msvcp140.dll",
                                @"$RootPath$\redist\x64\Microsoft.VC140.CRT\vccorlib140.dll",
                                @"$RootPath$\redist\x64\Microsoft.VC140.CRT\vcruntime140.dll",
                                Path.Combine(systemDllPath, "ucrtbase.dll")
                                );
                        }
                        else
                        {
                            extraFiles.Add(
                                Path.Combine(pathToCompiler, "mspdbcore.dll"),
                                Path.Combine(pathToCompiler, "msvcdis140.dll"),
                                Path.Combine(pathToCompiler, "msvcp140.dll"),
                                Path.Combine(pathToCompiler, "pgodb140.dll"),
                                Path.Combine(pathToCompiler, "vcruntime140.dll"),
                                @"$RootPath$\Auxiliary\Build\vcvars64.bat"
                                );
                        }

                        try
                        {
                            foreach (string p in Util.DirectoryGetFiles(systemDllPath, "api-ms-win-*.dll"))
                            {
                                extraFiles.Add(p);
                            }
                        }
                        catch { }
                    }
                    break;

                    default:
                        throw new NotImplementedException("This devEnv (" + devEnv + ") is not supported!");
                    }

                    string executable = Path.Combine(pathToCompiler, "cl.exe");

                    compilerSettings = new CompilerSettings(compilerName, Platform.win64, extraFiles, executable, rootPath, devEnv, new Dictionary <string, CompilerSettings.Configuration>());
                    masterCompilerSettings.Add(compilerName, compilerSettings);
                }

                return(compilerSettings);
            }