aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/main.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-07 08:56:54 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-07 08:56:54 +0200
commitbdd93135823ae1ef293d4be3eb50d0ca6bdeee9e (patch)
tree286f8f2ead78b5b20afd8aa8feaffe7e97df9f7f /ice40/main.cc
parentc18f0b1c2286d737f3ace47d4f843ef523ba4b97 (diff)
downloadnextpnr-bdd93135823ae1ef293d4be3eb50d0ca6bdeee9e.tar.gz
nextpnr-bdd93135823ae1ef293d4be3eb50d0ca6bdeee9e.tar.bz2
nextpnr-bdd93135823ae1ef293d4be3eb50d0ca6bdeee9e.zip
Allow loading and running Python files before GUI starts
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40/main.cc')
-rw-r--r--ice40/main.cc29
1 files changed, 15 insertions, 14 deletions
diff --git a/ice40/main.cc b/ice40/main.cc
index 9295bde4..3d3312c4 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -45,7 +45,7 @@ void svg_dump_el(const GraphicElement &el)
int main(int argc, char *argv[])
{
namespace po = boost::program_options;
-
+ int rc = 0;
std::string str;
po::options_description options("Allowed options");
@@ -122,15 +122,7 @@ int main(int argc, char *argv[])
chipArgs.type = ChipArgs::UP5K;
Design design(chipArgs);
-
- if (vm.count("gui"))
- {
- QApplication a(argc, argv);
- MainWindow w;
- w.show();
-
- return a.exec();
- }
+ init_python(argv[0]);
if (vm.count("test"))
{
@@ -216,8 +208,17 @@ int main(int argc, char *argv[])
if (vm.count("file"))
{
std::string filename = vm["file"].as<std::string>();
- execute_python_file(argv[0],filename.c_str());
- }
-
- return 0;
+ execute_python_file(filename.c_str());
+ }
+
+ if (vm.count("gui"))
+ {
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ rc = a.exec();
+ }
+ deinit_python();
+ return rc;
}