aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
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 /ice40
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 'ice40')
-rw-r--r--ice40/main.cc30
-rw-r--r--ice40/pybindings.cc4
2 files changed, 28 insertions, 6 deletions
diff --git a/ice40/main.cc b/ice40/main.cc
index e60ce442..00ed660f 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -19,23 +19,27 @@
#ifdef MAIN_EXECUTABLE
+#ifndef NO_GUI
#include <QApplication>
-#include <QSurfaceFormat>
+#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 <fstream>
#include <iostream>
-#include "application.h"
#include "bitstream.h"
#include "design_utils.h"
#include "jsonparse.h"
#include "log.h"
-#include "mainwindow.h"
#include "nextpnr.h"
#include "pack.h"
#include "pcf.h"
#include "place_sa.h"
-#include "pybindings.h"
#include "route.h"
#include "timing.h"
#include "version.h"
@@ -76,13 +80,19 @@ int main(int argc, char *argv[])
options.add_options()("verbose,v", "verbose output");
options.add_options()("debug", "debug output");
options.add_options()("force,f", "keep running after errors");
+#ifndef NO_GUI
options.add_options()("gui", "start gui");
+#endif
options.add_options()("svg", "dump SVG file");
options.add_options()("pack-only",
"pack design only without placement or routing");
+ po::positional_options_description pos;
+#ifndef NO_PYTHON
options.add_options()("run", po::value<std::vector<std::string>>(),
"python file to execute");
+ pos.add("run", -1);
+#endif
options.add_options()("json", po::value<std::string>(),
"JSON design file to ingest");
options.add_options()("pcf", po::value<std::string>(),
@@ -104,8 +114,6 @@ int main(int argc, char *argv[])
options.add_options()("no-tmdriv", "disable timing-driven placement");
options.add_options()("package", po::value<std::string>(),
"set device package");
- po::positional_options_description pos;
- pos.add("run", -1);
po::variables_map vm;
try {
@@ -202,8 +210,11 @@ int main(int argc, char *argv[])
chipArgs.package = vm["package"].as<std::string>();
Context ctx(chipArgs);
+
+#ifndef NO_PYTHON
init_python(argv[0]);
python_export_global("ctx", ctx);
+#endif
if (vm.count("verbose")) {
ctx.verbose = true;
@@ -326,13 +337,16 @@ int main(int argc, char *argv[])
write_asc(&ctx, f);
}
+#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);
@@ -340,7 +354,11 @@ 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/ice40/pybindings.cc b/ice40/pybindings.cc
index 97eebd3e..2acc5258 100644
--- a/ice40/pybindings.cc
+++ b/ice40/pybindings.cc
@@ -18,6 +18,8 @@
*
*/
+#ifndef NO_PYTHON
+
#include "pybindings.h"
#include "nextpnr.h"
@@ -84,3 +86,5 @@ void arch_wrap_python()
}
NEXTPNR_NAMESPACE_END
+
+#endif // NO_PYTHON \ No newline at end of file