Exemplo n.º 1
0
        /// <summary>
        ///     DownloadAndBuild method downloads selected Flann version and builds it for selected parameters (i.e. x64
        ///     and Visual Studio 13)
        /// </summary>
        public void DownloadAndBuild()
        {
            try
            {
                // TODO: Ankit - Customize Message box with BlueGo UX
                string fVersion = FlannInfo.TransformFlannVersionToString(flannVersion);
                //prompt for dependencies
                MessageBox.Show("Information:Flann " + fVersion + " requires Python 2.x & Numpy as dependencies to build successfully!");

                if (!Directory.Exists(destinationFolder))
                {
                    Directory.CreateDirectory(destinationFolder);
                }

                message("Checking Dependencies...");

                DependencyChecker.CheckCommanDependency();

                string python2FullPath = Executable.GetPython2ExePath();

                if (String.IsNullOrEmpty(python2FullPath))
                {
                    throw new Exception(PythonAndNumpyNotInstalledMessage);
                }

                message("Checking Dependencies done!");

                message("Downloading Flann...");

                string FlannDownloadURL = FlannInfo.GetDownloadURL(flannVersion);
                string FlannZIPFilename = FlannInfo.GetFlannZipFileName(flannVersion);

                DownloadHelper.DownloadFileFromURL(FlannDownloadURL, destinationFolder + FlannZIPFilename);

                message("Start to unzip Flann...");

                // Unzip Flann
                SevenZip.Decompress(destinationFolder + "/" + FlannZIPFilename, destinationFolder);

                message("Flann has been unzipped!");

                //patch the serialization.h for building successfully with x64
                if (platform == ePlatform.x64)
                {
                    patchForX64Platform();
                }

                message("Building Flann...");

                runCMake(destinationFolder, python2FullPath);
                runMSBuild(destinationFolder, " /property:Configuration=" + Folder.ReleaseFolderName);

                message("Flann successfully built!");

                // remove downloaded file
                if (File.Exists(Path.Combine(destinationFolder, FlannZIPFilename)))
                {
                    System.IO.File.Delete(Path.Combine(destinationFolder, FlannZIPFilename));
                }

                OnFinished();
            }
            catch (Exception ex)
            {
                message(string.Empty);
                OnFailure();
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     DownloadAndBuild method downloads selected PCL version and builds it for selected parameters (i.e. x64
        ///     and Visual Studio 13)
        /// </summary>
        public void DownloadAndBuild()
        {
            try
            {
                // TODO: Ankit - Customize Message box with BlueGo UX
                // prompt for dependencies
                if (MessageBox.Show(PCLWaring, "Warning", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    OnFinished();
                    return;
                }

                if (!Directory.Exists(destinationFolder))
                {
                    Directory.CreateDirectory(destinationFolder);
                }

                message("Checking Dependencies...");

                DependencyChecker.CheckCommanDependency();

                python2ExeFullPath = Executable.GetPython2ExePath();

                if (String.IsNullOrEmpty(python2ExeFullPath))
                {
                    throw new Exception(PythonAndNumpyNotInstalledMessage);
                }

                message("Checking Dependencies done!");

                message("Downloading PCL...");

                string pclDownloadURL = PCLInfo.GetDownloadURL(pclVersion);
                string pclZIPFilename = PCLInfo.GetPCLZipFileName(pclVersion);
                pclFolderName = PCLInfo.GetPCLInfo(pclVersion).ExtractFolderName;

                DownloadHelper.DownloadFileFromURL(pclDownloadURL, destinationFolder + pclZIPFilename);

                message("Start to unzip PCL...");

                // unzip pcl
                SevenZip.Decompress(destinationFolder + "/" + pclZIPFilename, destinationFolder);

                message("PCL has been unzipped!");

                if (Directory.Exists(destinationFolder + "/pcl-" + pclFolderName))
                {
                    Directory.Move(destinationFolder + "/pcl-" + pclFolderName, destinationFolder + pclFolderName);
                }
                else if (Directory.Exists(destinationFolder + pclFolderName) && (ePCLVersion.FromSourceGIT == pclVersion))
                {
                    Directory.Move(destinationFolder + pclFolderName, destinationFolder + "/" + PCLFromSourceGITFolderName);
                    pclFolderName = PCLFromSourceGITFolderName;
                }

                message("start to build pcl...");

                runCMake(destinationFolder);
                runMSBuild(destinationFolder, " /property:Configuration=" + Folder.ReleaseFolderName);

                message("PCL successfully built!");

                // remove downloaded file
                if (File.Exists(Path.Combine(destinationFolder, pclZIPFilename)))
                {
                    System.IO.File.Delete(Path.Combine(destinationFolder, pclZIPFilename));
                }

                OnFinished();
            }
            catch (Exception ex)
            {
                message(string.Empty);
                OnFailure();
                MessageBox.Show(ex.ToString());
            }
        }