FirstConfigure.cxx 21 KB

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