diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-06-23 14:32:18 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-06-23 14:32:49 +0200 |
commit | 82ec1be31f2a13bca04cf1a6b69789c9cee0e535 (patch) | |
tree | fed19ab35ad400d2642da1c4a327d89b0ff90f36 /ice40/main.cc | |
parent | b63fdfbeab5abb390c5c2c7b069672c9c8e06c82 (diff) | |
download | nextpnr-82ec1be31f2a13bca04cf1a6b69789c9cee0e535.tar.gz nextpnr-82ec1be31f2a13bca04cf1a6b69789c9cee0e535.tar.bz2 nextpnr-82ec1be31f2a13bca04cf1a6b69789c9cee0e535.zip |
Added BUILD_GUI, BUILD_PYTHON and BUILD_TESTS cmake options,
Diffstat (limited to 'ice40/main.cc')
-rw-r--r-- | ice40/main.cc | 30 |
1 files changed, 24 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) |