cmLocalGenerator.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 cmLocalGenerator_h
  14. #define cmLocalGenerator_h
  15. #include "cmStandardIncludes.h"
  16. class cmMakefile;
  17. class cmGlobalGenerator;
  18. class cmTarget;
  19. /** \class cmLocalGenerator
  20. * \brief Create required build files for a directory.
  21. *
  22. * Subclasses of this abstract class generate makefiles, DSP, etc for various
  23. * platforms. This class should never be constructued directly. A
  24. * GlobalGenerator will create it and invoke the appropriate commands on it.
  25. */
  26. class cmLocalGenerator
  27. {
  28. public:
  29. cmLocalGenerator();
  30. virtual ~cmLocalGenerator();
  31. /**
  32. * Generate the makefile for this directory. fromTheTop indicates if this
  33. * is being invoked as part of a global Generate or specific to this
  34. * directory. The difference is that when done from the Top we might skip
  35. * some steps to save time, such as dependency generation for the
  36. * makefiles. This is done by a direct invocation from make.
  37. */
  38. virtual void Generate(bool /* fromTheTop */) {};
  39. /**
  40. * Process the CMakeLists files for this directory to fill in the
  41. * m_Makefile ivar
  42. */
  43. virtual void Configure();
  44. /**
  45. * Perform any final calculations prior to generation
  46. */
  47. virtual void ConfigureFinalPass();
  48. /**
  49. * Generate the install rules files in this directory.
  50. */
  51. virtual void GenerateInstallRules();
  52. ///! Get the makefile for this generator
  53. cmMakefile *GetMakefile() {
  54. return this->m_Makefile; };
  55. ///! Get the GlobalGenerator this is associated with
  56. cmGlobalGenerator *GetGlobalGenerator() {
  57. return m_GlobalGenerator; };
  58. ///! Set the Global Generator, done on creation by the GlobalGenerator
  59. void SetGlobalGenerator(cmGlobalGenerator *gg);
  60. /** Get the full name of the target's file, without path. */
  61. std::string GetFullTargetName(const char* n, const cmTarget& t);
  62. virtual const char* GetSafeDefinition(const char*);
  63. std::string ConvertToRelativeOutputPath(const char* p);
  64. // flag to determine if this project should be included in a parent project
  65. bool GetExcludeAll()
  66. {
  67. return m_ExcludeFromAll;
  68. }
  69. void SetExcludeAll(bool b)
  70. {
  71. m_ExcludeFromAll = b;
  72. }
  73. ///! set/get the parent generator
  74. cmLocalGenerator* GetParent(){return m_Parent;}
  75. void SetParent(cmLocalGenerator* g) { m_Parent = g;}
  76. protected:
  77. virtual void AddInstallRule(std::ostream& fout, const char* dest, int type,
  78. const char* files, bool optional = false);
  79. bool m_FromTheTop;
  80. cmMakefile *m_Makefile;
  81. cmGlobalGenerator *m_GlobalGenerator;
  82. // members used for relative path function ConvertToMakefilePath
  83. std::string m_RelativePathToSourceDir;
  84. std::string m_RelativePathToBinaryDir;
  85. std::string m_CurrentOutputDirectory;
  86. std::string m_HomeOutputDirectory;
  87. std::string m_HomeDirectory;
  88. std::string m_HomeOutputDirectoryNoSlash;
  89. bool m_ExcludeFromAll;
  90. cmLocalGenerator* m_Parent;
  91. };
  92. #endif