cmVisualStudioGeneratorOptions.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmVisualStudioGeneratorOptions_h
  4. #define cmVisualStudioGeneratorOptions_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <iosfwd>
  7. #include <string>
  8. #include "cmGlobalVisualStudioGenerator.h"
  9. #include "cmIDEFlagTable.h"
  10. #include "cmIDEOptions.h"
  11. class cmLocalVisualStudioGenerator;
  12. using cmVS7FlagTable = cmIDEFlagTable;
  13. class cmVisualStudioGeneratorOptions : public cmIDEOptions
  14. {
  15. public:
  16. // Construct an options table for a given tool.
  17. enum Tool
  18. {
  19. Compiler,
  20. ResourceCompiler,
  21. CudaCompiler,
  22. MasmCompiler,
  23. NasmCompiler,
  24. Linker,
  25. FortranCompiler,
  26. CSharpCompiler
  27. };
  28. cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool,
  29. cmVS7FlagTable const* table = nullptr,
  30. cmVS7FlagTable const* extraTable = nullptr);
  31. // Add a table of flags.
  32. void AddTable(cmVS7FlagTable const* table);
  33. // Clear the flag tables.
  34. void ClearTables();
  35. // Store options from command line flags.
  36. void Parse(const std::string& flags);
  37. void ParseFinish();
  38. void PrependInheritedString(std::string const& key);
  39. // Parse the content of the given flag table entry again to extract
  40. // known flags and leave the rest in the original entry.
  41. void Reparse(std::string const& key);
  42. // Fix the ExceptionHandling option to default to off.
  43. void FixExceptionHandlingDefault();
  44. // Store options for verbose builds.
  45. void SetVerboseMakefile(bool verbose);
  46. // Check for specific options.
  47. bool UsingUnicode() const;
  48. bool UsingSBCS() const;
  49. enum CudaRuntime
  50. {
  51. CudaRuntimeStatic,
  52. CudaRuntimeShared,
  53. CudaRuntimeNone
  54. };
  55. CudaRuntime GetCudaRuntime() const;
  56. void FixCudaCodeGeneration();
  57. void FixManifestUACFlags();
  58. bool IsDebug() const;
  59. bool IsWinRt() const;
  60. bool IsManaged() const;
  61. // Write options to output.
  62. void OutputPreprocessorDefinitions(std::ostream& fout, int indent,
  63. const std::string& lang);
  64. void OutputAdditionalIncludeDirectories(std::ostream& fout, int indent,
  65. const std::string& lang);
  66. void OutputFlagMap(std::ostream& fout, int indent);
  67. void SetConfiguration(const std::string& config);
  68. const std::string& GetConfiguration() const;
  69. protected:
  70. virtual void OutputFlag(std::ostream& fout, int indent, const char* tag,
  71. const std::string& content) = 0;
  72. private:
  73. cmLocalVisualStudioGenerator* LocalGenerator;
  74. cmGlobalVisualStudioGenerator::VSVersion Version;
  75. std::string Configuration;
  76. Tool CurrentTool;
  77. bool FortranRuntimeDebug;
  78. bool FortranRuntimeDLL;
  79. bool FortranRuntimeMT;
  80. std::string UnknownFlagField;
  81. void StoreUnknownFlag(std::string const& flag) override;
  82. FlagValue TakeFlag(std::string const& key);
  83. };
  84. #endif