public void CppTemplate()
        {
            var project = new WrapperProject();
            project.NamespaceName = "CppTemplate";
            project.ProjectFilePath = "CppTemplate/cpp_template.xml";
            project.SourceRootFolders.Add(".");
            project.ReadCpp();
            project.Save();

            var parser = new DotNetParser(project);
            parser.Parse();

            project.CProjectPath = "CppTemplate_wrap";
            project.CsProjectPath = "CppTemplate_wrap";
            var writer = new PInvokeWriter(parser);
            writer.Output();

            var cmake = new CMakeWriter(parser);
            cmake.Output();

            Assert.AreEqual(1, project.HeaderDefinitions.Count);
            Assert.AreEqual(4, project.ClassDefinitions.Count);
            /*
            var cppClass1 = project.ClassDefinitions.First().Value;
            Assert.AreEqual("CppClass1", cppClass1.Name);
            Assert.AreEqual("CppClass1", cppClass1.ManagedName);
            Assert.AreEqual(2, cppClass1.Methods.Count);
            Assert.AreEqual("Empty", cppClass1.Methods[1].ManagedName);*/
        }
        public static WrapperProject FromFile(string filename)
        {
            var project = new WrapperProject();
            project.ProjectFilePath = Path.GetFullPath(filename);

            Project.WrapperProjectXmlReader.Read(project);

            return project;
        }
        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();
        }
        public PInvokeWriter(WrapperProject project)
            : base(project.HeaderDefinitions.Values, project.NamespaceName)
        {
            this.project = project;

            wrapperHeaderGuards.Add("btActionInterface", "_BT_ACTION_INTERFACE_H");
            wrapperHeaderGuards.Add("btBroadphaseAabbCallback", "BT_BROADPHASE_INTERFACE_H");
            wrapperHeaderGuards.Add("btBroadphaseRayCallback", "BT_BROADPHASE_INTERFACE_H");
            wrapperHeaderGuards.Add("ContactResultCallback", "BT_COLLISION_WORLD_H");
            wrapperHeaderGuards.Add("ConvexResultCallback", "BT_COLLISION_WORLD_H");
            wrapperHeaderGuards.Add("RayResultCallback", "BT_COLLISION_WORLD_H");
            wrapperHeaderGuards.Add("btIDebugDraw", "BT_IDEBUG_DRAW__H");
            wrapperHeaderGuards.Add("btMotionState", "BT_MOTIONSTATE_H");
            wrapperHeaderGuards.Add("btSerializer", "BT_SERIALIZER_H");
            wrapperHeaderGuards.Add("btInternalTriangleIndexCallback", "BT_TRIANGLE_CALLBACK_H");
            wrapperHeaderGuards.Add("btTriangleCallback", "BT_TRIANGLE_CALLBACK_H");
            wrapperHeaderGuards.Add("IControl", "_BT_SOFT_BODY_H");
            wrapperHeaderGuards.Add("ImplicitFn", "_BT_SOFT_BODY_H");
        }
        public void Cpp1()
        {
            var project = new WrapperProject();
            project.NamespaceName = "Cpp1";
            project.ProjectFilePath = "Cpp1/cpp1.xml";
            project.SourceRootFolders.Add(".");
            project.ReadCpp();
            project.Save();

            var parser = new DotNetParser(project);
            parser.Parse();

            project.CProjectPath = "Cpp1_wrap";
            project.CsProjectPath = "Cpp1_wrap";
            var writer = new PInvokeWriter(parser);
            writer.Output();

            Assert.AreEqual(1, project.HeaderDefinitions.Count);
            Assert.AreEqual(1, parser.Classes.Count);
            var cppClass1 = parser.Classes.First().Value;
            Assert.AreEqual("CppClass1", cppClass1.Name);
            Assert.AreEqual(2, cppClass1.Methods.Count);
            Assert.AreEqual("Empty", cppClass1.Methods[1].Name);
        }
Example #6
0
        public BulletParser(WrapperProject project)
            : base(project)
        {
            // Classes that shouldn't be instantiated by users
            var hidePublicConstructors = new HashSet <string> {
                "btActivatingCollisionAlgorithm", "btBroadphaseProxy", "btContactConstraint",
                "btDbvtProxy", "btDispatcherInfo",
                "btUsageBitfield", "btSoftBody::Anchor", "btSoftBody::Config", "btSoftBody::Cluster",
                "btSoftBody::Face", "btSoftBody::Tetra", "btSoftBody::Element", "btSoftBody::Feature",
                "btSoftBody::Link", "btSoftBody::Material", "btSoftBody::Node", "btSoftBody::Note",
                "btSoftBody::Pose", "btSoftBody::SolverState", "btSoftBody::Joint::Specs",
                "btSoftBody::AJoint", "btSoftBody::CJoint", "btSoftBody::LJoint", "btSparseSdf",
                "btCompoundShapeChild", "btMultibodyLink"
            };

            // Classes for which no internal constructor is needed
            var hideInternalConstructor = new HashSet <string> {
                "btAxisSweep3", "bt32BitAxisSweep3",
                "btBoxBoxDetector", "btBroadphaseRayCallback", "btCollisionAlgorithmConstructionInfo", "btDefaultCollisionConstructionInfo",
                "btContinuousConvexCollision",
                "btDefaultMotionState", "btRigidBody", "btDiscreteCollisionDetectorInterface::ClosestPointInput",
                "btGjkConvexCast", "btGjkEpaPenetrationDepthSolver",
                "btMinkowskiPenetrationDepthSolver", "btPointCollector",
                "btMultiBodyDynamicsWorld",
                "btDefaultVehicleRaycaster", "btRaycastVehicle", "btDefaultSerializer",
                "btSoftBodyRigidBodyCollisionConfiguration", "btCPUVertexBufferDescriptor",
                "btSoftRigidDynamicsWorld",
                "SpuGatheringCollisionDispatcher", "btConvexSeparatingDistanceUtil",
                "btVehicleRaycaster::btVehicleRaycasterResult", "btOverlapCallback",
                "btRaycastVehicle::btVehicleTuning",
                "btBox2dShape", "btBoxShape", "btCapsuleShapeX", "btCapsuleShapeZ",
                "btCylinderShapeX", "btCylinderShapeZ",
                "btConeShapeX", "btConeShapeZ", "btConvex2dShape", "btConvexHullShape",
                "btConvexPointCloudShape", "btEmptyShape", "btHeightfieldTerrainShape", "btMinkowskiSumShape",
                "btMultiSphereShape", "btMultimaterialTriangleMeshShape", "btScaledBvhTriangleMeshShape",
                "btSphereShape", "btStaticPlaneShape", "btUniformScalingShape",
                "btCollisionWorld::ConvexResultCallback", "btCollisionWorld::ClosestConvexResultCallback",
                "HACD", "btRigidBody::btRigidBodyConstructionInfo",
                "btSoftBody::ImplicitFn", "btTriangleBuffer", "btMaterialProperties",
                "btCollisionWorld::AllHitsRayResultCallback", "btCollisionWorld::ContactResultCallback",
                "btCollisionWorld::ClosestRayResultCallback", "btCollisionWorld::RayResultCallback",
                "btJointFeedback", "btTypedConstraint::btConstraintInfo1", "btTypedConstraint::btConstraintInfo2",
                "btConeTwistConstraint", "btFixedConstraint", "btGearConstraint",
                "btGeneric6DofSpringConstraint", "btHinge2Constraint",
                "btHingeAccumulatedAngleConstraint", "btPoint2PointConstraint",
                "btSliderConstraint", "btUniversalConstraint",
                "btMLCPSolver", "btMultiBodyConstraintSolver", "btNNCGConstraintSolver",
                "btPairCachingGhostObject", "btSortedOverlappingPairCache", "btNullPairCache",
                "btDbvtBroadphase",
                "btShapeHull", "btSoftBody::sRayCast", "btSoftBody::AJoint::Specs", "btSoftBody::LJoint::Specs",
                "btCompoundShape" // constructor needed for CompoundFromGImpact in C++/CLI, but not C#
            };

            // Classes that have OnDisposing/OnDisposed events
            var trackingDisposable = new HashSet <string> {
                "btCollisionObject", "btCollisionShape",
                "btDbvt", "btRaycastVehicle", "btTypedConstraint"
            };

            // Apply class properties
            foreach (var @class in Project.ClassDefinitions.Values)
            {
                if (hidePublicConstructors.Contains(@class.FullyQualifiedName))
                {
                    @class.HidePublicConstructors = true;
                }

                if (hideInternalConstructor.Contains(@class.FullyQualifiedName))
                {
                    @class.NoInternalConstructor = true;
                }
                if (trackingDisposable.Contains(@class.FullyQualifiedName))
                {
                    @class.IsTrackingDisposable = true;
                }
            }
        }
Example #7
0
 public DotNetParser(WrapperProject project)
     : base(project)
 {
 }
 public CppCliWriter(WrapperProject project)
     : base(project.HeaderDefinitions.Values, project.NamespaceName)
 {
     _project = project;
 }
        static void OutputSolution(TargetVS targetVS, WrapperProject project)
        {
            string targetVersionString;

            switch (targetVS)
            {
            case TargetVS.VS2008:
                targetVersionString = "2008";
                break;

            case TargetVS.VS2010:
                targetVersionString = "2010";
                break;

            case TargetVS.VS2012:
                targetVersionString = "2012";
                break;

            case TargetVS.VS2013:
                targetVersionString = "2013";
                break;

            case TargetVS.VS2015:
                targetVersionString = "2015";
                break;

            default:
                throw new NotImplementedException();
            }

            string slnRelDir  = (targetVS == TargetVS.VS2010) ? "" : "..\\";
            string rootFolder = slnRelDir + "src\\";

            List <ProjectConfiguration> confs = new List <ProjectConfiguration>();

            confs.Add(new ProjectConfiguration("Axiom", true, "GRAPHICS_AXIOM", slnRelDir + "..\\Axiom-SDK-0.8.3376.12322\\bin\\Net35"));
            confs.Add(new ProjectConfiguration("Axiom", false, "GRAPHICS_AXIOM", slnRelDir + "..\\Axiom-SDK-0.8.3376.12322\\bin\\Net35"));
            confs.Add(new ProjectConfiguration("Generic", true, "GRAPHICS_GENERIC"));
            confs.Add(new ProjectConfiguration("Generic", false, "GRAPHICS_GENERIC"));
            confs.Add(new ProjectConfiguration("Mogre", true, "GRAPHICS_MOGRE", "C:\\MogreSDK\\bin\\Debug"));
            confs.Add(new ProjectConfiguration("Mogre", false, "GRAPHICS_MOGRE", "C:\\MogreSDK\\bin\\Release"));
            if (targetVS != TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("MonoGame", true, "GRAPHICS_MONOGAME", "$(ProgramFiles)\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\;$(ProgramFiles(x86))\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\"));
                confs.Add(new ProjectConfiguration("MonoGame", false, "GRAPHICS_MONOGAME", "$(ProgramFiles)\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\;$(ProgramFiles(x86))\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\"));
            }
            if (targetVS != TargetVS.VS2008 && targetVS != TargetVS.VS2010)
            {
                confs.Add(new ProjectConfiguration("Numerics", true, "GRAPHICS_NUMERICS"));
                confs.Add(new ProjectConfiguration("Numerics", false, "GRAPHICS_NUMERICS"));
            }
            if (targetVS == TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("OpenTK", true, "GRAPHICS_OPENTK", "$(USERPROFILE)\\My Documents\\OpenTK\\1.1\\Binaries\\OpenTK\\Release"));
                confs.Add(new ProjectConfiguration("OpenTK", false, "GRAPHICS_OPENTK", "$(USERPROFILE)\\My Documents\\OpenTK\\1.1\\Binaries\\OpenTK\\Release"));
                confs.Add(new ProjectConfiguration("SharpDX", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net20"));
                confs.Add(new ProjectConfiguration("SharpDX", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net20"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net20"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net20"));
                confs.Add(new ProjectConfiguration("SlimDX", true, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net20\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net20\\"));
                confs.Add(new ProjectConfiguration("SlimDX", false, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net20\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net20\\"));
            }
            else
            {
                confs.Add(new ProjectConfiguration("OpenTK", true, "GRAPHICS_OPENTK")
                {
                    ConditionalRef         = "OpenTK",
                    ConditionalRefAssembly = "OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"
                });
                confs.Add(new ProjectConfiguration("OpenTK", false, "GRAPHICS_OPENTK")
                {
                    ConditionalRef         = "OpenTK",
                    ConditionalRefAssembly = "OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"
                });
                confs.Add(new ProjectConfiguration("SharpDX", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net40"));
                confs.Add(new ProjectConfiguration("SharpDX", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net40"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net40"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net40"));
                confs.Add(new ProjectConfiguration("SlimDX", true, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net40\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net40\\"));
                confs.Add(new ProjectConfiguration("SlimDX", false, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net40\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net40\\"));
            }
            //confs.Add(new ProjectConfiguration("SlimMath", true, "GRAPHICS_SLIMMATH", slnRelDir + "..\\SlimMath\\SlimMath\\bin\\Release"));
            //confs.Add(new ProjectConfiguration("SlimMath", false, "GRAPHICS_SLIMMATH", slnRelDir + "..\\SlimMath\\SlimMath\\bin\\Debug"));
            if (targetVS != TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("Windows API Code Pack", true, "GRAPHICS_WAPICODEPACK", slnRelDir + "..\\Windows API Code Pack 1.1\\binaries\\DirectX"));
                confs.Add(new ProjectConfiguration("Windows API Code Pack", false, "GRAPHICS_WAPICODEPACK", slnRelDir + "..\\Windows API Code Pack 1.1\\binaries\\DirectX"));
            }

            /*
             * confs.Add(new ProjectConfiguration("XNA 3.1", true, "GRAPHICS_XNA31", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\"));
             * confs.Add(new ProjectConfiguration("XNA 3.1", false, "GRAPHICS_XNA31", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\"));
             * if (targetVS != TargetVS.VS2008)
             * {
             *  confs.Add(new ProjectConfiguration("XNA 4.0", true, "GRAPHICS_XNA40", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\"));
             *  confs.Add(new ProjectConfiguration("XNA 4.0", false, "GRAPHICS_XNA40", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\"));
             * }
             */

            var filterWriter   = new FilterWriter(project.NamespaceName);
            var sourceFilter   = new Filter("Source Files", "4FC737F1-C7A5-4376-A066-2A32D752A2FF", "cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx");
            var headerFilter   = new Filter("Header Files", "93995380-89BD-4b04-88EB-625FBE52EBFB", "h;hh;hpp;hxx;hm;inl;inc;xsd");
            var resourceFilter = new Filter("Resource Files", "67DA6AB6-F800-4c08-8B7A-83BB121AAD01", "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms");

            filterWriter.RootFilter.Add(sourceFilter);
            filterWriter.RootFilter.Add(headerFilter);
            filterWriter.RootFilter.Add(resourceFilter);

            sourceFilter.AddFile("", rootFolder + "Stdafx");
            sourceFilter.AddFile("", rootFolder + "AssemblyInfo");
            sourceFilter.AddFile("", rootFolder + "Collections");
            sourceFilter.AddFile("", rootFolder + "Math");
            sourceFilter.AddFile("", rootFolder + "StringConv");
            sourceFilter.AddFile("", rootFolder + "DataStream");
            sourceFilter.AddFile("", rootFolder + "Matrix");
            sourceFilter.AddFile("", rootFolder + "Quaternion");
            sourceFilter.AddFile("", rootFolder + "Utilities");
            sourceFilter.AddFile("", rootFolder + "Vector3");
            sourceFilter.AddFile("", rootFolder + "Vector4");

            headerFilter.AddFile("", rootFolder + "Stdafx");
            headerFilter.AddFile("", rootFolder + "Collections");
            headerFilter.AddFile("", rootFolder + "Enums");
            headerFilter.AddFile("", rootFolder + "ITrackingDisposable");
            headerFilter.AddFile("", rootFolder + "Math");
            headerFilter.AddFile("", rootFolder + "StringConv");
            headerFilter.AddFile("", rootFolder + "Version");
            headerFilter.AddFile("", rootFolder + "DataStream");
            headerFilter.AddFile("", rootFolder + "Matrix");
            headerFilter.AddFile("", rootFolder + "Quaternion");
            headerFilter.AddFile("", rootFolder + "Utilities");
            headerFilter.AddFile("", rootFolder + "Vector3");
            headerFilter.AddFile("", rootFolder + "Vector4");

            foreach (HeaderDefinition header in project.HeaderDefinitions.Values)
            {
                if (header.Classes.Count == 0)
                {
                    continue;
                }

                sourceFilter.AddFile(header.Filename, rootFolder + header.ManagedName);
                headerFilter.AddFile(header.Filename, rootFolder + header.ManagedName);
            }

            sourceFilter.AddFile("BulletCollision/CollisionDispatch/", rootFolder + "InternalEdgeUtility");
            sourceFilter.AddFile("BulletCollision/CollisionShapes/", rootFolder + "BulletMaterial");
            sourceFilter.AddFile("BulletCollision/NarrowPhaseCollision/", rootFolder + "SimplexSolverInterface");
            sourceFilter.AddFile("LinearMath/", rootFolder + "DebugDraw");
            sourceFilter.AddFile("SoftBody/", rootFolder + "SoftBodySolver");
            headerFilter.AddFile("BulletCollision/CollisionDispatch/", rootFolder + "InternalEdgeUtility");
            headerFilter.AddFile("BulletCollision/CollisionShapes/", rootFolder + "BulletMaterial");
            headerFilter.AddFile("BulletCollision/NarrowPhaseCollision/", rootFolder + "SimplexSolverInterface");
            headerFilter.AddFile("LinearMath/", rootFolder + "DebugDraw");
            headerFilter.AddFile("BulletDynamics/Character/", rootFolder + "ICharacterController");
            headerFilter.AddFile("LinearMath/", rootFolder + "IDebugDraw");
            headerFilter.AddFile("SoftBody/", rootFolder + "SoftBodySolver");

            resourceFilter.AddFile("", rootFolder + "Resources.rc");

            filterWriter.RootFilter.Sort();

            string bulletRoot = "..\\bullet3";

            var slnWriter = new SlnWriter(filterWriter, project.NamespaceName)
            {
                IncludeDirectories = string.Format("{0}\\src;{0}\\Extras\\HACD;{0}\\Extras\\Serialize\\BulletWorldImporter;", slnRelDir + bulletRoot),
                FilterWriter       = filterWriter
            };

            if (targetVS == TargetVS.VS2008)
            {
                slnWriter.LibraryDirectoriesRelease = slnRelDir + bulletRoot + "\\msvc\\2008\\lib\\MinSizeRel";
                slnWriter.LibraryDirectoriesDebug   = slnRelDir + bulletRoot + "\\msvc\\2008\\lib\\Debug";
            }
            else
            {
                slnWriter.LibraryDirectoriesRelease = slnRelDir + bulletRoot + "\\msvc\\" + targetVersionString + "\\lib\\MinSizeRel;";
                slnWriter.LibraryDirectoriesDebug   = slnRelDir + bulletRoot + "\\msvc\\" + targetVersionString + "\\lib\\Debug;";
            }
            slnWriter.Output(targetVS, confs, "sln" + targetVersionString);
        }
        static void OutputSolution(TargetVS targetVS, WrapperProject project)
        {
            string targetVersionString;
            switch (targetVS)
            {
                case TargetVS.VS2008:
                    targetVersionString = "2008";
                    break;
                case TargetVS.VS2010:
                    targetVersionString = "2010";
                    break;
                case TargetVS.VS2012:
                    targetVersionString = "2012";
                    break;
                case TargetVS.VS2013:
                    targetVersionString = "2013";
                    break;
                case TargetVS.VS2015:
                    targetVersionString = "2015";
                    break;
                default:
                    throw new NotImplementedException();
            }

            string slnRelDir = (targetVS == TargetVS.VS2010) ? "" : "..\\";
            string rootFolder = slnRelDir + "src\\";

            var confs = new List<ProjectConfiguration>
            {
                new ProjectConfiguration("Axiom", true, "GRAPHICS_AXIOM",
                    slnRelDir + "..\\Axiom-SDK-0.8.3376.12322\\bin\\Net35"),
                new ProjectConfiguration("Axiom", false, "GRAPHICS_AXIOM",
                    slnRelDir + "..\\Axiom-SDK-0.8.3376.12322\\bin\\Net35"),
                new ProjectConfiguration("Generic", true, "GRAPHICS_GENERIC"),
                new ProjectConfiguration("Generic", false, "GRAPHICS_GENERIC"),
                new ProjectConfiguration("Mogre", true, "GRAPHICS_MOGRE", "C:\\MogreSDK\\bin\\Debug"),
                new ProjectConfiguration("Mogre", false, "GRAPHICS_MOGRE", "C:\\MogreSDK\\bin\\Release")
            };
            if (targetVS != TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("MonoGame", true, "GRAPHICS_MONOGAME", "$(ProgramFiles)\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\;$(ProgramFiles(x86))\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\"));
                confs.Add(new ProjectConfiguration("MonoGame", false, "GRAPHICS_MONOGAME", "$(ProgramFiles)\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\;$(ProgramFiles(x86))\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\"));
            }
            if (targetVS != TargetVS.VS2008 && targetVS != TargetVS.VS2010)
            {
                confs.Add(new ProjectConfiguration("Numerics", true, "GRAPHICS_NUMERICS"));
                confs.Add(new ProjectConfiguration("Numerics", false, "GRAPHICS_NUMERICS"));
            }
            if (targetVS == TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("OpenTK", true, "GRAPHICS_OPENTK", "$(USERPROFILE)\\My Documents\\OpenTK\\1.1\\Binaries\\OpenTK\\Release"));
                confs.Add(new ProjectConfiguration("OpenTK", false, "GRAPHICS_OPENTK", "$(USERPROFILE)\\My Documents\\OpenTK\\1.1\\Binaries\\OpenTK\\Release"));
                confs.Add(new ProjectConfiguration("SharpDX", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net20"));
                confs.Add(new ProjectConfiguration("SharpDX", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net20"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net20"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net20"));
                confs.Add(new ProjectConfiguration("SlimDX", true, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net20\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net20\\"));
                confs.Add(new ProjectConfiguration("SlimDX", false, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net20\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net20\\"));
            }
            else
            {
                confs.Add(new ProjectConfiguration("OpenTK", true, "GRAPHICS_OPENTK")
                {
                    ConditionalRef = "OpenTK",
                    ConditionalRefAssembly = "OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"
                });
                confs.Add(new ProjectConfiguration("OpenTK", false, "GRAPHICS_OPENTK")
                {
                    ConditionalRef = "OpenTK",
                    ConditionalRefAssembly = "OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"
                });
                confs.Add(new ProjectConfiguration("SharpDX", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net40"));
                confs.Add(new ProjectConfiguration("SharpDX", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net40"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net40"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net40"));
                confs.Add(new ProjectConfiguration("SlimDX", true, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net40\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net40\\"));
                confs.Add(new ProjectConfiguration("SlimDX", false, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net40\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net40\\"));
            }
            //confs.Add(new ProjectConfiguration("SlimMath", true, "GRAPHICS_SLIMMATH", slnRelDir + "..\\SlimMath\\SlimMath\\bin\\Release"));
            //confs.Add(new ProjectConfiguration("SlimMath", false, "GRAPHICS_SLIMMATH", slnRelDir + "..\\SlimMath\\SlimMath\\bin\\Debug"));
            if (targetVS != TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("Windows API Code Pack", true, "GRAPHICS_WAPICODEPACK", slnRelDir + "..\\Windows API Code Pack 1.1\\binaries\\DirectX"));
                confs.Add(new ProjectConfiguration("Windows API Code Pack", false, "GRAPHICS_WAPICODEPACK", slnRelDir + "..\\Windows API Code Pack 1.1\\binaries\\DirectX"));
            }
            /*
            confs.Add(new ProjectConfiguration("XNA 3.1", true, "GRAPHICS_XNA31", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\"));
            confs.Add(new ProjectConfiguration("XNA 3.1", false, "GRAPHICS_XNA31", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\"));
            if (targetVS != TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("XNA 4.0", true, "GRAPHICS_XNA40", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\"));
                confs.Add(new ProjectConfiguration("XNA 4.0", false, "GRAPHICS_XNA40", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\"));
            }
            */

            var filterWriter = new FilterWriter(project.NamespaceName);
            var sourceFilter = new Filter("Source Files", "4FC737F1-C7A5-4376-A066-2A32D752A2FF", "cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx");
            var headerFilter = new Filter("Header Files", "93995380-89BD-4b04-88EB-625FBE52EBFB", "h;hh;hpp;hxx;hm;inl;inc;xsd");
            var resourceFilter = new Filter("Resource Files", "67DA6AB6-F800-4c08-8B7A-83BB121AAD01", "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms");
            filterWriter.RootFilter.Add(sourceFilter);
            filterWriter.RootFilter.Add(headerFilter);
            filterWriter.RootFilter.Add(resourceFilter);

            sourceFilter.AddFile("", rootFolder + "Stdafx");
            sourceFilter.AddFile("", rootFolder + "AssemblyInfo");
            sourceFilter.AddFile("", rootFolder + "Collections");
            sourceFilter.AddFile("", rootFolder + "Math");
            sourceFilter.AddFile("", rootFolder + "StringConv");
            sourceFilter.AddFile("", rootFolder + "DataStream");
            sourceFilter.AddFile("", rootFolder + "Matrix");
            sourceFilter.AddFile("", rootFolder + "Quaternion");
            sourceFilter.AddFile("", rootFolder + "Utilities");
            sourceFilter.AddFile("", rootFolder + "Vector3");
            sourceFilter.AddFile("", rootFolder + "Vector4");

            headerFilter.AddFile("", rootFolder + "Stdafx");
            headerFilter.AddFile("", rootFolder + "Collections");
            headerFilter.AddFile("", rootFolder + "Enums");
            headerFilter.AddFile("", rootFolder + "ITrackingDisposable");
            headerFilter.AddFile("", rootFolder + "Math");
            headerFilter.AddFile("", rootFolder + "StringConv");
            headerFilter.AddFile("", rootFolder + "Version");
            headerFilter.AddFile("", rootFolder + "DataStream");
            headerFilter.AddFile("", rootFolder + "Matrix");
            headerFilter.AddFile("", rootFolder + "Quaternion");
            headerFilter.AddFile("", rootFolder + "Utilities");
            headerFilter.AddFile("", rootFolder + "Vector3");
            headerFilter.AddFile("", rootFolder + "Vector4");

            foreach (HeaderDefinition header in project.HeaderDefinitions.Values)
            {
                if (header.Classes.Count == 0)
                {
                    continue;
                }

                sourceFilter.AddFile(header.Filename, rootFolder + header.ManagedName);
                headerFilter.AddFile(header.Filename, rootFolder + header.ManagedName);
            }

            sourceFilter.AddFile("BulletCollision/CollisionDispatch/", rootFolder + "InternalEdgeUtility");
            sourceFilter.AddFile("BulletCollision/CollisionShapes/", rootFolder + "BulletMaterial");
            sourceFilter.AddFile("BulletCollision/NarrowPhaseCollision/", rootFolder + "SimplexSolverInterface");
            sourceFilter.AddFile("LinearMath/", rootFolder + "DebugDraw");
            sourceFilter.AddFile("SoftBody/", rootFolder + "SoftBodySolver");
            headerFilter.AddFile("BulletCollision/CollisionDispatch/", rootFolder + "InternalEdgeUtility");
            headerFilter.AddFile("BulletCollision/CollisionShapes/", rootFolder + "BulletMaterial");
            headerFilter.AddFile("BulletCollision/NarrowPhaseCollision/", rootFolder + "SimplexSolverInterface");
            headerFilter.AddFile("LinearMath/", rootFolder + "DebugDraw");
            headerFilter.AddFile("BulletDynamics/Character/", rootFolder + "ICharacterController");
            headerFilter.AddFile("LinearMath/", rootFolder + "IDebugDraw");
            headerFilter.AddFile("SoftBody/", rootFolder + "SoftBodySolver");

            resourceFilter.AddFile("", rootFolder + "Resources.rc");

            filterWriter.RootFilter.Sort();

            string bulletRoot = "..\\bullet3";

            /*
            foreach (string sourceRootFolder in project.SourceRootFolders)
            {
                string sourceRootFolderRel = WrapperProject.MakeRelativePath(project.ProjectFilePath, sourceRootFolder);
                sourceRootFolderRel.ToString();
            }
            */

            var slnWriter = new SlnWriter(filterWriter, project.NamespaceName)
            {
                IncludeDirectories = string.Format("{0}\\src;{0}\\Extras\\HACD;{0}\\Extras\\Serialize\\BulletWorldImporter;{0}\\Extras\\Serialize\\BulletXmlWorldImporter;", slnRelDir + bulletRoot),
                FilterWriter = filterWriter
            };
            if (targetVS == TargetVS.VS2008)
            {
                slnWriter.LibraryDirectoriesRelease = slnRelDir + bulletRoot + "\\msvc\\2008\\lib\\MinSizeRel";
                slnWriter.LibraryDirectoriesDebug = slnRelDir + bulletRoot + "\\msvc\\2008\\lib\\Debug";
            }
            else
            {
                slnWriter.LibraryDirectoriesRelease = slnRelDir + bulletRoot + "\\msvc\\" + targetVersionString + "\\lib\\MinSizeRel;";
                slnWriter.LibraryDirectoriesDebug = slnRelDir + bulletRoot + "\\msvc\\" + targetVersionString + "\\lib\\Debug;";
            }
            slnWriter.Output(targetVS, confs, "sln" + targetVersionString);
        }
 public DefaultParser(WrapperProject project)
 {
     Project = project;
 }
 public CMakeWriter(WrapperProject project)
 {
     _project = project;
 }
Example #13
0
        void WriteHeader(HeaderDefinition header, string sourceRootFolder)
        {
            // Entirely skip headers that have no classes
            // TODO: parse C++ methods outside of classes
            if (header.AllClasses.All(@class => @class.IsExcluded))
            {
                return;
            }

            // Some headers only need a C# wrapper class, skip C part
            bool hasCWrapper = header.AllClasses.Any(@class =>
                                                     [email protected] &&
                                                     @class.Methods.Any(m => !m.IsExcluded) &&
                                                     !(@class is ClassTemplateDefinition));

            if (!hasCWrapper)
            {
                return;
            }

            // C++ header file
            string headerPath     = header.Name + "_wrap.h";
            string headerFullPath = Path.Combine(Project.CProjectPathFull, headerPath);

            OpenFile(headerFullPath, WriteTo.Header);
            WriteLine("#include \"main.h\"");
            WriteLine();

            // C++ source file
            string sourcePath     = header.Name + "_wrap.cpp";
            string sourceFullPath = Path.Combine(Project.CProjectPathFull, sourcePath);

            OpenFile(sourceFullPath, WriteTo.Source);

            // C++ #includes
            var includes = new List <string>();

            foreach (var includeHeader in header.Includes.Concat(new[] { header }))
            {
                // No need to include the base class header,
                // it will already be included by the header of this class.
                if (includeHeader != header &&
                    header.AllClasses.Any(c => c.BaseClass != null && c.BaseClass.Header == includeHeader))
                {
                    continue;
                }

                string includePath =
                    WrapperProject.MakeRelativePath(sourceRootFolder, includeHeader.Filename).Replace('\\', '/');
                includes.Add(includePath);
            }
            includes.Sort();
            foreach (var include in includes)
            {
                WriteLine($"#include <{include}>");
            }
            WriteLine();
            if (RequiresConversionHeader(header))
            {
                WriteLine("#include \"conversion.h\"");
            }
            WriteLine($"#include \"{headerPath}\"");


            // Write wrapper class headers
            To = WriteTo.Header;
            _hasCppClassSeparatingWhitespace = true;
            var wrappedClasses = header.AllClasses
                                 .Where(x => _wrapperHeaderGuards.ContainsKey(x.Name))
                                 .OrderBy(GetFullNameC).ToList();

            if (wrappedClasses.Count != 0)
            {
                WriteLine($"#ifndef {_wrapperHeaderGuards[wrappedClasses[0].Name]}");
                foreach (var @class in wrappedClasses)
                {
                    foreach (var method in @class.Methods.Where(m => m.IsVirtual))
                    {
                        WriteLine($"#define p_{GetFullNameC(@class)}_{method.Name} void*");
                    }
                }
                foreach (var @class in wrappedClasses)
                {
                    WriteLine($"#define {GetFullNameC(@class)}Wrapper void");
                }
                WriteLine("#else");
                foreach (var @class in wrappedClasses)
                {
                    WriteWrapperClass(@class);
                }
                WriteLine("#endif");
                WriteLine();
            }

            // Write classes
            WriteLine("extern \"C\"");
            WriteLine("{");
            _hasCppClassSeparatingWhitespace = true;

            foreach (var @class in header.Classes
                     .Where(c => !IsExcludedClass(c)))
            {
                WriteClass(@class, 1);
            }

            WriteLine('}', WriteTo.Header);

            CloseFile(WriteTo.Header);
            CloseFile(WriteTo.Source);
        }
        public CppReader(WrapperProject project)
        {
            this.project = project;

            foreach (string sourceRelDir in project.SourceRootFolders)
            {
                string sourceFullDir = Path.GetFullPath(sourceRelDir).Replace('\\', '/');

                // Enumerate all header files in the source tree
                var headerFiles = Directory.EnumerateFiles(sourceFullDir, "*.h", SearchOption.AllDirectories);
                foreach (string headerFullDir in headerFiles)
                {
                    string headerFullDirCanonical = headerFullDir.Replace('\\', '/');
                    string headerRelDir           = headerFullDirCanonical.Substring(sourceFullDir.Length);

                    HeaderDefinition header;
                    if (project.HeaderDefinitions.TryGetValue(headerFullDirCanonical, out header))
                    {
                        if (header.IsExcluded)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        Console.WriteLine("New file {0}", headerFullDirCanonical);
                    }

                    headerQueue.Add(headerFullDirCanonical);
                }

                // Include directory
                clangOptions.Add("-I");
                clangOptions.Add(sourceFullDir);
            }

            // WorldImporter include directory
            //clangOptions.Add("-I");
            //clangOptions.Add(src + "../Extras/Serialize/BulletWorldImporter");

            // Specify C++ headers, not C ones
            clangOptions.Add("-x");
            clangOptions.Add("c++-header");

            //clangOptions.Add("-DUSE_DOUBLE_PRECISION");

            // Exclude irrelevant methods
            excludedMethods.Add("operator new");
            excludedMethods.Add("operator delete");
            excludedMethods.Add("operator new[]");
            excludedMethods.Add("operator delete[]");
            excludedMethods.Add("operator+=");
            excludedMethods.Add("operator-=");
            excludedMethods.Add("operator*=");
            excludedMethods.Add("operator/=");
            excludedMethods.Add("operator==");
            excludedMethods.Add("operator!=");
            excludedMethods.Add("operator()");

            Console.Write("Reading headers");

            index = new Index();

            while (headerQueue.Count != 0)
            {
                ReadHeader(headerQueue[0]);
            }

            /*
             * if (Directory.Exists(src + "..\\Extras\\"))
             * {
             *  ReadHeader(src + "..\\Extras\\Serialize\\BulletFileLoader\\btBulletFile.h");
             *  ReadHeader(src + "..\\Extras\\Serialize\\BulletWorldImporter\\btBulletWorldImporter.h");
             *  ReadHeader(src + "..\\Extras\\Serialize\\BulletWorldImporter\\btWorldImporter.h");
             *  ReadHeader(src + "..\\Extras\\Serialize\\BulletXmlWorldImporter\\btBulletXmlWorldImporter.h");
             * }
             */
            index.Dispose();

            Console.WriteLine();
            Console.WriteLine("Read complete - headers: {0}, classes: {1}",
                              project.HeaderDefinitions.Count, project.ClassDefinitions.Count);


            foreach (var @class in project.ClassDefinitions.Values.Where(c => !c.IsParsed))
            {
                Console.WriteLine("Class removed: {0}", @class.FullyQualifiedName);
            }
        }
 public DefaultParser(WrapperProject project)
 {
     Project = project;
     if (project.ClassNameMapping == null) project.ClassNameMapping = new DefaultNameMapping();
     if (project.HeaderNameMapping == null) project.HeaderNameMapping = new DefaultNameMapping();
 }
Example #16
0
 public DefaultParser(WrapperProject project)
 {
     Project = project;
 }
        public BulletParser(WrapperProject project)
            : base(project)
        {
            // Classes that shouldn't be instantiated by users
            var hidePublicConstructors = new HashSet<string> {
                "btActivatingCollisionAlgorithm", "btBroadphaseProxy", "btContactConstraint",
                "btDbvtProxy", "btDispatcherInfo",
                "btUsageBitfield", "btSoftBody::Anchor", "btSoftBody::Config", "btSoftBody::Cluster",
                "btSoftBody::Face", "btSoftBody::Tetra", "btSoftBody::Element", "btSoftBody::Feature",
                "btSoftBody::Link", "btSoftBody::Material", "btSoftBody::Node", "btSoftBody::Note",
                "btSoftBody::Pose", "btSoftBody::SolverState", "btSoftBody::Joint::Specs",
                "btSoftBody::AJoint", "btSoftBody::CJoint", "btSoftBody::LJoint", "btSparseSdf",
                "btCompoundShapeChild", "btMultibodyLink"
            };

            // Classes for which no internal constructor is needed
            var hideInternalConstructor = new HashSet<string> {
                "btAxisSweep3", "bt32BitAxisSweep3",
                "btBoxBoxDetector", "btBroadphaseRayCallback", "btCollisionAlgorithmConstructionInfo", "btDefaultCollisionConstructionInfo",
                "btContinuousConvexCollision",
                "btDefaultMotionState", "btRigidBody", "btDiscreteCollisionDetectorInterface::ClosestPointInput",
                "btGjkConvexCast", "btGjkEpaPenetrationDepthSolver",
                "btMinkowskiPenetrationDepthSolver", "btPointCollector",
                "btMultiBodyDynamicsWorld",
                "btDefaultVehicleRaycaster", "btRaycastVehicle", "btDefaultSerializer",
                "btSoftBodyRigidBodyCollisionConfiguration", "btCPUVertexBufferDescriptor",
                "btSoftRigidDynamicsWorld",
                "SpuGatheringCollisionDispatcher", "btConvexSeparatingDistanceUtil",
                "btVehicleRaycaster::btVehicleRaycasterResult", "btOverlapCallback",
                "btRaycastVehicle::btVehicleTuning",
                "btBox2dShape", "btBoxShape", "btCapsuleShapeX", "btCapsuleShapeZ",
                "btCylinderShapeX", "btCylinderShapeZ",
                "btConeShapeX", "btConeShapeZ", "btConvex2dShape", "btConvexHullShape",
                "btConvexPointCloudShape", "btEmptyShape", "btHeightfieldTerrainShape", "btMinkowskiSumShape",
                "btMultiSphereShape", "btMultimaterialTriangleMeshShape", "btScaledBvhTriangleMeshShape",
                "btSphereShape", "btStaticPlaneShape", "btUniformScalingShape",
                "btCollisionWorld::ConvexResultCallback", "btCollisionWorld::ClosestConvexResultCallback",
                "HACD", "btRigidBody::btRigidBodyConstructionInfo",
                "btSoftBody::ImplicitFn", "btTriangleBuffer", "btMaterialProperties",
                "btCollisionWorld::AllHitsRayResultCallback", "btCollisionWorld::ContactResultCallback",
                "btCollisionWorld::ClosestRayResultCallback", "btCollisionWorld::RayResultCallback",
                "btJointFeedback", "btTypedConstraint::btConstraintInfo1", "btTypedConstraint::btConstraintInfo2",
                "btConeTwistConstraint", "btFixedConstraint", "btGearConstraint",
                "btGeneric6DofSpringConstraint", "btHinge2Constraint",
                "btHingeAccumulatedAngleConstraint", "btPoint2PointConstraint",
                "btSliderConstraint", "btUniversalConstraint",
                "btMLCPSolver", "btMultiBodyConstraintSolver", "btNNCGConstraintSolver",
                "btPairCachingGhostObject", "btSortedOverlappingPairCache", "btNullPairCache",
                "btDbvtBroadphase",
                "btShapeHull", "btSoftBody::sRayCast", "btSoftBody::AJoint::Specs", "btSoftBody::LJoint::Specs",
                "btCompoundShape" // constructor needed for CompoundFromGImpact in C++/CLI, but not C#
            };

            // Classes that have OnDisposing/OnDisposed events
            var trackingDisposable = new HashSet<string> {
                "btCollisionObject", "btCollisionShape",
                "btDbvt", "btRaycastVehicle", "btTypedConstraint"};

            // Apply class properties
            foreach (var @class in Project.ClassDefinitions.Values)
            {
                if (hidePublicConstructors.Contains(@class.FullyQualifiedName))
                {
                    @class.HidePublicConstructors = true;
                }

                if (hideInternalConstructor.Contains(@class.FullyQualifiedName))
                {
                    @class.NoInternalConstructor = true;
                }
                if (trackingDisposable.Contains(@class.FullyQualifiedName))
                {
                    @class.IsTrackingDisposable = true;
                }
            }
        }
        public CppReader(WrapperProject project)
        {
            this.project = project;

            foreach (string sourceRelDir in project.SourceRootFoldersFull)
            {
                string sourceFullDir = Path.GetFullPath(sourceRelDir).Replace('\\', '/');

                // Enumerate all header files in the source tree
                var headerFiles = Directory.EnumerateFiles(sourceFullDir, "*.h", SearchOption.AllDirectories);
                foreach (string headerFullDir in headerFiles)
                {
                    string headerFullDirCanonical = headerFullDir.Replace('\\', '/');
                    //string headerRelDir = headerFullDirCanonical.Substring(sourceFullDir.Length);

                    HeaderDefinition header;
                    if (project.HeaderDefinitions.TryGetValue(headerFullDirCanonical, out header))
                    {
                        if (header.IsExcluded)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        Console.WriteLine("New file {0}", headerFullDirCanonical);
                    }

                    headerQueue.Add(headerFullDirCanonical);
                }

                // Include directory
                clangOptions.Add("-I");
                clangOptions.Add(sourceFullDir);
            }

            // WorldImporter include directory
            //clangOptions.Add("-I");
            //clangOptions.Add(src + "../Extras/Serialize/BulletWorldImporter");

            // Specify C++ headers, not C ones
            clangOptions.Add("-x");
            clangOptions.Add("c++-header");

            //clangOptions.Add("-DUSE_DOUBLE_PRECISION");

            // Exclude irrelevant methods
            excludedMethods.Add("operator new");
            excludedMethods.Add("operator delete");
            excludedMethods.Add("operator new[]");
            excludedMethods.Add("operator delete[]");
            excludedMethods.Add("operator+=");
            excludedMethods.Add("operator-=");
            excludedMethods.Add("operator*=");
            excludedMethods.Add("operator/=");
            excludedMethods.Add("operator==");
            excludedMethods.Add("operator!=");
            excludedMethods.Add("operator()");
            excludedMethods.Add("operator=");

            Console.Write("Reading headers");

            ReadHeaders();

            foreach (var @class in project.ClassDefinitions.Values.Where(c => !c.IsParsed))
            {
                Console.WriteLine("Class removed: {0}", @class.FullyQualifiedName);
            }
        }
 public DotNetParser(WrapperProject project)
     : base(project)
 {
 }