| 10 | namespace build { |
| 11 | |
| 12 | int 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 | |
| 46 | int clean() { |
| 47 | bool success = false; |
no test coverage detected