FirstConfigure.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. #pragma once
  2. #include <QWizard>
  3. #include <QWizardPage>
  4. #include "cmake.h"
  5. #include "ui_Compilers.h"
  6. #include "ui_CrossCompiler.h"
  7. class QRadioButton;
  8. class QComboBox;
  9. //! the wizard pages we'll use for the first configure of a build
  10. enum FirstConfigurePages
  11. {
  12. Start,
  13. NativeSetup,
  14. ToolchainSetup,
  15. CrossSetup,
  16. Done
  17. };
  18. enum class CompilerOption
  19. {
  20. DefaultNative,
  21. SpecifyNative,
  22. ToolchainFile,
  23. Options,
  24. };
  25. //! the first page that gives basic options for what compilers setup to choose
  26. //! from
  27. class StartCompilerSetup : public QWizardPage
  28. {
  29. Q_OBJECT
  30. public:
  31. StartCompilerSetup(QString defaultGeneratorPlatform,
  32. QString defaultGeneratorToolset, QWidget* p);
  33. ~StartCompilerSetup();
  34. void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
  35. void setCurrentGenerator(const QString& gen);
  36. void setToolset(const QString& toolset);
  37. void setPlatform(const QString& platform);
  38. void setCompilerOption(CompilerOption option);
  39. QString getGenerator() const;
  40. QString getToolset() const;
  41. QString getPlatform() const;
  42. bool defaultSetup() const;
  43. bool compilerSetup() const;
  44. bool crossCompilerSetup() const;
  45. bool crossCompilerToolChainFile() const;
  46. int nextId() const;
  47. signals:
  48. void selectionChanged();
  49. protected slots:
  50. void onSelectionChanged(bool);
  51. void onGeneratorChanged(int index);
  52. protected:
  53. QComboBox* GeneratorOptions;
  54. QRadioButton* CompilerSetupOptions[4];
  55. QFrame* ToolsetFrame;
  56. QLineEdit* Toolset;
  57. QLabel* ToolsetLabel;
  58. QFrame* PlatformFrame;
  59. QComboBox* PlatformOptions;
  60. QLabel* PlatformLabel;
  61. QStringList GeneratorsSupportingToolset;
  62. QStringList GeneratorsSupportingPlatform;
  63. QMultiMap<QString, QString> GeneratorSupportedPlatforms;
  64. QMap<QString, QString> GeneratorDefaultPlatform;
  65. QString DefaultGeneratorPlatform, DefaultGeneratorToolset;
  66. private:
  67. QFrame* CreateToolsetWidgets();
  68. QFrame* CreatePlatformWidgets();
  69. };
  70. //! the page that gives basic options for native compilers
  71. class NativeCompilerSetup
  72. : public QWizardPage
  73. , protected Ui::Compilers
  74. {
  75. Q_OBJECT
  76. public:
  77. NativeCompilerSetup(QWidget* p);
  78. ~NativeCompilerSetup();
  79. QString getCCompiler() const;
  80. void setCCompiler(const QString&);
  81. QString getCXXCompiler() const;
  82. void setCXXCompiler(const QString&);
  83. QString getFortranCompiler() const;
  84. void setFortranCompiler(const QString&);
  85. int nextId() const { return -1; }
  86. };
  87. //! the page that gives options for cross compilers
  88. class CrossCompilerSetup
  89. : public QWizardPage
  90. , protected Ui::CrossCompiler
  91. {
  92. Q_OBJECT
  93. public:
  94. CrossCompilerSetup(QWidget* p);
  95. ~CrossCompilerSetup();
  96. QString getSystem() const;
  97. void setSystem(const QString&);
  98. QString getVersion() const;
  99. void setVersion(const QString&);
  100. QString getProcessor() const;
  101. void setProcessor(const QString&);
  102. QString getCCompiler() const;
  103. void setCCompiler(const QString&);
  104. QString getCXXCompiler() const;
  105. void setCXXCompiler(const QString&);
  106. QString getFortranCompiler() const;
  107. void setFortranCompiler(const QString&);
  108. QString getFindRoot() const;
  109. void setFindRoot(const QString&);
  110. enum CrossMode
  111. {
  112. BOTH,
  113. ONLY,
  114. NEVER
  115. };
  116. int getProgramMode() const;
  117. void setProgramMode(int);
  118. int getLibraryMode() const;
  119. void setLibraryMode(int);
  120. int getIncludeMode() const;
  121. void setIncludeMode(int);
  122. int nextId() const { return -1; }
  123. };
  124. //! the page that gives options for a toolchain file
  125. class ToolchainCompilerSetup : public QWizardPage
  126. {
  127. Q_OBJECT
  128. public:
  129. ToolchainCompilerSetup(QWidget* p);
  130. ~ToolchainCompilerSetup();
  131. QString toolchainFile() const;
  132. void setToolchainFile(const QString&);
  133. int nextId() const { return -1; }
  134. protected:
  135. QCMakeFilePathEditor* ToolchainFile;
  136. };
  137. //! the wizard with the pages
  138. class FirstConfigure : public QWizard
  139. {
  140. Q_OBJECT
  141. public:
  142. FirstConfigure();
  143. ~FirstConfigure();
  144. void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
  145. void setCurrentGenerator(const QString& gen);
  146. void setToolset(const QString& toolset);
  147. void setPlatform(const QString& platform);
  148. void setCompilerOption(CompilerOption option);
  149. QString getGenerator() const;
  150. QString getPlatform() const;
  151. QString getToolset() const;
  152. bool defaultSetup() const;
  153. bool compilerSetup() const;
  154. bool crossCompilerSetup() const;
  155. bool crossCompilerToolChainFile() const;
  156. QString getCCompiler() const;
  157. QString getCXXCompiler() const;
  158. QString getFortranCompiler() const;
  159. QString getSystemName() const;
  160. QString getSystemVersion() const;
  161. QString getSystemProcessor() const;
  162. QString getCrossRoot() const;
  163. QString getCrossProgramMode() const;
  164. QString getCrossLibraryMode() const;
  165. QString getCrossIncludeMode() const;
  166. QString getCrossCompilerToolChainFile() const;
  167. void loadFromSettings();
  168. void saveToSettings();
  169. protected:
  170. StartCompilerSetup* mStartCompilerSetupPage;
  171. NativeCompilerSetup* mNativeCompilerSetupPage;
  172. CrossCompilerSetup* mCrossCompilerSetupPage;
  173. ToolchainCompilerSetup* mToolchainCompilerSetupPage;
  174. QString mDefaultGenerator;
  175. };