You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.2 KiB

23 years ago
  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. cmGlobalGenerator();
  30. virtual ~cmGlobalGenerator();
  31. ///! Create a local generator appropriate to this Global Generator
  32. virtual cmLocalGenerator *CreateLocalGenerator();
  33. ///! Get the name for this generator
  34. virtual const char *GetName() { return "Generic"; };
  35. /**
  36. * Create LocalGenerators and process the CMakeLists files. This does not
  37. * actually produce any makefiles, DSPs, etc.
  38. */
  39. virtual void Configure();
  40. /**
  41. * Generate the all required files for building this project/tree. This
  42. * basically creates a series of LocalGenerators for each directory and
  43. * requests that they Generate.
  44. */
  45. virtual void Generate();
  46. /**
  47. * Generate the required files for building this directory. This
  48. * basically creates a single LocalGenerators and
  49. * requests that it Generate.
  50. */
  51. virtual void LocalGenerate();
  52. /**
  53. * Set/Get and Clear the enabled languages.
  54. */
  55. void SetLanguageEnabled(const char*);
  56. bool GetLanguageEnabled(const char*);
  57. void ClearEnabledLanguages();
  58. /**
  59. * Try to determine system infomation such as shared library
  60. * extension, pthreads, byte order etc.
  61. */
  62. virtual void EnableLanguage(const char*, cmMakefile *) {};
  63. /**
  64. * Try to determine system infomation, get it from another generator
  65. */
  66. virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
  67. cmMakefile *mf);
  68. /**
  69. * Try running cmake and building a file. This is used for dynalically
  70. * loaded commands, not as part of the usual build process.
  71. */
  72. virtual int TryCompile(const char *srcdir, const char *bindir,
  73. const char *projectName, const char *targetName,
  74. std::string *output);
  75. ///! Set the CMake instance
  76. void SetCMakeInstance(cmake *cm) {
  77. this->m_CMakeInstance = cm; };
  78. ///! Get the CMake instance
  79. cmake *GetCMakeInstance() {
  80. return this->m_CMakeInstance; };
  81. protected:
  82. cmake *m_CMakeInstance;
  83. std::vector<cmLocalGenerator *> m_LocalGenerators;
  84. ///! used by Configure()
  85. void RecursiveConfigure(cmLocalGenerator *lg);
  86. private:
  87. std::map<cmStdString, bool> m_LanguageEnabled;
  88. };
  89. #endif