Exemplo n.º 1
0
        static void Main(string[] args)
        {
            foreach (var t in TypesToExport)
            {
                ExportClass(t);
            }

            foreach (var Cf in Cppfiles)
            {
                Cf.WriteFile();
            }
            foreach (var Hf in Hfiles)
            {
                Hf.WriteFile();
            }
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            // check input
            // ===========
            if (args.Length != 1 || !Directory.Exists(args[0]))
            {
                Console.WriteLine("BoSSS - Code generator for C++ bindings.");
                Console.WriteLine("usage: ");
                Console.WriteLine("      ExteranlBinding.CodeGen.exe {OuputDir}");

                if (args.Length < 1)
                {
                    Console.Error.WriteLine("Unable to get output directory.");
                }
                else if (!Directory.Exists(args[0]))
                {
                    Console.Error.WriteLine("Directory >{0}< does not seem to exist.");
                }

                Console.Error.WriteLine("exiting");
                return;
            }
            string outputDir = args[0];



            // create type decls
            // =================
            CreatePrototypeDeclarations();

            // create wrapper code
            // ===================
            foreach (var t in TypesToExport)
            {
                ExportClass(t);
            }

            // add includes to C++ file
            // ========================
            foreach (var Cf in Cppfiles)
            {
                foreach (var Hf in Hfiles)
                {
                    Cf.IncludeDirectives.Add("#include \"" + Hf.FileName + CodeGenHeaderFile.HeaderFileSuffix + "\"");
                }
            }

            // Master include
            // ==============
            GenerateMasterInclude();

            // Mono interface wrappers
            // =======================

            GenerateGlobals();


            // write code
            // ==========

            foreach (var Cf in Cppfiles)
            {
                Cf.WriteFile(outputDir);
            }
            foreach (var Hf in Hfiles)
            {
                Hf.WriteFile(outputDir);
            }

            // Write additional files
            // ======================

            File.WriteAllText(Path.Combine(outputDir, "compile.sh"), Resources.compile_sh);
            //File.WriteAllText(Path.Combine(outputDir, "MonoBoSSSglobals.h"), Resources.MonoBoSSSglobals_h);
            //File.WriteAllText(Path.Combine(outputDir, "MonoBoSSSglobals.cpp"), Resources.MonoBoSSSglobals_cpp);
            File.WriteAllText(Path.Combine(outputDir, "ExtBindingTest.cpp"), Resources.ExtBindingTest_cpp);
        }