cmGlobalGenerator.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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() { 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. /**
  68. * Try running cmake and building a file. This is used for dynalically
  69. * loaded commands, not as part of the usual build process.
  70. */
  71. virtual int TryCompile(const char *srcdir, const char *bindir,
  72. const char *projectName, const char *targetName,
  73. std::string *output);
  74. ///! Set the CMake instance
  75. void SetCMakeInstance(cmake *cm) {
  76. this->m_CMakeInstance = cm; };
  77. ///! Get the CMake instance
  78. cmake *GetCMakeInstance() {
  79. return this->m_CMakeInstance; };
  80. void SetConfiguredFilesPath(const char* s){m_ConfiguredFilesPath = s;}
  81. void GetLocalGenerators(std::vector<cmLocalGenerator *>&g) { g = m_LocalGenerators;}
  82. protected:
  83. cmStdString m_FindMakeProgramFile;
  84. cmStdString m_ConfiguredFilesPath;
  85. cmake *m_CMakeInstance;
  86. std::vector<cmLocalGenerator *> m_LocalGenerators;
  87. ///! used by Configure()
  88. void RecursiveConfigure(cmLocalGenerator *lg, float start, float end);
  89. private:
  90. std::map<cmStdString, bool> m_LanguageEnabled;
  91. };
  92. #endif