Esempio n. 1
0
        private void runMSBuild(string destinationFolder, string arguments = "")
        {
            Process          p    = new Process();
            ProcessStartInfo info = CreateVisualStudioCommandPromptProcessStartInfo(compilerType, platform);

            info.RedirectStandardInput  = true;
            info.UseShellExecute        = false;
            info.RedirectStandardOutput = true;
            info.RedirectStandardError  = true;
            info.WindowStyle            = ProcessWindowStyle.Hidden;

            p.StartInfo = info;
            p.Start();

            using (StreamWriter sw = p.StandardInput)
            {
                string extractFolderName = FlannInfo.GetFlannInfo(flannVersion).ExtractFolderName;

                if (sw.BaseStream.CanWrite)
                {
                    sw.WriteLine("cd /D " + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName, Folder.BinFolderName)));
                    sw.WriteLine("\"" + Executable.msbuildExePath + "\"" + " flann.sln" + arguments);
                }
            }

            readStandardOutput(p);
            readStandardError(p);

            p.WaitForExit();
            p.Close();
        }
Esempio n. 2
0
        private void patchForX64Platform()
        {
            const string toSearch = "BASIC_TYPE_SERIALIZER(char);\n";
            const string toMatch  = "BASIC_TYPE_SERIALIZER(unsigned __int64);";
            const string toPatch  = "#ifdef _MSC_VER\nBASIC_TYPE_SERIALIZER(unsigned __int64);\n#endif\nBASIC_TYPE_SERIALIZER(char);\n";

            string extractFolderName = FlannInfo.GetFlannInfo(flannVersion).ExtractFolderName;
            string filePath          = Path.Combine(destinationFolder, extractFolderName, @"src\cpp\flann\util\serialization.h");

            bool isPatch = false;

            if (File.Exists(filePath))
            {
                string fileContent = string.Empty;
                using (StreamReader streamReader = new StreamReader(filePath))
                {
                    fileContent = streamReader.ReadToEnd();
                    if (!fileContent.Contains(toMatch))
                    {
                        isPatch = true;
                    }
                }
                if (isPatch)
                {
                    fileContent = fileContent.Replace(toSearch, toPatch);
                    File.WriteAllText(filePath, fileContent);
                }
            }
            else
            {
                throw new Exception("For x64 machines, serialization.h requires patching. Patching error::" + filePath + " does not exists!");
            }
        }
Esempio n. 3
0
        private void runCMake(string destinationFolder, string python2ExePath)
        {
            Process          p    = new Process();
            ProcessStartInfo info = CreateVisualStudioCommandPromptProcessStartInfo(compilerType, platform);

            info.RedirectStandardInput  = true;
            info.UseShellExecute        = false;
            info.RedirectStandardOutput = true;
            info.RedirectStandardError  = true;
            info.WindowStyle            = ProcessWindowStyle.Hidden;

            p.StartInfo = info;
            p.Start();

            using (StreamWriter sw = p.StandardInput)
            {
                string extractFolderName = FlannInfo.GetFlannInfo(flannVersion).ExtractFolderName;

                if (sw.BaseStream.CanWrite)
                {
                    string cmakeCommand       = string.Empty;
                    string cmakeGeneratorName = string.Empty;

                    if (compilerType == eCompiler.VS2013)
                    {
                        if (platform == ePlatform.x64)
                        {
                            cmakeGeneratorName = string.Concat(Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_12_2013), " ", "Win64");
                        }
                        else if (platform == ePlatform.x86)
                        {
                            cmakeGeneratorName = Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_12_2013);
                        }

                        sw.WriteLine("cd /D " + destinationFolder + extractFolderName);

                        cmakeCommand = "\"" + Path.GetFullPath(Executable.cmakeExePath) + "\"" +
                                       " -G\"" + cmakeGeneratorName + "\"" +
                                       " -H\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName)) + "\"" +
                                       " -B\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName, Folder.BinFolderName)) + "\"" +
                                       " -DPYTHON_EXECUTABLE=" + "\"" + python2ExePath + "\"" +
                                       " -DBUILD_MATLAB_BINDINGS=OFF" + " -DBUILD_PYTHON_BINDINGS=OFF";

                        sw.WriteLine(cmakeCommand);
                    }
                    else if (compilerType == eCompiler.VS2012)
                    {
                        if (platform == ePlatform.x64)
                        {
                            cmakeGeneratorName = string.Concat(Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_11_2012), " ", "Win64");
                        }
                        else if (platform == ePlatform.x86)
                        {
                            cmakeGeneratorName = Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_11_2012);
                        }

                        sw.WriteLine("cd /D " + destinationFolder + extractFolderName);

                        cmakeCommand = "\"" + Path.GetFullPath(Executable.cmakeExePath) + "\"" +
                                       " -G\"" + cmakeGeneratorName + "\"" +
                                       " -H\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName)) + "\"" +
                                       " -B\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName, Folder.BinFolderName)) + "\"" +
                                       " -DPYTHON_EXECUTABLE=" + "\"" + python2ExePath + "\"" +
                                       " -DBUILD_MATLAB_BINDINGS=OFF" + " -DBUILD_PYTHON_BINDINGS=OFF";

                        sw.WriteLine(cmakeCommand);
                    }
                    else if (compilerType == eCompiler.VS2010)
                    {
                        if (platform == ePlatform.x64)
                        {
                            cmakeGeneratorName = string.Concat(Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_10_2010), " ", "Win64");
                        }
                        else if (platform == ePlatform.x86)
                        {
                            cmakeGeneratorName = Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_10_2010);
                        }

                        sw.WriteLine("cd /D " + destinationFolder + extractFolderName);

                        cmakeCommand = "\"" + Path.GetFullPath(Executable.cmakeExePath) + "\"" +
                                       " -G\"" + cmakeGeneratorName + "\"" +
                                       " -H\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName)) + "\"" +
                                       " -B\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName, Folder.BinFolderName)) + "\"" +
                                       " -DPYTHON_EXECUTABLE=" + "\"" + python2ExePath + "\"" +
                                       " -DBUILD_MATLAB_BINDINGS=OFF" + " -DBUILD_PYTHON_BINDINGS=OFF";

                        sw.WriteLine(cmakeCommand);
                    }
                }
            }

            readStandardOutput(p);
            readStandardError(p);

            p.WaitForExit();
            p.Close();
        }