diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-13 09:14:48 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-13 09:14:48 +0200 |
commit | 8e54ac15421be441ece2a85ff0d61e850a99b2e9 (patch) | |
tree | eb21944633c881ff6f3e411f4ce9dfc67f9e47c4 /generic | |
parent | 499951cb65ff31fe15aa360a6b44371b13815d66 (diff) | |
download | nextpnr-8e54ac15421be441ece2a85ff0d61e850a99b2e9.tar.gz nextpnr-8e54ac15421be441ece2a85ff0d61e850a99b2e9.tar.bz2 nextpnr-8e54ac15421be441ece2a85ff0d61e850a99b2e9.zip |
Use command line parameters settings for GUI as well.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/main.cc | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/generic/main.cc b/generic/main.cc index 6f4774d1..3b8b3fe6 100644 --- a/generic/main.cc +++ b/generic/main.cc @@ -75,37 +75,49 @@ int main(int argc, char *argv[]) } if (vm.count("help") || argc == 1) { - std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git " - "sha1 " GIT_COMMIT_HASH_STR ")\n"; + std::cout << boost::filesystem::basename(argv[0]) + << " -- Next Generation Place and Route (git " + "sha1 " GIT_COMMIT_HASH_STR ")\n"; std::cout << "\n"; std::cout << options << "\n"; return argc != 1; } if (vm.count("version")) { - std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git " - "sha1 " GIT_COMMIT_HASH_STR ")\n"; + std::cout << boost::filesystem::basename(argv[0]) + << " -- Next Generation Place and Route (git " + "sha1 " GIT_COMMIT_HASH_STR ")\n"; return 1; } - Context ctx(ArchArgs{}); + std::unique_ptr<Context> ctx = std::unique_ptr<Context>(new Context(ArchArgs{})); if (vm.count("verbose")) { - ctx.verbose = true; + ctx->verbose = true; } if (vm.count("force")) { - ctx.force = true; + ctx->force = true; } if (vm.count("seed")) { - ctx.rngseed(vm["seed"].as<int>()); + ctx->rngseed(vm["seed"].as<int>()); } +#ifndef NO_GUI + if (vm.count("gui")) { + Application a(argc, argv); + MainWindow w(std::move(ctx)); + w.show(); + + return a.exec(); + } +#endif + #ifndef NO_PYTHON if (vm.count("run")) { init_python(argv[0], true); - python_export_global("ctx", ctx); + python_export_global("ctx", *ctx.get()); std::vector<std::string> files = vm["run"].as<std::vector<std::string>>(); for (auto filename : files) @@ -115,15 +127,6 @@ int main(int argc, char *argv[]) } #endif -#ifndef NO_GUI - if (vm.count("gui")) { - Application a(argc, argv); - MainWindow w; - w.show(); - - rc = a.exec(); - } -#endif return rc; } catch (log_execution_error_exception) { #if defined(_MSC_VER) |