cmGlobalXCodeGenerator.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 cmGlobalXCodeGenerator_h
  14. #define cmGlobalXCodeGenerator_h
  15. #include "cmGlobalGenerator.h"
  16. #include "cmXCodeObject.h"
  17. class cmTarget;
  18. class cmSourceFile;
  19. /** \class cmGlobalXCodeGenerator
  20. * \brief Write a Unix makefiles.
  21. *
  22. * cmGlobalXCodeGenerator manages UNIX build process for a tree
  23. */
  24. class cmGlobalXCodeGenerator : public cmGlobalGenerator
  25. {
  26. public:
  27. cmGlobalXCodeGenerator();
  28. static cmGlobalGenerator* New() { return new cmGlobalXCodeGenerator; }
  29. ///! Get the name for the generator.
  30. virtual const char* GetName() const {
  31. return cmGlobalXCodeGenerator::GetActualName();}
  32. static const char* GetActualName() {return "XCode";}
  33. /** Get the documentation entry for this generator. */
  34. virtual void GetDocumentation(cmDocumentationEntry& entry) const;
  35. ///! Create a local generator appropriate to this Global Generator
  36. virtual cmLocalGenerator *CreateLocalGenerator();
  37. /**
  38. * Try to determine system infomation such as shared library
  39. * extension, pthreads, byte order etc.
  40. */
  41. virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
  42. /**
  43. * Try running cmake and building a file. This is used for dynalically
  44. * loaded commands, not as part of the usual build process.
  45. */
  46. virtual int TryCompile(const char *srcdir, const char *bindir,
  47. const char *projectName, const char *targetName,
  48. std::string *output, cmMakefile* mf);
  49. /**
  50. * Generate the all required files for building this project/tree. This
  51. * basically creates a series of LocalGenerators for each directory and
  52. * requests that they Generate.
  53. */
  54. virtual void Generate();
  55. private:
  56. // create cmXCodeObject from these functions so that memory can be managed
  57. // correctly. All objects created are stored in m_XCodeObjects.
  58. cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype);
  59. cmXCodeObject* CreateObject(cmXCodeObject::Type type);
  60. cmXCodeObject* CreateString(const char* s);
  61. cmXCodeObject* CreateObjectReference(cmXCodeObject*);
  62. cmXCodeObject* CreateExecutable(cmTarget& cmtarget,
  63. cmXCodeObject* buildPhases);
  64. // delete all objects in the m_XCodeObjects vector.
  65. void ClearXCodeObjects();
  66. void CreateXCodeObjects(cmLocalGenerator* root,
  67. std::vector<cmLocalGenerator*>& generators);
  68. void OutputXCodeProject(cmLocalGenerator* root,
  69. std::vector<cmLocalGenerator*>& generators);
  70. void WriteXCodePBXProj(std::ostream& fout,
  71. cmLocalGenerator* root,
  72. std::vector<cmLocalGenerator*>& generators);
  73. cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen, cmSourceFile* sf,
  74. cmXCodeObject* mainGroupChildren);
  75. void CreateXCodeTargets(cmLocalGenerator* gen, std::vector<cmXCodeObject*>&,
  76. cmXCodeObject* mainGroupChildren);
  77. std::vector<cmXCodeObject*> m_XCodeObjects;
  78. cmXCodeObject* m_RootObject;
  79. };
  80. #endif