From 82ec1be31f2a13bca04cf1a6b69789c9cee0e535 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 23 Jun 2018 14:32:18 +0200 Subject: Added BUILD_GUI, BUILD_PYTHON and BUILD_TESTS cmake options, --- ice40/main.cc | 30 ++++++++++++++++++++++++------ ice40/pybindings.cc | 4 ++++ 2 files changed, 28 insertions(+), 6 deletions(-) (limited to 'ice40') 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 -#include +#include "application.h" +#include "mainwindow.h" +#endif +#ifndef NO_PYTHON +#include "pybindings.h" +#endif + #include #include #include #include -#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>(), "python file to execute"); + pos.add("run", -1); +#endif options.add_options()("json", po::value(), "JSON design file to ingest"); options.add_options()("pcf", po::value(), @@ -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(), "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(); 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 files = vm["run"].as>(); 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 -- cgit v1.2.3