cmGlobalKdevelopGenerator.h 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2004-2009 Kitware, Inc.
  4. Copyright 2004 Alexander Neundorf ([email protected])
  5. Distributed under the OSI-approved BSD License (the "License");
  6. see accompanying file Copyright.txt for details.
  7. This software is distributed WITHOUT ANY WARRANTY; without even the
  8. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. See the License for more information.
  10. ============================================================================*/
  11. #ifndef cmGlobalKdevelopGenerator_h
  12. #define cmGlobalKdevelopGenerator_h
  13. #include "cmExternalMakefileProjectGenerator.h"
  14. class cmLocalGenerator;
  15. /** \class cmGlobalKdevelopGenerator
  16. * \brief Write Unix Makefiles accompanied by KDevelop3 project files.
  17. *
  18. * cmGlobalKdevelopGenerator produces a project file for KDevelop 3 (KDevelop
  19. * > 3.1.1). The project is based on the "Custom Makefile based C/C++"
  20. * project of KDevelop. Such a project consists of Unix Makefiles in the
  21. * build directory together with a <your_project>.kdevelop project file,
  22. * which contains the project settings and a <your_project>.kdevelop.filelist
  23. * file, which lists the source files relative to the kdevelop project
  24. * directory. The kdevelop project directory is the base source directory.
  25. */
  26. class cmGlobalKdevelopGenerator : public cmExternalMakefileProjectGenerator
  27. {
  28. public:
  29. cmGlobalKdevelopGenerator();
  30. virtual const char* GetName() const
  31. { return cmGlobalKdevelopGenerator::GetActualName();}
  32. static const char* GetActualName() { return "KDevelop3";}
  33. static cmExternalMakefileProjectGenerator* New()
  34. { return new cmGlobalKdevelopGenerator; }
  35. /** Get the documentation entry for this generator. */
  36. virtual void GetDocumentation(cmDocumentationEntry& entry,
  37. const char* fullName) const;
  38. virtual void Generate();
  39. private:
  40. /*** Create the foo.kdevelop.filelist file, return false if it doesn't
  41. succeed. If the file already exists the contents will be merged.
  42. */
  43. bool CreateFilelistFile(const std::vector<cmLocalGenerator*>& lgs,
  44. const std::string& outputDir,
  45. const std::string& projectDirIn,
  46. const std::string& projectname,
  47. std::string& cmakeFilePattern,
  48. std::string& fileToOpen);
  49. /** Create the foo.kdevelop file. This one calls MergeProjectFiles()
  50. if it already exists, otherwise createNewProjectFile() The project
  51. files will be created in \a outputDir (in the build tree), the
  52. kdevelop project dir will be set to \a projectDir (in the source
  53. tree). \a cmakeFilePattern consists of a lists of all cmake
  54. listfiles used by this CMakeLists.txt */
  55. void CreateProjectFile(const std::string& outputDir,
  56. const std::string& projectDir,
  57. const std::string& projectname,
  58. const std::string& executable,
  59. const std::string& cmakeFilePattern,
  60. const std::string& fileToOpen);
  61. /*** Reads the old foo.kdevelop line by line and only replaces the
  62. "important" lines
  63. */
  64. void MergeProjectFiles(const std::string& outputDir,
  65. const std::string& projectDir,
  66. const std::string& filename,
  67. const std::string& executable,
  68. const std::string& cmakeFilePattern,
  69. const std::string& fileToOpen,
  70. const std::string& sessionFilename);
  71. ///! Creates a new foo.kdevelop and a new foo.kdevses file
  72. void CreateNewProjectFile(const std::string& outputDir,
  73. const std::string& projectDir,
  74. const std::string& filename,
  75. const std::string& executable,
  76. const std::string& cmakeFilePattern,
  77. const std::string& fileToOpen,
  78. const std::string& sessionFilename);
  79. std::vector<std::string> Blacklist;
  80. };
  81. #endif