cmGlobalGenerator.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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() const { return "Generic"; };
  35. /** Get the documentation entry for this generator. */
  36. virtual void GetDocumentation(cmDocumentationEntry& entry) const;
  37. /**
  38. * Create LocalGenerators and process the CMakeLists files. This does not
  39. * actually produce any makefiles, DSPs, etc.
  40. */
  41. virtual void Configure();
  42. /**
  43. * Generate the all required files for building this project/tree. This
  44. * basically creates a series of LocalGenerators for each directory and
  45. * requests that they Generate.
  46. */
  47. virtual void Generate();
  48. /**
  49. * Generate the required files for building this directory. This
  50. * basically creates a single LocalGenerators and
  51. * requests that it Generate.
  52. */
  53. virtual void LocalGenerate();
  54. /**
  55. * Set/Get and Clear the enabled languages.
  56. */
  57. void SetLanguageEnabled(const char*);
  58. bool GetLanguageEnabled(const char*);
  59. void ClearEnabledLanguages();
  60. /**
  61. * Try to determine system infomation such as shared library
  62. * extension, pthreads, byte order etc.
  63. */
  64. virtual void EnableLanguage(const char*, cmMakefile *);
  65. /**
  66. * Try to determine system infomation, get it from another generator
  67. */
  68. virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen);
  69. /**
  70. * Try running cmake and building a file. This is used for dynalically
  71. * loaded commands, not as part of the usual build process.
  72. */
  73. virtual int TryCompile(const char *srcdir, const char *bindir,
  74. const char *projectName, const char *targetName,
  75. std::string *output, cmMakefile* mf);
  76. ///! Set the CMake instance
  77. void SetCMakeInstance(cmake *cm) {
  78. this->m_CMakeInstance = cm; };
  79. ///! Get the CMake instance
  80. cmake *GetCMakeInstance() {
  81. return this->m_CMakeInstance; };
  82. void SetConfiguredFilesPath(const char* s){m_ConfiguredFilesPath = s;}
  83. void GetLocalGenerators(std::vector<cmLocalGenerator *>&g) { g = m_LocalGenerators;}
  84. static int s_TryCompileTimeout;
  85. bool GetForceUnixPaths() {return m_ForceUnixPaths;}
  86. protected:
  87. bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen);
  88. void FindMakeProgram(cmMakefile*);
  89. bool m_ForceUnixPaths;
  90. cmStdString m_FindMakeProgramFile;
  91. cmStdString m_ConfiguredFilesPath;
  92. cmake *m_CMakeInstance;
  93. std::vector<cmLocalGenerator *> m_LocalGenerators;
  94. ///! used by Configure()
  95. void RecursiveConfigure(cmLocalGenerator *lg, float start, float end);
  96. private:
  97. std::map<cmStdString, bool> m_LanguageEnabled;
  98. };
  99. #endif