cmVisualStudioGeneratorOptions.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <iosfwd>
  6. #include <string>
  7. #include <cm/optional>
  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. MarmasmCompiler,
  23. MasmCompiler,
  24. NasmCompiler,
  25. Linker,
  26. FortranCompiler,
  27. CSharpCompiler
  28. };
  29. cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool,
  30. cmVS7FlagTable const* table = nullptr,
  31. cmVS7FlagTable const* extraTable = nullptr);
  32. // Add a table of flags.
  33. void AddTable(cmVS7FlagTable const* table);
  34. // Clear the flag tables.
  35. void ClearTables();
  36. // Store options from command line flags.
  37. void Parse(const std::string& flags);
  38. void ParseFinish();
  39. void PrependInheritedString(std::string const& key);
  40. // Parse the content of the given flag table entry again to extract
  41. // known flags and leave the rest in the original entry.
  42. void Reparse(std::string const& key);
  43. // Fix the ExceptionHandling option to default to off.
  44. void FixExceptionHandlingDefault();
  45. // Store options for verbose builds.
  46. void SetVerboseMakefile(bool verbose);
  47. // Check for specific options.
  48. bool UsingUnicode() const;
  49. bool UsingSBCS() const;
  50. void FixCudaCodeGeneration();
  51. void FixManifestUACFlags();
  52. bool UsingDebugInfo() const;
  53. cm::optional<bool> UsingDebugRuntime() const;
  54. bool IsWinRt() const;
  55. bool IsManaged() const;
  56. // Write options to output.
  57. void OutputPreprocessorDefinitions(std::ostream& fout, int indent,
  58. const std::string& lang);
  59. void OutputAdditionalIncludeDirectories(std::ostream& fout, int indent,
  60. const std::string& lang);
  61. void OutputFlagMap(std::ostream& fout, int indent);
  62. void SetConfiguration(const std::string& config);
  63. const std::string& GetConfiguration() const;
  64. protected:
  65. virtual void OutputFlag(std::ostream& fout, int indent,
  66. const std::string& tag,
  67. const std::string& content) = 0;
  68. private:
  69. cmLocalVisualStudioGenerator* LocalGenerator;
  70. std::string Configuration;
  71. Tool CurrentTool;
  72. bool FortranRuntimeDebug;
  73. bool FortranRuntimeDLL;
  74. bool FortranRuntimeMT;
  75. std::string UnknownFlagField;
  76. void StoreUnknownFlag(std::string const& flag) override;
  77. FlagValue TakeFlag(std::string const& key);
  78. };