aboutsummaryrefslogtreecommitdiffstats
path: root/dummy
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-06-23 15:16:37 +0200
committerClifford Wolf <clifford@clifford.at>2018-06-23 15:16:37 +0200
commitb5efe3ecbc1a00714ad6774d7e16b3d22b7cf43a (patch)
treec633d4e43489bc1515cd582b93b13a5fd23b0f5e /dummy
parent746d63f9fa7ffd7fcc5c460c04b65eccfbb3f205 (diff)
parent550866620acba97407e14dbc95ad5747d64ee3d6 (diff)
downloadnextpnr-b5efe3ecbc1a00714ad6774d7e16b3d22b7cf43a.tar.gz
nextpnr-b5efe3ecbc1a00714ad6774d7e16b3d22b7cf43a.tar.bz2
nextpnr-b5efe3ecbc1a00714ad6774d7e16b3d22b7cf43a.zip
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
Diffstat (limited to 'dummy')
-rw-r--r--dummy/main.cc29
-rw-r--r--dummy/pybindings.cc4
2 files changed, 28 insertions, 5 deletions
diff --git a/dummy/main.cc b/dummy/main.cc
index fa1259d4..6b4f9655 100644
--- a/dummy/main.cc
+++ b/dummy/main.cc
@@ -19,15 +19,20 @@
#ifdef MAIN_EXECUTABLE
+#ifndef NO_GUI
#include <QApplication>
+#include "application.h"
+#include "mainwindow.h"
+#endif
+#ifndef NO_PYTHON
+#include "pybindings.h"
+#endif
#include <boost/filesystem/convenience.hpp>
#include <boost/program_options.hpp>
-#include "application.h"
#include "log.h"
-#include "mainwindow.h"
#include "nextpnr.h"
-#include "pybindings.h"
#include "version.h"
+#include <iostream>
USING_NEXTPNR_NAMESPACE
@@ -44,12 +49,17 @@ int main(int argc, char *argv[])
options.add_options()("help,h", "show help");
options.add_options()("verbose,v", "verbose output");
options.add_options()("force,f", "keep running after errors");
+#ifndef NO_GUI
options.add_options()("gui", "start gui");
+#endif
+
+ po::positional_options_description pos;
+#ifndef NO_PYTHON
options.add_options()("run", po::value<std::vector<std::string>>(),
"python file to execute");
- options.add_options()("version,V", "show version");
- po::positional_options_description pos;
pos.add("run", -1);
+#endif
+ options.add_options()("version,V", "show version");
po::variables_map vm;
try {
@@ -85,8 +95,11 @@ int main(int argc, char *argv[])
}
Context ctx(ArchArgs{});
+
+#ifndef NO_PYTHON
init_python(argv[0]);
python_export_global("ctx", ctx);
+#endif
if (vm.count("verbose")) {
ctx.verbose = true;
@@ -100,13 +113,16 @@ int main(int argc, char *argv[])
ctx.rngseed(vm["seed"].as<int>());
}
+#ifndef NO_PYTHON
if (vm.count("run")) {
std::vector<std::string> files =
vm["run"].as<std::vector<std::string>>();
for (auto filename : files)
execute_python_file(filename.c_str());
}
+#endif
+#ifndef NO_GUI
if (vm.count("gui")) {
Application a(argc, argv);
MainWindow w(&ctx);
@@ -114,7 +130,10 @@ int main(int argc, char *argv[])
rc = a.exec();
}
+#endif
+#ifndef NO_PYTHON
deinit_python();
+#endif
return rc;
} catch (log_execution_error_exception) {
#if defined(_MSC_VER)
diff --git a/dummy/pybindings.cc b/dummy/pybindings.cc
index 59bf402f..a2997456 100644
--- a/dummy/pybindings.cc
+++ b/dummy/pybindings.cc
@@ -18,6 +18,8 @@
*
*/
+#ifndef NO_PYTHON
+
#include "pybindings.h"
#include "nextpnr.h"
@@ -26,3 +28,5 @@ NEXTPNR_NAMESPACE_BEGIN
void arch_wrap_python() { class_<ArchArgs>("ArchArgs"); }
NEXTPNR_NAMESPACE_END
+
+#endif \ No newline at end of file