#include "command_builder.h" // TODO(samjaffe): This function should perform a check to see if the // the buildfile actually needs to be recompiled. int compile_build_system() { std::cout << "Generating Build System..." << std::endl; // TODO(samjaffe): Magic constant for compiler auto cmd = build::command_builder("clang++", 1) // TODO(samjaffe): Detect the correct build source file << build::version::cxx17 << "build.cxx" << "-o" << "./build"; int const rc = cmd.execute(); if (rc) { std::cout << "Completed with errors, aborting" << std::endl; } else { std::cout << "Done!" << std::endl; } return rc; } int run_build_system(int const argc, char const * const argv[]) { std::vector arguments(argv + 1, argv + argc); std::cout << "Building... "; // TODO(samjaffe): Magic constant auto cmd = build::command_builder("./build") << arguments; int const rc = cmd.execute(); if (rc) { std::cout << "Build failed!" << std::endl; } else { std::cout << "Success!" << std::endl; } return rc; } int main(int argc, char const * const argv[]) { if (int rc = compile_build_system()) { return rc; } return run_build_system(argc, argv); }