예제 #1
0
        private static void SetupMacOptions(ParserOptions options)
        {
            options.MicrosoftMode     = false;
            options.NoBuiltinIncludes = true;

            if (Platform.IsMacOS)
            {
                var headersPaths = new List <string> {
                    Path.Combine(GetSourceDirectory("deps"), "llvm/tools/clang/lib/Headers"),
                    Path.Combine(GetSourceDirectory("deps"), "libcxx", "include"),
                    "/usr/include",
                };

                foreach (var header in headersPaths)
                {
                    Console.WriteLine(header);
                }

                foreach (var header in headersPaths)
                {
                    options.AddSystemIncludeDirs(header);
                }
            }

            var headersPath = Path.Combine(GetSourceDirectory("build"), "headers",
                                           "osx");

            options.AddSystemIncludeDirs(Path.Combine(headersPath, "include"));
            options.AddSystemIncludeDirs(Path.Combine(headersPath, "clang", "4.2", "include"));
            options.AddSystemIncludeDirs(Path.Combine(headersPath, "libcxx", "include"));
            options.AddArguments("-stdlib=libc++");
        }
예제 #2
0
파일: ParserGen.cs 프로젝트: zopsi/CppSharp
        private static void SetupMacOptions(ParserOptions options)
        {
            options.MicrosoftMode     = false;
            options.NoBuiltinIncludes = true;

            var headersPath = Path.Combine(GetSourceDirectory("build"), "headers",
                                           "osx");

            options.AddSystemIncludeDirs(Path.Combine(headersPath, "libcxx", "include"));
            options.AddSystemIncludeDirs(options.BuiltinsDir);
            options.AddSystemIncludeDirs(Path.Combine(headersPath, "include"));
            options.AddArguments("-stdlib=libc++");
        }
예제 #3
0
        private static void SetupMacOptions(ParserOptions options)
        {
            options.MicrosoftMode = false;
            options.NoBuiltinIncludes = true;

            if (Platform.IsMacOS)
            {
                var headersPaths = new List<string> {
                    "/usr/include"
                };

                foreach (var header in headersPaths)
                    options.AddSystemIncludeDirs(header);
            }

            options.AddArguments("-stdlib=libc++");
        }
예제 #4
0
        public ParserOptions BuildParserOptions(SourceFile file = null)
        {
            var options = new ParserOptions
            {
                Abi                = ParserOptions.Abi,
                ToolSetToUse       = ParserOptions.ToolSetToUse,
                TargetTriple       = ParserOptions.TargetTriple,
                NoStandardIncludes = ParserOptions.NoStandardIncludes,
                NoBuiltinIncludes  = ParserOptions.NoBuiltinIncludes,
                MicrosoftMode      = ParserOptions.MicrosoftMode,
                Verbose            = ParserOptions.Verbose,
                LanguageVersion    = ParserOptions.LanguageVersion
            };

            // This eventually gets passed to Clang's MSCompatibilityVersion, which
            // is in turn used to derive the value of the built-in define _MSC_VER.
            // It used to receive a 4-digit based identifier but now expects a full
            // version MSVC digit, so check if we still have the old version and
            // convert to the right format.

            if (ParserOptions.ToolSetToUse.ToString(CultureInfo.InvariantCulture).Length == 4)
            {
                ParserOptions.ToolSetToUse *= 100000;
            }

            for (uint i = 0; i < ParserOptions.ArgumentsCount; ++i)
            {
                var arg = ParserOptions.GetArguments(i);
                options.AddArguments(arg);
            }

            for (uint i = 0; i < ParserOptions.IncludeDirsCount; ++i)
            {
                var include = ParserOptions.GetIncludeDirs(i);
                options.AddIncludeDirs(include);
            }

            for (uint i = 0; i < ParserOptions.SystemIncludeDirsCount; ++i)
            {
                var include = ParserOptions.GetSystemIncludeDirs(i);
                options.AddSystemIncludeDirs(include);
            }

            for (uint i = 0; i < ParserOptions.DefinesCount; ++i)
            {
                var define = ParserOptions.GetDefines(i);
                options.AddDefines(define);
            }

            for (uint i = 0; i < ParserOptions.UndefinesCount; ++i)
            {
                var define = ParserOptions.GetUndefines(i);
                options.AddUndefines(define);
            }

            for (uint i = 0; i < ParserOptions.LibraryDirsCount; ++i)
            {
                var lib = ParserOptions.GetLibraryDirs(i);
                options.AddLibraryDirs(lib);
            }

            foreach (var module in Options.Modules.Where(
                         m => file == null || m.Headers.Contains(file.Path)))
            {
                foreach (var include in module.IncludeDirs)
                {
                    options.AddIncludeDirs(include);
                }

                foreach (var define in module.Defines)
                {
                    options.AddDefines(define);
                }

                foreach (var undefine in module.Undefines)
                {
                    options.AddUndefines(undefine);
                }

                foreach (var libraryDir in module.LibraryDirs)
                {
                    options.AddLibraryDirs(libraryDir);
                }
            }

            return(options);
        }