cmRulePlaceholderExpander.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 cmRulePlaceholderExpander_h
  4. #define cmRulePlaceholderExpander_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <map>
  7. #include <string>
  8. class cmOutputConverter;
  9. class cmRulePlaceholderExpander
  10. {
  11. public:
  12. cmRulePlaceholderExpander(
  13. std::map<std::string, std::string> compilers,
  14. std::map<std::string, std::string> variableMappings,
  15. std::string compilerSysroot, std::string linkerSysroot);
  16. void SetTargetImpLib(std::string const& targetImpLib)
  17. {
  18. this->TargetImpLib = targetImpLib;
  19. }
  20. // Create a struct to hold the variables passed into
  21. // ExpandRuleVariables
  22. struct RuleVariables
  23. {
  24. RuleVariables();
  25. const char* CMTargetName;
  26. const char* CMTargetType;
  27. const char* TargetPDB;
  28. const char* TargetCompilePDB;
  29. const char* TargetVersionMajor;
  30. const char* TargetVersionMinor;
  31. const char* Language;
  32. const char* Objects;
  33. const char* Target;
  34. const char* LinkLibraries;
  35. const char* Source;
  36. const char* AssemblySource;
  37. const char* PreprocessedSource;
  38. const char* Output;
  39. const char* Object;
  40. const char* ObjectDir;
  41. const char* ObjectFileDir;
  42. const char* Flags;
  43. const char* ObjectsQuoted;
  44. const char* SONameFlag;
  45. const char* TargetSOName;
  46. const char* TargetInstallNameDir;
  47. const char* LinkFlags;
  48. const char* Manifests;
  49. const char* LanguageCompileFlags;
  50. const char* Defines;
  51. const char* Includes;
  52. const char* DependencyFile;
  53. const char* FilterPrefix;
  54. const char* SwiftAuxiliarySources;
  55. const char* SwiftModuleName;
  56. const char* SwiftLibraryName;
  57. const char* SwiftPartialModule;
  58. const char* SwiftPartialDoc;
  59. };
  60. // Expand rule variables in CMake of the type found in language rules
  61. void ExpandRuleVariables(cmOutputConverter* outputConverter,
  62. std::string& string,
  63. const RuleVariables& replaceValues);
  64. // Expand rule variables in a single string
  65. std::string ExpandRuleVariable(cmOutputConverter* outputConverter,
  66. std::string const& variable,
  67. const RuleVariables& replaceValues);
  68. private:
  69. std::string TargetImpLib;
  70. std::map<std::string, std::string> Compilers;
  71. std::map<std::string, std::string> VariableMappings;
  72. std::string CompilerSysroot;
  73. std::string LinkerSysroot;
  74. };
  75. #endif