cmVTKMakeInstantiatorCommand.h 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 cmVTKMakeInstantiatorCommand_h
  14. #define cmVTKMakeInstantiatorCommand_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmCommand.h"
  17. /** \class cmVTKMakeInstantiatorCommand
  18. * cmVTKMakeInstantiatorCommand implements the VTK_MAKE_INSTANTIATOR
  19. * command. This generates a source file to add to a VTK library that
  20. * registers instance creation functions with vtkInstantiator for every
  21. * class in that library.
  22. */
  23. class cmVTKMakeInstantiatorCommand : public cmCommand
  24. {
  25. public:
  26. /** This is a virtual constructor for the command. */
  27. virtual cmCommand* Clone()
  28. { return new cmVTKMakeInstantiatorCommand; }
  29. /**
  30. * This is called when the command is first encountered in
  31. * the CMakeLists.txt file.
  32. */
  33. virtual bool InitialPass(std::vector<std::string> const& args);
  34. /** The name of the command as specified in CMakeList.txt. */
  35. virtual const char* GetName() { return "VTK_MAKE_INSTANTIATOR"; }
  36. /** Succinct documentation. */
  37. virtual const char* GetTerseDocumentation()
  38. {
  39. return "Deprecated. For use only in VTK 4.0.";
  40. }
  41. /** More documentation. */
  42. virtual const char* GetFullDocumentation()
  43. {
  44. return
  45. " VTK_MAKE_INSTANTIATOR(className outSourceList\n"
  46. " src-list1 [src-list2 ..]\n"
  47. " EXPORT_MACRO exportMacro\n"
  48. " [HEADER_LOCATION dir]\n"
  49. " [GROUP_SIZE groupSize]\n"
  50. " [INCLUDES [file1 file2 ..]])\n"
  51. "Generates a new class with the given name and adds its files to the "
  52. "given outSourceList. It registers the classes from the other given "
  53. "source lists with vtkInstantiator when it is loaded. The output "
  54. "source list should be added to the library with the classes it "
  55. "registers. "
  56. "The EXPORT_MACRO argument must be given and followed by the export "
  57. "macro to use when generating the class (ex. VTK_COMMON_EXPORT). "
  58. "The HEADER_LOCATION option must be followed by a path. It specifies "
  59. "the directory in which to place the generated class's header file. "
  60. "The generated class implementation files always go in the build "
  61. "directory corresponding to the CMakeLists.txt file containing "
  62. "the command. This is the default location for the header. "
  63. "The INCLUDES option can be followed by a list of zero or more files. "
  64. "These files will be #included by the generated instantiator header, "
  65. "and can be used to gain access to the specified exportMacro in the "
  66. "C++ code.";
  67. }
  68. cmTypeMacro(cmVTKMakeInstantiatorCommand, cmCommand);
  69. protected:
  70. std::string m_ClassName;
  71. std::string m_ExportMacro;
  72. std::vector<cmStdString> m_Includes;
  73. std::vector<cmStdString> m_Classes;
  74. void GenerateHeaderFile(std::ostream&);
  75. void GenerateImplementationFile(std::ostream&);
  76. void OldGenerateHeaderFile(std::ostream&);
  77. void OldGenerateImplementationFile(std::ostream&);
  78. std::string OldGenerateCreationFileName(unsigned int group);
  79. void OldGenerateCreationFile(std::ostream&, unsigned int groupStart,
  80. unsigned int groupSize);
  81. };
  82. #endif