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, --- dummy/main.cc | 29 ++++++++++++++++++++++++----- dummy/pybindings.cc | 4 ++++ 2 files changed, 28 insertions(+), 5 deletions(-) (limited to 'dummy') 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 +#include "application.h" +#include "mainwindow.h" +#endif +#ifndef NO_PYTHON +#include "pybindings.h" +#endif #include #include -#include "application.h" #include "log.h" -#include "mainwindow.h" #include "nextpnr.h" -#include "pybindings.h" #include "version.h" +#include 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>(), "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()); } +#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); @@ -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"); } NEXTPNR_NAMESPACE_END + +#endif \ No newline at end of file -- cgit v1.2.3