FirstConfigure.cxx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. #include "FirstConfigure.h"
  2. #include "QCMakeSizeType.h"
  3. #include <QComboBox>
  4. #include <QRadioButton>
  5. #include <QSettings>
  6. #include <QVBoxLayout>
  7. #include "cmStringAlgorithms.h"
  8. #include "Compilers.h"
  9. StartCompilerSetup::StartCompilerSetup(QString defaultGeneratorPlatform,
  10. QString defaultGeneratorToolset,
  11. QWidget* p)
  12. : QWizardPage(p)
  13. , DefaultGeneratorPlatform(std::move(defaultGeneratorPlatform))
  14. , DefaultGeneratorToolset(std::move(defaultGeneratorToolset))
  15. {
  16. QVBoxLayout* l = new QVBoxLayout(this);
  17. l->addWidget(new QLabel(tr("Specify the generator for this project")));
  18. this->GeneratorOptions = new QComboBox(this);
  19. l->addWidget(this->GeneratorOptions);
  20. // Add the generator platform
  21. this->PlatformFrame = CreatePlatformWidgets();
  22. l->addWidget(PlatformFrame);
  23. // Add the ability to specify toolset (-T parameter)
  24. this->ToolsetFrame = CreateToolsetWidgets();
  25. l->addWidget(ToolsetFrame);
  26. l->addSpacing(6);
  27. this->CompilerSetupOptions[0] =
  28. new QRadioButton(tr("Use default native compilers"), this);
  29. this->CompilerSetupOptions[1] =
  30. new QRadioButton(tr("Specify native compilers"), this);
  31. this->CompilerSetupOptions[2] =
  32. new QRadioButton(tr("Specify toolchain file for cross-compiling"), this);
  33. this->CompilerSetupOptions[3] =
  34. new QRadioButton(tr("Specify options for cross-compiling"), this);
  35. l->addWidget(this->CompilerSetupOptions[0]);
  36. l->addWidget(this->CompilerSetupOptions[1]);
  37. l->addWidget(this->CompilerSetupOptions[2]);
  38. l->addWidget(this->CompilerSetupOptions[3]);
  39. this->CompilerSetupOptions[0]->setChecked(true);
  40. QObject::connect(this->CompilerSetupOptions[0], &QRadioButton::toggled, this,
  41. &StartCompilerSetup::onSelectionChanged);
  42. QObject::connect(this->CompilerSetupOptions[1], &QRadioButton::toggled, this,
  43. &StartCompilerSetup::onSelectionChanged);
  44. QObject::connect(this->CompilerSetupOptions[2], &QRadioButton::toggled, this,
  45. &StartCompilerSetup::onSelectionChanged);
  46. QObject::connect(this->CompilerSetupOptions[3], &QRadioButton::toggled, this,
  47. &StartCompilerSetup::onSelectionChanged);
  48. QObject::connect(
  49. this->GeneratorOptions,
  50. static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
  51. this, &StartCompilerSetup::onGeneratorChanged);
  52. }
  53. QFrame* StartCompilerSetup::CreateToolsetWidgets()
  54. {
  55. QFrame* frame = new QFrame(this);
  56. QVBoxLayout* l = new QVBoxLayout(frame);
  57. l->setContentsMargins(0, 0, 0, 0);
  58. ToolsetLabel = new QLabel(tr("Optional toolset to use (argument to -T)"));
  59. l->addWidget(ToolsetLabel);
  60. Toolset = new QLineEdit(frame);
  61. l->addWidget(Toolset);
  62. // Default to CMAKE_GENERATOR_TOOLSET env var if set
  63. if (!DefaultGeneratorToolset.isEmpty()) {
  64. this->Toolset->setText(DefaultGeneratorToolset);
  65. }
  66. return frame;
  67. }
  68. QFrame* StartCompilerSetup::CreatePlatformWidgets()
  69. {
  70. QFrame* frame = new QFrame(this);
  71. QVBoxLayout* l = new QVBoxLayout(frame);
  72. l->setContentsMargins(0, 0, 0, 0);
  73. this->PlatformLabel = new QLabel(tr("Optional platform for generator"));
  74. l->addWidget(this->PlatformLabel);
  75. this->PlatformOptions = new QComboBox(frame);
  76. this->PlatformOptions->setEditable(true);
  77. l->addWidget(this->PlatformOptions);
  78. return frame;
  79. }
  80. StartCompilerSetup::~StartCompilerSetup() = default;
  81. void StartCompilerSetup::setGenerators(
  82. std::vector<cmake::GeneratorInfo> const& gens)
  83. {
  84. this->GeneratorOptions->clear();
  85. QStringList generator_list;
  86. for (cmake::GeneratorInfo const& gen : gens) {
  87. generator_list.append(QString::fromStdString(gen.name));
  88. if (gen.supportsPlatform) {
  89. this->GeneratorsSupportingPlatform.append(
  90. QString::fromStdString(gen.name));
  91. this->GeneratorDefaultPlatform[QString::fromStdString(gen.name)] =
  92. QString::fromStdString(gen.defaultPlatform);
  93. auto platformIt = gen.supportedPlatforms.cbegin();
  94. while (platformIt != gen.supportedPlatforms.cend()) {
  95. this->GeneratorSupportedPlatforms.insert(
  96. QString::fromStdString(gen.name),
  97. QString::fromStdString((*platformIt)));
  98. platformIt++;
  99. }
  100. }
  101. if (gen.supportsToolset) {
  102. this->GeneratorsSupportingToolset.append(
  103. QString::fromStdString(gen.name));
  104. }
  105. }
  106. this->GeneratorOptions->addItems(generator_list);
  107. }
  108. void StartCompilerSetup::setCurrentGenerator(const QString& gen)
  109. {
  110. int idx = this->GeneratorOptions->findText(gen);
  111. if (idx != -1) {
  112. this->GeneratorOptions->setCurrentIndex(idx);
  113. }
  114. }
  115. void StartCompilerSetup::setPlatform(const QString& platform)
  116. {
  117. this->PlatformOptions->setCurrentText(platform);
  118. }
  119. void StartCompilerSetup::setToolset(const QString& toolset)
  120. {
  121. this->Toolset->setText(toolset);
  122. }
  123. void StartCompilerSetup::setCompilerOption(CompilerOption option)
  124. {
  125. std::size_t index = 0;
  126. switch (option) {
  127. case CompilerOption::DefaultPreset:
  128. this->CompilerSetupOptions[0]->setText(
  129. tr("Use default preset compilers"));
  130. CM_FALLTHROUGH;
  131. case CompilerOption::DefaultNative:
  132. index = 0;
  133. break;
  134. case CompilerOption::SpecifyNative:
  135. index = 1;
  136. break;
  137. case CompilerOption::ToolchainFile:
  138. index = 2;
  139. break;
  140. case CompilerOption::Options:
  141. index = 3;
  142. break;
  143. }
  144. this->CompilerSetupOptions[index]->setChecked(true);
  145. }
  146. QString StartCompilerSetup::getGenerator() const
  147. {
  148. return this->GeneratorOptions->currentText();
  149. };
  150. QString StartCompilerSetup::getPlatform() const
  151. {
  152. return this->PlatformOptions->currentText();
  153. };
  154. QString StartCompilerSetup::getToolset() const
  155. {
  156. return this->Toolset->text();
  157. };
  158. bool StartCompilerSetup::defaultSetup() const
  159. {
  160. return this->CompilerSetupOptions[0]->isChecked();
  161. }
  162. bool StartCompilerSetup::compilerSetup() const
  163. {
  164. return this->CompilerSetupOptions[1]->isChecked();
  165. }
  166. bool StartCompilerSetup::crossCompilerToolChainFile() const
  167. {
  168. return this->CompilerSetupOptions[2]->isChecked();
  169. }
  170. bool StartCompilerSetup::crossCompilerSetup() const
  171. {
  172. return this->CompilerSetupOptions[3]->isChecked();
  173. }
  174. void StartCompilerSetup::onSelectionChanged(bool on)
  175. {
  176. if (on) {
  177. emit selectionChanged();
  178. }
  179. }
  180. void StartCompilerSetup::onGeneratorChanged(int index)
  181. {
  182. QString name = this->GeneratorOptions->itemText(index);
  183. // Display the generator platform for the generators supporting it
  184. if (GeneratorsSupportingPlatform.contains(name)) {
  185. // Change the label title to include the default platform
  186. std::string label =
  187. cmStrCat("Optional platform for generator(if empty, generator uses: ",
  188. this->GeneratorDefaultPlatform[name].toStdString(), ')');
  189. this->PlatformLabel->setText(tr(label.c_str()));
  190. // Regenerate the list of supported platform
  191. this->PlatformOptions->clear();
  192. QStringList platform_list;
  193. platform_list.append("");
  194. QList<QString> platforms = this->GeneratorSupportedPlatforms.values(name);
  195. platform_list.append(platforms);
  196. this->PlatformOptions->addItems(platform_list);
  197. PlatformFrame->show();
  198. // Default to generator platform from environment
  199. if (!DefaultGeneratorPlatform.isEmpty()) {
  200. cm_qsizetype platform_index =
  201. platforms.indexOf(DefaultGeneratorPlatform);
  202. if (platform_index != -1) {
  203. // The index is off-by-one due to the first empty item added above.
  204. this->PlatformOptions->setCurrentIndex(
  205. static_cast<int>(platform_index + 1));
  206. }
  207. }
  208. } else {
  209. PlatformFrame->hide();
  210. }
  211. // Display the toolset box for the generators supporting it
  212. if (GeneratorsSupportingToolset.contains(name)) {
  213. ToolsetFrame->show();
  214. } else {
  215. ToolsetFrame->hide();
  216. }
  217. }
  218. int StartCompilerSetup::nextId() const
  219. {
  220. if (compilerSetup()) {
  221. return NativeSetup;
  222. }
  223. if (crossCompilerSetup()) {
  224. return CrossSetup;
  225. }
  226. if (crossCompilerToolChainFile()) {
  227. return ToolchainSetup;
  228. }
  229. return -1;
  230. }
  231. NativeCompilerSetup::NativeCompilerSetup(QWidget* p)
  232. : QWizardPage(p)
  233. {
  234. QVBoxLayout* l = new QVBoxLayout(this);
  235. QWidget* c = new QWidget(this);
  236. l->addWidget(c);
  237. this->setupUi(c);
  238. }
  239. NativeCompilerSetup::~NativeCompilerSetup() = default;
  240. QString NativeCompilerSetup::getCCompiler() const
  241. {
  242. return this->CCompiler->text();
  243. }
  244. void NativeCompilerSetup::setCCompiler(const QString& s)
  245. {
  246. this->CCompiler->setText(s);
  247. }
  248. QString NativeCompilerSetup::getCXXCompiler() const
  249. {
  250. return this->CXXCompiler->text();
  251. }
  252. void NativeCompilerSetup::setCXXCompiler(const QString& s)
  253. {
  254. this->CXXCompiler->setText(s);
  255. }
  256. QString NativeCompilerSetup::getFortranCompiler() const
  257. {
  258. return this->FortranCompiler->text();
  259. }
  260. void NativeCompilerSetup::setFortranCompiler(const QString& s)
  261. {
  262. this->FortranCompiler->setText(s);
  263. }
  264. CrossCompilerSetup::CrossCompilerSetup(QWidget* p)
  265. : QWizardPage(p)
  266. {
  267. this->setupUi(this);
  268. QWidget::setTabOrder(systemName, systemVersion);
  269. QWidget::setTabOrder(systemVersion, systemProcessor);
  270. QWidget::setTabOrder(systemProcessor, CrossCompilers->CCompiler);
  271. QWidget::setTabOrder(CrossCompilers->CCompiler, CrossCompilers->CXXCompiler);
  272. QWidget::setTabOrder(CrossCompilers->CXXCompiler,
  273. CrossCompilers->FortranCompiler);
  274. QWidget::setTabOrder(CrossCompilers->FortranCompiler, crossFindRoot);
  275. QWidget::setTabOrder(crossFindRoot, crossProgramMode);
  276. QWidget::setTabOrder(crossProgramMode, crossLibraryMode);
  277. QWidget::setTabOrder(crossLibraryMode, crossIncludeMode);
  278. // fill in combo boxes
  279. QStringList modes;
  280. modes << tr("Search in Target Root, then native system");
  281. modes << tr("Search only in Target Root");
  282. modes << tr("Search only in native system");
  283. crossProgramMode->addItems(modes);
  284. crossLibraryMode->addItems(modes);
  285. crossIncludeMode->addItems(modes);
  286. crossProgramMode->setCurrentIndex(2);
  287. crossLibraryMode->setCurrentIndex(1);
  288. crossIncludeMode->setCurrentIndex(1);
  289. this->registerField("systemName*", this->systemName);
  290. }
  291. CrossCompilerSetup::~CrossCompilerSetup() = default;
  292. QString CrossCompilerSetup::getCCompiler() const
  293. {
  294. return this->CrossCompilers->CCompiler->text();
  295. }
  296. void CrossCompilerSetup::setCCompiler(const QString& s)
  297. {
  298. this->CrossCompilers->CCompiler->setText(s);
  299. }
  300. QString CrossCompilerSetup::getCXXCompiler() const
  301. {
  302. return this->CrossCompilers->CXXCompiler->text();
  303. }
  304. void CrossCompilerSetup::setCXXCompiler(const QString& s)
  305. {
  306. this->CrossCompilers->CXXCompiler->setText(s);
  307. }
  308. QString CrossCompilerSetup::getFortranCompiler() const
  309. {
  310. return this->CrossCompilers->FortranCompiler->text();
  311. }
  312. void CrossCompilerSetup::setFortranCompiler(const QString& s)
  313. {
  314. this->CrossCompilers->FortranCompiler->setText(s);
  315. }
  316. QString CrossCompilerSetup::getSystem() const
  317. {
  318. return this->systemName->text();
  319. }
  320. void CrossCompilerSetup::setSystem(const QString& t)
  321. {
  322. this->systemName->setText(t);
  323. }
  324. QString CrossCompilerSetup::getVersion() const
  325. {
  326. return this->systemVersion->text();
  327. }
  328. void CrossCompilerSetup::setVersion(const QString& t)
  329. {
  330. this->systemVersion->setText(t);
  331. }
  332. QString CrossCompilerSetup::getProcessor() const
  333. {
  334. return this->systemProcessor->text();
  335. }
  336. void CrossCompilerSetup::setProcessor(const QString& t)
  337. {
  338. this->systemProcessor->setText(t);
  339. }
  340. QString CrossCompilerSetup::getFindRoot() const
  341. {
  342. return this->crossFindRoot->text();
  343. }
  344. void CrossCompilerSetup::setFindRoot(const QString& t)
  345. {
  346. this->crossFindRoot->setText(t);
  347. }
  348. int CrossCompilerSetup::getProgramMode() const
  349. {
  350. return this->crossProgramMode->currentIndex();
  351. }
  352. int CrossCompilerSetup::getLibraryMode() const
  353. {
  354. return this->crossLibraryMode->currentIndex();
  355. }
  356. int CrossCompilerSetup::getIncludeMode() const
  357. {
  358. return this->crossIncludeMode->currentIndex();
  359. }
  360. void CrossCompilerSetup::setProgramMode(int m)
  361. {
  362. this->crossProgramMode->setCurrentIndex(m);
  363. }
  364. void CrossCompilerSetup::setLibraryMode(int m)
  365. {
  366. this->crossLibraryMode->setCurrentIndex(m);
  367. }
  368. void CrossCompilerSetup::setIncludeMode(int m)
  369. {
  370. this->crossIncludeMode->setCurrentIndex(m);
  371. }
  372. ToolchainCompilerSetup::ToolchainCompilerSetup(QWidget* p)
  373. : QWizardPage(p)
  374. {
  375. QVBoxLayout* l = new QVBoxLayout(this);
  376. l->addWidget(new QLabel(tr("Specify the Toolchain file")));
  377. this->ToolchainFile = new QCMakeFilePathEditor(this);
  378. l->addWidget(this->ToolchainFile);
  379. }
  380. ToolchainCompilerSetup::~ToolchainCompilerSetup() = default;
  381. QString ToolchainCompilerSetup::toolchainFile() const
  382. {
  383. return this->ToolchainFile->text();
  384. }
  385. void ToolchainCompilerSetup::setToolchainFile(const QString& t)
  386. {
  387. this->ToolchainFile->setText(t);
  388. }
  389. FirstConfigure::FirstConfigure()
  390. {
  391. const char* env_generator = std::getenv("CMAKE_GENERATOR");
  392. const char* env_generator_platform = nullptr;
  393. const char* env_generator_toolset = nullptr;
  394. if (env_generator && std::strlen(env_generator)) {
  395. mDefaultGenerator = env_generator;
  396. env_generator_platform = std::getenv("CMAKE_GENERATOR_PLATFORM");
  397. env_generator_toolset = std::getenv("CMAKE_GENERATOR_TOOLSET");
  398. }
  399. if (!env_generator_platform) {
  400. env_generator_platform = "";
  401. }
  402. if (!env_generator_toolset) {
  403. env_generator_toolset = "";
  404. }
  405. // this->setOption(QWizard::HaveFinishButtonOnEarlyPages, true);
  406. this->mStartCompilerSetupPage = new StartCompilerSetup(
  407. env_generator_platform, env_generator_toolset, this);
  408. this->setPage(Start, this->mStartCompilerSetupPage);
  409. QObject::connect(this->mStartCompilerSetupPage,
  410. &StartCompilerSetup::selectionChanged, this,
  411. &FirstConfigure::restart);
  412. this->mNativeCompilerSetupPage = new NativeCompilerSetup(this);
  413. this->setPage(NativeSetup, this->mNativeCompilerSetupPage);
  414. this->mCrossCompilerSetupPage = new CrossCompilerSetup(this);
  415. this->setPage(CrossSetup, this->mCrossCompilerSetupPage);
  416. this->mToolchainCompilerSetupPage = new ToolchainCompilerSetup(this);
  417. this->setPage(ToolchainSetup, this->mToolchainCompilerSetupPage);
  418. }
  419. FirstConfigure::~FirstConfigure() = default;
  420. void FirstConfigure::setGenerators(
  421. std::vector<cmake::GeneratorInfo> const& gens)
  422. {
  423. this->mStartCompilerSetupPage->setGenerators(gens);
  424. }
  425. void FirstConfigure::setCurrentGenerator(const QString& gen)
  426. {
  427. this->mStartCompilerSetupPage->setCurrentGenerator(gen);
  428. }
  429. void FirstConfigure::setPlatform(const QString& platform)
  430. {
  431. this->mStartCompilerSetupPage->setPlatform(platform);
  432. }
  433. void FirstConfigure::setToolset(const QString& toolset)
  434. {
  435. this->mStartCompilerSetupPage->setToolset(toolset);
  436. }
  437. void FirstConfigure::setCompilerOption(CompilerOption option)
  438. {
  439. this->mStartCompilerSetupPage->setCompilerOption(option);
  440. }
  441. QString FirstConfigure::getGenerator() const
  442. {
  443. return this->mStartCompilerSetupPage->getGenerator();
  444. }
  445. QString FirstConfigure::getPlatform() const
  446. {
  447. return this->mStartCompilerSetupPage->getPlatform();
  448. }
  449. QString FirstConfigure::getToolset() const
  450. {
  451. return this->mStartCompilerSetupPage->getToolset();
  452. }
  453. void FirstConfigure::loadFromSettings()
  454. {
  455. QSettings settings;
  456. // restore generator
  457. settings.beginGroup("Settings/StartPath");
  458. QString lastGen = settings.value("LastGenerator").toString();
  459. this->setCurrentGenerator(lastGen);
  460. settings.endGroup();
  461. // restore compiler setup
  462. settings.beginGroup("Settings/Compiler");
  463. this->mNativeCompilerSetupPage->setCCompiler(
  464. settings.value("CCompiler").toString());
  465. this->mNativeCompilerSetupPage->setCXXCompiler(
  466. settings.value("CXXCompiler").toString());
  467. this->mNativeCompilerSetupPage->setFortranCompiler(
  468. settings.value("FortranCompiler").toString());
  469. settings.endGroup();
  470. // restore cross compiler setup
  471. settings.beginGroup("Settings/CrossCompiler");
  472. this->mCrossCompilerSetupPage->setCCompiler(
  473. settings.value("CCompiler").toString());
  474. this->mCrossCompilerSetupPage->setCXXCompiler(
  475. settings.value("CXXCompiler").toString());
  476. this->mCrossCompilerSetupPage->setFortranCompiler(
  477. settings.value("FortranCompiler").toString());
  478. this->mToolchainCompilerSetupPage->setToolchainFile(
  479. settings.value("ToolChainFile").toString());
  480. this->mCrossCompilerSetupPage->setSystem(
  481. settings.value("SystemName").toString());
  482. this->mCrossCompilerSetupPage->setVersion(
  483. settings.value("SystemVersion").toString());
  484. this->mCrossCompilerSetupPage->setProcessor(
  485. settings.value("SystemProcessor").toString());
  486. this->mCrossCompilerSetupPage->setFindRoot(
  487. settings.value("FindRoot").toString());
  488. this->mCrossCompilerSetupPage->setProgramMode(
  489. settings.value("ProgramMode", 0).toInt());
  490. this->mCrossCompilerSetupPage->setLibraryMode(
  491. settings.value("LibraryMode", 0).toInt());
  492. this->mCrossCompilerSetupPage->setIncludeMode(
  493. settings.value("IncludeMode", 0).toInt());
  494. settings.endGroup();
  495. // environment variables take precedence over application settings because...
  496. // - they're harder to set
  497. // - settings always exist after the program is run once, so the environment
  498. // variables would never be used otherwise
  499. // - platform and toolset are populated only from environment variables, so
  500. // this prevents them from being taken from environment, while the
  501. // generator is taken from application settings
  502. if (!mDefaultGenerator.isEmpty()) {
  503. this->setCurrentGenerator(mDefaultGenerator);
  504. }
  505. }
  506. void FirstConfigure::saveToSettings()
  507. {
  508. QSettings settings;
  509. // save generator
  510. settings.beginGroup("Settings/StartPath");
  511. QString lastGen = this->mStartCompilerSetupPage->getGenerator();
  512. settings.setValue("LastGenerator", lastGen);
  513. settings.endGroup();
  514. // save compiler setup
  515. settings.beginGroup("Settings/Compiler");
  516. settings.setValue("CCompiler",
  517. this->mNativeCompilerSetupPage->getCCompiler());
  518. settings.setValue("CXXCompiler",
  519. this->mNativeCompilerSetupPage->getCXXCompiler());
  520. settings.setValue("FortranCompiler",
  521. this->mNativeCompilerSetupPage->getFortranCompiler());
  522. settings.endGroup();
  523. // save cross compiler setup
  524. settings.beginGroup("Settings/CrossCompiler");
  525. settings.setValue("CCompiler",
  526. this->mCrossCompilerSetupPage->getCCompiler());
  527. settings.setValue("CXXCompiler",
  528. this->mCrossCompilerSetupPage->getCXXCompiler());
  529. settings.setValue("FortranCompiler",
  530. this->mCrossCompilerSetupPage->getFortranCompiler());
  531. settings.setValue("ToolChainFile", this->getCrossCompilerToolChainFile());
  532. settings.setValue("SystemName", this->mCrossCompilerSetupPage->getSystem());
  533. settings.setValue("SystemVersion",
  534. this->mCrossCompilerSetupPage->getVersion());
  535. settings.setValue("SystemProcessor",
  536. this->mCrossCompilerSetupPage->getProcessor());
  537. settings.setValue("FindRoot", this->mCrossCompilerSetupPage->getFindRoot());
  538. settings.setValue("ProgramMode",
  539. this->mCrossCompilerSetupPage->getProgramMode());
  540. settings.setValue("LibraryMode",
  541. this->mCrossCompilerSetupPage->getLibraryMode());
  542. settings.setValue("IncludeMode",
  543. this->mCrossCompilerSetupPage->getIncludeMode());
  544. settings.endGroup();
  545. }
  546. bool FirstConfigure::defaultSetup() const
  547. {
  548. return this->mStartCompilerSetupPage->defaultSetup();
  549. }
  550. bool FirstConfigure::compilerSetup() const
  551. {
  552. return this->mStartCompilerSetupPage->compilerSetup();
  553. }
  554. bool FirstConfigure::crossCompilerSetup() const
  555. {
  556. return this->mStartCompilerSetupPage->crossCompilerSetup();
  557. }
  558. bool FirstConfigure::crossCompilerToolChainFile() const
  559. {
  560. return this->mStartCompilerSetupPage->crossCompilerToolChainFile();
  561. }
  562. QString FirstConfigure::getCrossCompilerToolChainFile() const
  563. {
  564. return this->mToolchainCompilerSetupPage->toolchainFile();
  565. }
  566. QString FirstConfigure::getSystemName() const
  567. {
  568. return this->mCrossCompilerSetupPage->getSystem();
  569. }
  570. QString FirstConfigure::getCCompiler() const
  571. {
  572. if (this->compilerSetup()) {
  573. return this->mNativeCompilerSetupPage->getCCompiler();
  574. }
  575. if (this->crossCompilerSetup()) {
  576. return this->mCrossCompilerSetupPage->getCCompiler();
  577. }
  578. return QString();
  579. }
  580. QString FirstConfigure::getCXXCompiler() const
  581. {
  582. if (this->compilerSetup()) {
  583. return this->mNativeCompilerSetupPage->getCXXCompiler();
  584. }
  585. if (this->crossCompilerSetup()) {
  586. return this->mCrossCompilerSetupPage->getCXXCompiler();
  587. }
  588. return QString();
  589. }
  590. QString FirstConfigure::getFortranCompiler() const
  591. {
  592. if (this->compilerSetup()) {
  593. return this->mNativeCompilerSetupPage->getFortranCompiler();
  594. }
  595. if (this->crossCompilerSetup()) {
  596. return this->mCrossCompilerSetupPage->getFortranCompiler();
  597. }
  598. return QString();
  599. }
  600. QString FirstConfigure::getSystemVersion() const
  601. {
  602. return this->mCrossCompilerSetupPage->getVersion();
  603. }
  604. QString FirstConfigure::getSystemProcessor() const
  605. {
  606. return this->mCrossCompilerSetupPage->getProcessor();
  607. }
  608. QString FirstConfigure::getCrossRoot() const
  609. {
  610. return this->mCrossCompilerSetupPage->getFindRoot();
  611. }
  612. const QString CrossModes[] = { "BOTH", "ONLY", "NEVER" };
  613. QString FirstConfigure::getCrossProgramMode() const
  614. {
  615. return CrossModes[this->mCrossCompilerSetupPage->getProgramMode()];
  616. }
  617. QString FirstConfigure::getCrossLibraryMode() const
  618. {
  619. return CrossModes[this->mCrossCompilerSetupPage->getLibraryMode()];
  620. }
  621. QString FirstConfigure::getCrossIncludeMode() const
  622. {
  623. return CrossModes[this->mCrossCompilerSetupPage->getIncludeMode()];
  624. }