diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-20 14:06:53 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-20 14:06:53 +0200 |
commit | 6c835d76f27af79813299419780c039eb2a8b02e (patch) | |
tree | c7c8f16ceb68a2957978d017ebd9aa3813598568 /ice40/main.cc | |
parent | 53034959f338c952f4cf905890e44aad2ba202ae (diff) | |
download | nextpnr-6c835d76f27af79813299419780c039eb2a8b02e.tar.gz nextpnr-6c835d76f27af79813299419780c039eb2a8b02e.tar.bz2 nextpnr-6c835d76f27af79813299419780c039eb2a8b02e.zip |
Few more checks on parameters and error eol
Diffstat (limited to 'ice40/main.cc')
-rw-r--r-- | ice40/main.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/ice40/main.cc b/ice40/main.cc index c14b6086..652196a1 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -66,6 +66,12 @@ void svg_dump_decal(const Context *ctx, const DecalXY &decal) } } +void conflicting_options(const boost::program_options::variables_map &vm, const char *opt1, const char *opt2) +{ + if (vm.count(opt1) && !vm[opt1].defaulted() && vm.count(opt2) && !vm[opt2].defaulted()) + log_error((std::string("Conflicting options '") + opt1 + "' and '" + opt2 + "'.").c_str()); +} + int main(int argc, char *argv[]) { try { @@ -122,13 +128,17 @@ int main(int argc, char *argv[]) po::store(parsed, vm); po::notify(vm); - } - - catch (std::exception &e) { + } catch (std::exception &e) { std::cout << e.what() << "\n"; return 1; } + conflicting_options(vm, "read", "json"); +#ifndef ICE40_HX1K_ONLY + if ((vm.count("lp384") + vm.count("lp1k") + vm.count("lp8k") + vm.count("hx1k") + vm.count("hx8k") + + vm.count("up5k")) > 1) + log_error("Only one device type can be set\n"); +#endif if (vm.count("help") || argc == 1) { help: std::cout << boost::filesystem::basename(argv[0]) |