Ejemplo n.º 1
0
        /// <summary>
        /// Sets up the parser options to work with the given Visual Studio toolchain.
        /// </summary>
        /// <param name="vsVersion">The version of Visual Studio to look for.</param>
        public void SetupMSVC(VisualStudioVersion vsVersion)
        {
            MicrosoftMode      = true;
            NoBuiltinIncludes  = true;
            NoStandardIncludes = true;
            Abi = CppAbi.Microsoft;

            vsVersion = MSVCToolchain.FindVSVersion(vsVersion);
            foreach (var include in MSVCToolchain.GetSystemIncludes(vsVersion))
            {
                AddSystemIncludeDirs(include);
            }

            // do not remove the CppSharp prefix becase the Mono C# compiler breaks
            if (!LanguageVersion.HasValue)
            {
                LanguageVersion = CppSharp.LanguageVersion.CPP14_GNU;
            }

            var clVersion = MSVCToolchain.GetCLVersion(vsVersion);

            ToolSetToUse = clVersion.Major * 10000000 + clVersion.Minor * 100000;

            AddArguments("-fms-extensions");
            AddArguments("-fms-compatibility");
            AddArguments("-fdelayed-template-parsing");
        }
Ejemplo n.º 2
0
 /// <summary>Dumps include directories for selected toolchain.</summary>
 /// <param name="vsVersion">The version of Visual Studio to dump the SDK-s of.</param>
 public static void DumpSdkIncludes(VisualStudioVersion vsVersion =
                                    VisualStudioVersion.Latest)
 {
     Console.WriteLine("\nInclude search path (VS: {0}):", vsVersion);
     foreach (var include in MSVCToolchain.GetSystemIncludes(vsVersion))
     {
         Console.WriteLine($"\t{include}");
     }
 }
Ejemplo n.º 3
0
        /// Sets up the parser options to work with the given Visual Studio toolchain.
        public static void SetupMSVC(this ParserOptions options,
                                     VisualStudioVersion vsVersion = VisualStudioVersion.Latest)
        {
            options.MicrosoftMode      = true;
            options.NoBuiltinIncludes  = true;
            options.NoStandardIncludes = true;
            options.Abi = CppAbi.Microsoft;

            var includes = MSVCToolchain.GetSystemIncludes(vsVersion);

            foreach (var include in includes)
            {
                options.addSystemIncludeDirs(include);
            }
        }
Ejemplo n.º 4
0
        public static string FindCSharpCompilerDir()
        {
            if (Platform.IsWindows)
            {
                List <ToolchainVersion> versions;
                if (!MSVCToolchain.GetMSBuildSdks(out versions))
                {
                    throw new Exception("Could not find MSBuild SDK paths");
                }

                var sdk = versions.Last();

                return(sdk.Directory);
            }

            return(FindMonoPath());
        }
Ejemplo n.º 5
0
        /// Sets up the parser options to work with the given Visual Studio toolchain.
        public static void SetupMSVC(this ParserOptions options,
                                     VisualStudioVersion vsVersion = VisualStudioVersion.Latest)
        {
            options.MicrosoftMode      = true;
            options.NoBuiltinIncludes  = true;
            options.NoStandardIncludes = true;
            options.Abi          = CppAbi.Microsoft;
            options.ToolSetToUse = MSVCToolchain.GetCLVersion(vsVersion) * 10000000;

            options.addArguments("-fms-extensions");
            options.addArguments("-fms-compatibility");
            options.addArguments("-fdelayed-template-parsing");

            var includes = MSVCToolchain.GetSystemIncludes(vsVersion);

            foreach (var include in includes)
            {
                options.addSystemIncludeDirs(include);
            }
        }