| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 | 
							- /*=========================================================================
 
-   Program:   CMake - Cross-Platform Makefile Generator
 
-   Module:    $RCSfile$
 
-   Language:  C++
 
-   Date:      $Date$
 
-   Version:   $Revision$
 
-   Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
 
-   See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
 
-      This software is distributed WITHOUT ANY WARRANTY; without even 
 
-      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 
-      PURPOSE.  See the above copyright notices for more information.
 
- =========================================================================*/
 
- #include "../cmCacheManager.h"
 
- #include "../cmSystemTools.h"
 
- #include "../cmake.h"
 
- #include "../cmDocumentation.h"
 
- #include <signal.h>
 
- #include <sys/ioctl.h>
 
- #include "cmCursesMainForm.h"
 
- #include <curses.h>
 
- #include <form.h>
 
- //----------------------------------------------------------------------------
 
- static const cmDocumentationEntry cmDocumentationName[] =
 
- {
 
-   {0,
 
-    "  ccmake - Curses Interface for CMake.", 0},
 
-   {0,0,0}
 
- };
 
- //----------------------------------------------------------------------------
 
- static const cmDocumentationEntry cmDocumentationUsage[] =
 
- {
 
-   {0,
 
-    "  ccmake <path-to-source>\n"
 
-    "  ccmake <path-to-existing-build>", 0},
 
-   {0,0,0}
 
- };
 
- //----------------------------------------------------------------------------
 
- static const cmDocumentationEntry cmDocumentationDescription[] =
 
- {
 
-   {0,
 
-    "The \"ccmake\" executable is the CMake curses interface.  Project "
 
-    "configuration settings may be specified interactively through "
 
-    "this GUI.  Brief instructions are provided at the bottom of the "
 
-    "terminal when the program is running.", 0},
 
-   CMAKE_STANDARD_INTRODUCTION,
 
-   {0,0,0}
 
- };
 
- //----------------------------------------------------------------------------
 
- static const cmDocumentationEntry cmDocumentationOptions[] =
 
- {
 
-   CMAKE_STANDARD_OPTIONS_TABLE,
 
-   {0,0,0}
 
- };
 
- //----------------------------------------------------------------------------
 
- static const cmDocumentationEntry cmDocumentationSeeAlso[] =
 
- {
 
-   {0, "cmake", 0},
 
-   {0, "ctest", 0},
 
-   {0, 0, 0}
 
- };
 
- cmCursesForm* cmCursesForm::CurrentForm=0;
 
- extern "C"
 
- {
 
- void onsig(int)
 
- {
 
-   if (cmCursesForm::CurrentForm)
 
-     {
 
-     endwin();
 
-     initscr(); /* Initialization */ 
 
-     noecho(); /* Echo off */ 
 
-     cbreak(); /* nl- or cr not needed */ 
 
-     keypad(stdscr,TRUE); /* Use key symbols as 
 
-                             KEY_DOWN*/ 
 
-     refresh();
 
-     int x,y;
 
-     getmaxyx(stdscr, y, x);
 
-     cmCursesForm::CurrentForm->Render(1,1,x,y);
 
-     cmCursesForm::CurrentForm->UpdateStatusBar();
 
-     }
 
-   signal(SIGWINCH, onsig);
 
- }
 
-  
 
- }
 
- void CMakeErrorHandler(const char* message, const char* title, bool&, void* clientData)
 
- {
 
-   cmCursesForm* self = static_cast<cmCursesForm*>( clientData );
 
-   self->AddError(message, title);
 
- }
 
- int main(int argc, char** argv)
 
- {
 
-   cmDocumentation doc;
 
-   if(doc.CheckOptions(argc, argv))
 
-     {
 
-     cmake hcm;
 
-     std::vector<cmDocumentationEntry> commands;
 
-     hcm.GetCommandDocumentation(commands);
 
-     doc.SetName("ccmake");
 
-     doc.SetNameSection(cmDocumentationName);
 
-     doc.SetUsageSection(cmDocumentationUsage);
 
-     doc.SetDescriptionSection(cmDocumentationDescription);
 
-     doc.SetOptionsSection(cmDocumentationOptions);
 
-     doc.SetCommandsSection(&commands[0]);
 
-     doc.SetSeeAlsoList(cmDocumentationSeeAlso);
 
-     return doc.PrintRequestedDocumentation(std::cout)? 0:1;
 
-     }  
 
-   
 
-   bool debug = false;
 
-   unsigned int i;
 
-   int j;
 
-   std::vector<std::string> args;
 
-   for(j =0; j < argc; ++j)
 
-     {
 
-     if(strcmp(argv[j], "-debug") == 0)
 
-       {
 
-       debug = true;
 
-       }
 
-     else
 
-       {
 
-       args.push_back(argv[j]);
 
-       }
 
-     }
 
-   std::string cacheDir = cmSystemTools::GetCurrentWorkingDirectory();
 
-   for(i=1; i < args.size(); ++i)
 
-     {
 
-     std::string arg = args[i];
 
-     if(arg.find("-B",0) == 0)
 
-       {
 
-       cacheDir = arg.substr(2);
 
-       }
 
-     }
 
-   cmSystemTools::DisableRunCommandOutput();
 
-   if (debug)
 
-     {
 
-     cmCursesForm::DebugStart();
 
-     }
 
-   initscr(); /* Initialization */ 
 
-   noecho(); /* Echo off */ 
 
-   cbreak(); /* nl- or cr not needed */ 
 
-   keypad(stdscr,TRUE); /* Use key symbols as 
 
-                           KEY_DOWN*/ 
 
-   signal(SIGWINCH, onsig);
 
-   int x,y;
 
-   getmaxyx(stdscr, y, x);
 
-   if ( x < cmCursesMainForm::MIN_WIDTH  || 
 
-        y < cmCursesMainForm::MIN_HEIGHT )
 
-     {
 
-     endwin();
 
-     std::cerr << "Window is too small. A size of at least "
 
-               << cmCursesMainForm::MIN_WIDTH << " x " 
 
-               <<  cmCursesMainForm::MIN_HEIGHT
 
-               << " is required to run ccmake." <<  std::endl;
 
-     return 1;
 
-     }
 
-   cmCursesMainForm* myform;
 
-   myform = new cmCursesMainForm(args, x);
 
-   if(myform->LoadCache(cacheDir.c_str()))
 
-     {
 
-     curses_clear();
 
-     touchwin(stdscr);
 
-     endwin();
 
-     delete myform;
 
-     std::cerr << "Error running cmake::LoadCache().  Aborting.\n";
 
-     return 1;
 
-     }
 
-   cmSystemTools::SetErrorCallback(CMakeErrorHandler, myform);
 
-   cmCursesForm::CurrentForm = myform;
 
-   myform->InitializeUI();
 
-   if ( myform->Configure(1) == 0 )
 
-     {
 
-     myform->Render(1, 1, x, y);
 
-     myform->HandleInput();
 
-     }
 
-   
 
-   // Need to clean-up better
 
-   curses_clear();
 
-   touchwin(stdscr);
 
-   endwin();
 
-   delete cmCursesForm::CurrentForm;
 
-   cmCursesForm::CurrentForm = 0;
 
-   std::cout << std::endl << std::endl;
 
-   
 
-   return 0;
 
- }
 
 
  |