FirstConfigure.cxx 21 KB

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