cmDSPWriter.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 cmDSPWriter_h
  14. #define cmDSPWriter_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmMakefile.h"
  17. /** \class cmDSPWriter
  18. * \brief Generate a Microsoft DSP project file.
  19. *
  20. * cmDSPWriter generates a Microsoft DSP project file.
  21. * See the *.dsptemplate files for information on the templates
  22. * used for making the project files.
  23. */
  24. class cmDSPWriter
  25. {
  26. public:
  27. cmDSPWriter(cmMakefile*);
  28. ~cmDSPWriter();
  29. void OutputDSPFile();
  30. enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
  31. /**
  32. * Specify the type of the build: static, dll, or executable.
  33. */
  34. void SetBuildType(BuildType,const char *name);
  35. /**
  36. * Return array of created DSP names in a STL vector.
  37. * Each executable must have its own dsp.
  38. */
  39. std::vector<std::string> GetCreatedProjectNames()
  40. {
  41. return m_CreatedProjectNames;
  42. }
  43. /**
  44. * Return the makefile.
  45. */
  46. cmMakefile* GetMakefile()
  47. {
  48. return m_Makefile;
  49. }
  50. private:
  51. std::string m_DSPHeaderTemplate;
  52. std::string m_DSPFooterTemplate;
  53. std::vector<std::string> m_CreatedProjectNames;
  54. void CreateSingleDSP(const char *lname, cmTarget &tgt);
  55. void WriteDSPFile(std::ostream& fout, const char *libName,
  56. cmTarget &tgt);
  57. void WriteDSPBeginGroup(std::ostream& fout,
  58. const char* group,
  59. const char* filter);
  60. void WriteDSPEndGroup(std::ostream& fout);
  61. void WriteDSPHeader(std::ostream& fout, const char *libName,
  62. const cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  63. void WriteDSPFooter(std::ostream& fout);
  64. void AddDSPBuildRule(cmSourceGroup&);
  65. void WriteCustomRule(std::ostream& fout,
  66. const char* source,
  67. const char* command,
  68. const std::set<std::string>& depends,
  69. const std::set<std::string>& outputs,
  70. const char* flags);
  71. std::string CreateTargetRules(const cmTarget &target,
  72. const char *libName);
  73. std::string CombineCommands(const cmSourceGroup::Commands &commands,
  74. cmSourceGroup::CommandFiles &totalCommand,
  75. const char *source);
  76. std::string m_IncludeOptions;
  77. cmMakefile* m_Makefile;
  78. std::vector<std::string> m_Configurations;
  79. };
  80. #endif