summaryrefslogtreecommitdiff
path: root/slicer/tool/slicer.cpp
blob: 925e6df9c1376883d81fc882207b2432fa64afce (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 <tool/parser.h>
#include <boost/program_options.hpp>

namespace po = boost::program_options;

int
main(int argc, char ** argv)
{
	Slicer::Slicer slicer;

	po::options_description opts("Slicer options");
	opts.add_options()
		("help,h", "Show this help message")
		("include,I", po::value(&slicer.includes), "Add include directory to search path")
		("headerPrefix", po::value(&slicer.headerPrefix)->default_value(slicer.headerPrefix), "Prefix path for Slicer C++ #includes")
		("slice,i", po::value(&slicer.slicePath), "Input ICE Slice file")
		("cpp,o", po::value(&slicer.cppPath), "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") || slicer.slicePath.empty() || slicer.cppPath.empty()) {
		// LCOV_EXCL_START
		std::cout << opts << std::endl;
		return 1;
		// LCOV_EXCL_STOP
	}
	slicer.Execute();

	return 0;
}