MCPcopy Create free account
hub / github.com/build-cpp/cmkr / run

Function run

src/build.cpp:12–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace build {
11
12int run(int argc, char **argv) {
13 parser::Project project(nullptr, ".", true);
14 if (argc > 2) {
15 for (int i = 2; i < argc; ++i) {
16 project.build_args.emplace_back(argv[i]);
17 }
18 }
19 std::stringstream ss;
20
21 gen::generate_cmake(fs::current_path().string().c_str());
22
23 ss << "cmake -DCMKR_BUILD_SKIP_GENERATION=ON -B" << project.build_dir << " ";
24
25 if (!project.generator.empty()) {
26 ss << "-G \"" << project.generator << "\" ";
27 }
28 if (!project.config.empty()) {
29 ss << "-DCMAKE_BUILD_TYPE=" << project.config << " ";
30 }
31 if (!project.gen_args.empty()) {
32 for (const auto &arg : project.gen_args) {
33 ss << "-D" << arg << " ";
34 }
35 }
36 ss << "&& cmake --build " << project.build_dir << " --parallel";
37 if (argc > 2) {
38 for (const auto &arg : project.build_args) {
39 ss << " " << arg;
40 }
41 }
42
43 return ::system(ss.str().c_str());
44}
45
46int clean() {
47 bool success = false;

Callers 1

handle_argsFunction · 0.85

Calls 2

generate_cmakeFunction · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected