Beispiel #1
0
        public static string GetWindowsLibraryPath(this DevEnv visualVersion, Platform platform, DotNetFramework?dotNetFramework = null)
        {
            string visualStudioVCDir = Util.EnsureTrailingSeparator(visualVersion.GetVisualStudioVCRootPath());
            string subDir            = platform == Platform.win64 ? @"\amd64" : "";

            if (visualVersion == DevEnv.vs2017)
            {
                subDir = platform == Platform.win64 ? @"\x64" : @"\x86";
            }

            string visualStudioLib = string.Format(@"{0}lib{1};{0}atlmfc\lib{1};", visualStudioVCDir, subDir);

            if (visualVersion == DevEnv.vs2010)
            {
                return(visualStudioLib);
            }
            else
            {
                KitsRootEnum useKitsRoot    = KitsRootPaths.GetUseKitsRootForDevEnv(visualVersion);
                string       targetPlatform = platform == Platform.win64 ? "x64" : "x86";

                switch (useKitsRoot)
                {
                case KitsRootEnum.KitsRoot:
                {
                    string kitsRoot = Util.EnsureTrailingSeparator(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot));
                    return(string.Format(@"{0};{1}lib\win8\um\{2};{1}References\CommonConfiguration\Neutral;", visualStudioLib, kitsRoot, targetPlatform));
                }

                case KitsRootEnum.KitsRoot81:
                {
                    string kitsRoot = Util.EnsureTrailingSeparator(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot81));
                    return(string.Format(@"{0};{1}lib\winv6.3\um\{2};{1}References\CommonConfiguration\Neutral;", visualStudioLib, kitsRoot, targetPlatform));
                }

                case KitsRootEnum.KitsRoot10:
                {
                    string netFxPath = string.Empty;
                    if (dotNetFramework.HasValue && visualVersion >= DevEnv.vs2015)
                    {
                        string netFXKitsDir = Util.EnsureTrailingSeparator(KitsRootPaths.GetNETFXKitsDir(dotNetFramework.Value < DotNetFramework.v4_6 ? DotNetFramework.v4_6 : dotNetFramework.Value));
                        netFxPath = Path.Combine(netFXKitsDir, "Lib", "um", targetPlatform);
                    }

                    string kitsRoot10      = KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot10);
                    string platformVersion = KitsRootPaths.GetWindowsTargetPlatformVersion();
                    var    paths           = new[]
                    {
                        visualStudioLib,
                        Path.Combine(kitsRoot10, "Lib", platformVersion, "ucrt", targetPlatform),           // $(UniversalCRT_LibraryPath_x86) or $(UniversalCRT_LibraryPath_x64)
                        Path.Combine(kitsRoot10, "Lib", platformVersion, "um", targetPlatform),             // $(WindowsSDK_LibraryPath_x86) or $(WindowsSDK_LibraryPath_x64)
                        netFxPath
                    }.ToList();

                    if (KitsRootPaths.WindowsTargetPlatformVersion <= Options.Vc.General.WindowsTargetPlatformVersion.v10_0_10240_0)
                    {
                        string kitsRoot81 = KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot81);
                        paths.AddRange(new[] {
                                Path.Combine(kitsRoot81, "lib", "winv6.3", "um", targetPlatform),
                                Path.Combine(kitsRoot81, "References", "CommonConfiguration", "Neutral")
                            });
                    }

                    return(string.Join(";", paths));
                }

                default:
                    throw new NotImplementedException("No WindowsResourceCompiler associated with " + visualVersion);
                }
            }
        }
Beispiel #2
0
        public static string GetWindowsIncludePath(this DevEnv visualVersion)
        {
            string visualStudioDir     = Util.EnsureTrailingSeparator(visualVersion.GetVisualStudioVCRootPath());
            string visualStudioInclude = string.Format(@"{0}include;{0}atlmfc\include", visualStudioDir);

            if (visualVersion == DevEnv.vs2010)
            {
                return(visualStudioInclude);
            }
            else
            {
                KitsRootEnum useKitsRoot = KitsRootPaths.GetUseKitsRootForDevEnv(visualVersion);

                switch (useKitsRoot)
                {
                case KitsRootEnum.KitsRoot:
                {
                    string kitsRoot = Util.EnsureTrailingSeparator(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot));
                    return(String.Format(@"{0};{1}Include\shared;{1}Include\um;{1}Include\WinRT;", visualStudioInclude, kitsRoot));
                }

                case KitsRootEnum.KitsRoot81:
                {
                    string kitsRoot = Util.EnsureTrailingSeparator(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot81));
                    return(String.Format(@"{0};{1}Include\shared;{1}Include\um;{1}Include\WinRT;", visualStudioInclude, kitsRoot));
                }

                case KitsRootEnum.KitsRoot10:
                {
                    string kitsRoot10      = Util.EnsureTrailingSeparator(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot10));
                    string platformVersion = KitsRootPaths.GetWindowsTargetPlatformVersion();
                    var    paths           = new List <string> {
                        $@"{visualStudioInclude}",
                        $@"{kitsRoot10}Include\{platformVersion}\um",             // $(UM_IncludePath)
                        $@"{kitsRoot10}Include\{platformVersion}\shared",         // $(KIT_SHARED_IncludePath)
                        $@"{kitsRoot10}Include\{platformVersion}\winrt",          // $(WinRT_IncludePath)
                        $@"{kitsRoot10}Include\{platformVersion}\ucrt",           // $(UniversalCRT_IncludePath)
                    };

                    if (KitsRootPaths.WindowsTargetPlatformVersion <= Options.Vc.General.WindowsTargetPlatformVersion.v10_0_10240_0)
                    {
                        //
                        // Version 10.0.10240.0 and below only contain the UCRT libraries
                        // and headers, not the usual Win32 stuff. So if we are using
                        // version 10240 or older, also include the Windows 8.1 paths so we
                        // have a complete Win32 support.
                        //

                        string kitsRoot81 = Util.EnsureTrailingSeparator(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot81));
                        paths.AddRange(new[]
                            {
                                $@"{kitsRoot81}Include\um",
                                $@"{kitsRoot81}Include\shared"
                            });
                    }

                    return(string.Join(";", paths));
                }

                default:
                    throw new NotImplementedException("No WindowsResourceCompiler associated with " + visualVersion);
                }
            }
        }