summaryrefslogtreecommitdiff
path: root/slicer/tool/slicer.cpp
blob: 1a41bcb28562c9665ae1d3f674405c8d36d9042c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <slicer/parser.h>
#include <boost/program_options.hpp>

namespace po = boost::program_options;

int
main(int argc, char ** argv)
{
	boost::filesystem::path slice;
	boost::filesystem::path cpp;

	po::options_description opts("Slicer options");
	opts.add_options()
		("help,h", "Show this help message")
		("slice,i", po::value(&slice), "Input ICE Slice file")
		("cpp,o", po::value(&cpp), "Output C++ file");

	po::positional_options_description p;
	p.add("slice", 1);
	p.add("cpp", 1);

	po::variables_map vm;
	po::store(po::command_line_parser(argc, argv).options(opts).positional(p).run(), vm);
	po::notify(vm);

	if (vm.count("help") || slice.empty() || cpp.empty()) {
		std::cout << opts << std::endl;
		return 1;
	}

	Slicer::Slicer::Apply(slice, cpp);

	return 0;
}