Add build jobs arg
This commit is contained in:
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
@@ -10,7 +10,7 @@
|
||||
"args": [
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
"& './scripts/build_script.exe' configure -b debug -v"
|
||||
"& './scripts/build_script.exe' configure -b debug"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
|
||||
@@ -34,7 +34,14 @@ void Application::buildDir(const std::filesystem::path& path) {
|
||||
}
|
||||
|
||||
spdlog::get("build")->info("Building '{}'", path.string());
|
||||
if (int exitCode = runCmd(std::format("cd {} && ninja", path.string()));
|
||||
|
||||
std::string jobsStr = "";
|
||||
if (m_BuildJobs != 0) {
|
||||
jobsStr = std::format("-j {}", m_BuildJobs);
|
||||
}
|
||||
|
||||
if (int exitCode =
|
||||
runCmd(std::format("cd {} && ninja {}", path.string(), jobsStr));
|
||||
exitCode != 0) {
|
||||
spdlog::get("build")->critical("Command exited with exit code: {}",
|
||||
exitCode);
|
||||
|
||||
@@ -11,7 +11,8 @@ Application::Application(Options options)
|
||||
m_Verbose(options.verbose.value()),
|
||||
m_BuildType(options.buildType.value()),
|
||||
m_Command(options.command),
|
||||
m_Multithreaded(options.multithreaded.value()) {
|
||||
m_Multithreaded(options.multithreaded.value()),
|
||||
m_BuildJobs(options.jobs.value()) {
|
||||
createAllLoggers();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ class Application {
|
||||
bool m_DryRun;
|
||||
bool m_Verbose;
|
||||
bool m_Multithreaded;
|
||||
int m_BuildJobs;
|
||||
BuildType m_BuildType;
|
||||
Command m_Command;
|
||||
|
||||
|
||||
@@ -13,9 +13,10 @@ struct Options {
|
||||
std::optional<bool> verbose = false;
|
||||
std::optional<bool> dryrun = false;
|
||||
std::optional<bool> multithreaded = false;
|
||||
std::optional<int> jobs = 0;
|
||||
std::optional<std::string> graphFilename;
|
||||
};
|
||||
STRUCTOPT(Options, command, buildType, verbose, dryrun, multithreaded,
|
||||
STRUCTOPT(Options, command, buildType, verbose, dryrun, multithreaded, jobs,
|
||||
graphFilename);
|
||||
|
||||
Options parse(int argc, char** argv);
|
||||
|
||||
@@ -46,14 +46,13 @@ void Application::checkDir(std::string path) {
|
||||
|
||||
if (!std::filesystem::is_directory(path)) {
|
||||
if (!std::filesystem::exists(path)) {
|
||||
spdlog::get("filesystem")
|
||||
->info("Creating 'build/debug' directory.");
|
||||
spdlog::get("filesystem")->info("Creating '{}' directory.", path);
|
||||
createDir(path);
|
||||
return;
|
||||
}
|
||||
spdlog::get("filesystem")
|
||||
->warn("'build/debug' is not a directory. Deleting.");
|
||||
deleteDir("build/debug");
|
||||
->warn("'{}' is not a directory. Deleting.", path);
|
||||
deleteDir(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user