示例#1
0
        static void Main(string[] args)
        {
            // If true, outputs C++/CLI wrapper,
            // if false, outputs C wrapper with C# code.
            bool cppCliMode = false;

            var project = WrapperProject.FromFile("bullet3.xml");

            if (!project.VerifyFiles())
            {
                Console.ReadKey();
                return;
            }

            project.ReadCpp();
            var parser = new BulletParser(project);

            parser.Parse();
            Console.WriteLine("Parsing complete");

            CWriter cWriter = new CWriter(parser);

            //project.CProjectPath = "c_temp";
            cWriter.Output();

            DotNetWriter dotNetWriter;

            if (cppCliMode)
            {
                dotNetWriter = new CppCliWriter(parser);
            }
            else
            {
                dotNetWriter = new PInvokeWriter(parser);

                var extensionsWriter = new ExtensionsWriter(parser);
                extensionsWriter.Output();
            }
            dotNetWriter.Output();

            OutputSolution(TargetVS.VS2008, parser);
            OutputSolution(TargetVS.VS2010, parser);
            OutputSolution(TargetVS.VS2012, parser);
            OutputSolution(TargetVS.VS2013, parser);
            OutputSolution(TargetVS.VS2015, parser);
            //project.Save();

            CMakeWriter cmake = new CMakeWriter(parser);

            cmake.Output();

            Console.Write("Press any key to continue...");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            // If true, outputs C++/CLI wrapper,
            // if false, outputs C wrapper with C# code.
            bool cppCliMode = false;

            var project = WrapperProject.FromFile("bullet3.xml");

            if (!project.VerifyFiles())
            {
                Console.ReadKey();
                return;
            }

            var reader = new CppReader(project);
            var parser = new BulletParser(project);

            parser.Parse();
            Console.WriteLine("Parsing complete");

            WrapperWriter writer;

            if (cppCliMode)
            {
                writer = new CppCliWriter(project.HeaderDefinitions.Values, project.NamespaceName);
            }
            else
            {
                writer = new PInvokeWriter(project);

                var extensionWriter = new ExtensionsWriter(project.HeaderDefinitions.Values, project.NamespaceName);
                extensionWriter.Output();
            }
            writer.Output();

            OutputSolution(TargetVS.VS2008, project);
            OutputSolution(TargetVS.VS2010, project);
            OutputSolution(TargetVS.VS2012, project);
            OutputSolution(TargetVS.VS2013, project);
            OutputSolution(TargetVS.VS2015, project);
            //project.Save();

            CMakeWriter cmake = new CMakeWriter(project.HeaderDefinitions, project.NamespaceName);

            cmake.Output();

            Console.Write("Press any key to continue...");
            Console.ReadKey();
        }