blob: 9d953cc429f73ddbf8d77523ab29c1134a35418d (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include "xmake.h"
#include <filesystem>
#include <iostream>
#include <sstream>
#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/process.hpp>
namespace fs = std::filesystem;
namespace bp = boost::process;
namespace pt = boost::property_tree;
using namespace std::string_literals;
namespace {
const fs::path XMakefile{"XMakefile"};
void usage()
{
std::cout << "Usage: xmake <target>" << std::endl;
}
}
int xmake(int argc, char* argv[])
{
try {
pt::ptree ptree;
pt::read_xml(XMakefile, ptree, pt::xml_parser::no_comments | pt::xml_parser::trim_whitespace);
std::string action{"default"};
if (argc == 1) { // default action
} else if (argc == 2) {
action = argv[1];
} else {
std::cerr << "Invalid arguments." << std::endl;
usage;
exit(1);
}
if (action == "default"s || action == "build") { // build
} else if (action == "clean") {
} else if (action == "install") {
} else if (action == "rebuild") {
} else if (action == "run") {
} else {
std::cerr << "Invalid action: " << action << std::endl;
usage;
exit(1);
}
// TODO: clearlist
// TODO: dependencies
// TODO: buildlist
} catch (const std::exception& ex) {
std::cerr << "Error: " << ex.what() << std::endl;
return 1;
}
return 0;
}
|