cmGlobalGenerator.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmGlobalGenerator_h
  14. #define cmGlobalGenerator_h
  15. #include "cmStandardIncludes.h"
  16. class cmake;
  17. class cmMakefile;
  18. class cmLocalGenerator;
  19. /** \class cmGlobalGenerator
  20. * \brief Responable for overseeing the generation process for the entire tree
  21. *
  22. * Subclasses of this class generate makefiles for various
  23. * platforms.
  24. */
  25. class cmGlobalGenerator
  26. {
  27. public:
  28. ///! Free any memory allocated with the GlobalGenerator
  29. virtual ~cmGlobalGenerator();
  30. ///! Create a local generator appropriate to this Global Generator
  31. virtual cmLocalGenerator *CreateLocalGenerator();
  32. ///! Get the name for this generator
  33. virtual const char *GetName() { return "Generic"; };
  34. /**
  35. * Create LocalGenerators and process the CMakeLists files. This does not
  36. * actually produce any makefiles, DSPs, etc.
  37. */
  38. virtual void Configure();
  39. /**
  40. * Generate the all required files for building this project/tree. This
  41. * basically creates a series of LocalGenerators for each directory and
  42. * requests that they Generate.
  43. */
  44. virtual void Generate();
  45. /**
  46. * Generate the required files for building this directory. This
  47. * basically creates a single LocalGenerators and
  48. * requests that it Generate.
  49. */
  50. virtual void LocalGenerate();
  51. /**
  52. * Set/Get and Clear the enabled languages.
  53. */
  54. void SetLanguageEnabled(const char*);
  55. bool GetLanguageEnabled(const char*);
  56. void ClearEnabledLanguages();
  57. /**
  58. * Try to determine system infomation such as shared library
  59. * extension, pthreads, byte order etc.
  60. */
  61. virtual void EnableLanguage(const char*, cmMakefile *) {};
  62. /**
  63. * Try running cmake and building a file. This is used for dynalically
  64. * loaded commands, not as part of the usual build process.
  65. */
  66. virtual int TryCompile(const char *srcdir, const char *bindir,
  67. const char *projectName);
  68. ///! Set the CMake instance
  69. void SetCMakeInstance(cmake *cm) {
  70. this->m_CMakeInstance = cm; };
  71. ///! Get the CMake instance
  72. cmake *GetCMakeInstance() {
  73. return this->m_CMakeInstance; };
  74. protected:
  75. bool m_LanguagesEnabled;
  76. cmake *m_CMakeInstance;
  77. std::vector<cmLocalGenerator *> m_LocalGenerators;
  78. ///! used by Configure()
  79. void RecursiveConfigure(cmLocalGenerator *lg);
  80. private:
  81. std::map<cmStdString, bool> m_LanguageEnabled;
  82. };
  83. #endif