Bug fixes + rework check dir
All checks were successful
Build / Build (linux) (push) Successful in 35s
Build / Build (windows) (push) Successful in 37s

This commit is contained in:
2026-06-29 08:18:23 -04:00
parent 7216b2e307
commit 124560ac29
6 changed files with 226 additions and 209 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
build/ build/
.idea .idea
*.dot *.dot
scripts/

99
.vscode/tasks.json vendored
View File

@@ -5,6 +5,17 @@
"label": "Configure: Debug", "label": "Configure: Debug",
"type": "shell", "type": "shell",
"command": "./scripts/build_script configure -b debug", "command": "./scripts/build_script configure -b debug",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' configure -b debug -v"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": { "group": {
"isDefault": false "isDefault": false
}, },
@@ -15,6 +26,17 @@
"label": "Build: Debug", "label": "Build: Debug",
"type": "shell", "type": "shell",
"command": "./scripts/build_script build -b debug", "command": "./scripts/build_script build -b debug",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' build -b debug"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
@@ -26,6 +48,17 @@
"label": "Configure: Relwithdeb", "label": "Configure: Relwithdeb",
"type": "shell", "type": "shell",
"command": "./scripts/build_script configure -b relwithdeb", "command": "./scripts/build_script configure -b relwithdeb",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' configure -b relwithdeb"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": { "group": {
"isDefault": false "isDefault": false
}, },
@@ -36,6 +69,17 @@
"label": "Build: Relwithdeb", "label": "Build: Relwithdeb",
"type": "shell", "type": "shell",
"command": "./scripts/build_script build -b relwithdeb", "command": "./scripts/build_script build -b relwithdeb",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' build -b relwithdeb"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
@@ -47,6 +91,17 @@
"label": "Configure: Release", "label": "Configure: Release",
"type": "shell", "type": "shell",
"command": "./scripts/build_script configure -b release", "command": "./scripts/build_script configure -b release",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' configure -b release"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": { "group": {
"isDefault": false "isDefault": false
}, },
@@ -57,6 +112,17 @@
"label": "Build: Release", "label": "Build: Release",
"type": "shell", "type": "shell",
"command": "./scripts/build_script build -b release", "command": "./scripts/build_script build -b release",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' build -b release"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
@@ -68,6 +134,17 @@
"label": "Clean: Debug", "label": "Clean: Debug",
"type": "shell", "type": "shell",
"command": "./scripts/build_script clean -b debug", "command": "./scripts/build_script clean -b debug",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' clean -b debug"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": { "group": {
"isDefault": false "isDefault": false
}, },
@@ -77,6 +154,17 @@
"label": "Build: All", "label": "Build: All",
"type": "shell", "type": "shell",
"command": "./scripts/build_script build", "command": "./scripts/build_script build",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' build"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
@@ -88,6 +176,17 @@
"label": "Clean: All", "label": "Clean: All",
"type": "shell", "type": "shell",
"command": "./scripts/build_script clean", "command": "./scripts/build_script clean",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' clean"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": { "group": {
"isDefault": false "isDefault": false
}, },

View File

@@ -35,6 +35,7 @@ class Application {
void deleteDir(const std::filesystem::path& path); void deleteDir(const std::filesystem::path& path);
void createDir(const std::filesystem::path& path); void createDir(const std::filesystem::path& path);
void checkDir(std::string path);
void checkBuildDirs(); void checkBuildDirs();
int runCmd(std::string cmd); int runCmd(std::string cmd);

View File

@@ -63,7 +63,7 @@ void Application::buildProject() {
auto configureDirTask = auto configureDirTask =
m_Taskflow m_Taskflow
.emplace( .emplace(
[this]() { this->configureDir("build/debug", "debug"); }) [this]() { this->configureDir("build/debug", "Debug"); })
.name("configureDir(build/debug)"); .name("configureDir(build/debug)");
auto buildDirTask = auto buildDirTask =
m_Taskflow.emplace([this]() { this->buildDir("build/debug"); }) m_Taskflow.emplace([this]() { this->buildDir("build/debug"); })
@@ -122,7 +122,7 @@ void Application::configureProject() {
auto configureDirDebugTask = auto configureDirDebugTask =
m_Taskflow m_Taskflow
.emplace( .emplace(
[this]() { this->configureDir("build/debug", "debug"); }) [this]() { this->configureDir("build/debug", "Debug"); })
.name("configureDir(build/debug)"); .name("configureDir(build/debug)");
checkBuildDirsTask.precede(configureDirDebugTask); checkBuildDirsTask.precede(configureDirDebugTask);
@@ -154,7 +154,7 @@ void Application::configureProject() {
auto configureDirDebugTask = auto configureDirDebugTask =
m_Taskflow m_Taskflow
.emplace( .emplace(
[this]() { this->configureDir("build/debug", "debug"); }) [this]() { this->configureDir("build/debug", "Debug"); })
.name("configureDir(build/debug)"); .name("configureDir(build/debug)");
checkBuildDirsTask.precede(configureDirDebugTask); checkBuildDirsTask.precede(configureDirDebugTask);

View File

@@ -1,3 +1,4 @@
#include <filesystem>
#include <iostream> #include <iostream>
#include "app.h" #include "app.h"
@@ -40,128 +41,43 @@ void Application::createDir(const std::filesystem::path& path) {
} }
} }
void Application::checkBuildDirs() { void Application::checkDir(std::string path) {
spdlog::get("filesystem")->debug("Checking 'build' directory."); spdlog::get("filesystem")->debug("Checking '{}' directory.", path);
if (!std::filesystem::is_directory("build")) {
if (!std::filesystem::is_directory(path)) {
if (!std::filesystem::exists(path)) {
spdlog::get("filesystem") spdlog::get("filesystem")
->warn("'build' is not a directory. Deleting."); ->info("Creating 'build/debug' directory.");
deleteDir("build"); createDir(path);
return;
} }
if (!std::filesystem::exists("build")) { spdlog::get("filesystem")
spdlog::get("filesystem")->info("Creating 'build' directory"); ->warn("'build/debug' is not a directory. Deleting.");
createDir("build"); deleteDir("build/debug");
} }
}
void Application::checkBuildDirs() {
checkDir("build");
switch (m_BuildType) { switch (m_BuildType) {
case none: case none:
spdlog::get("filesystem") checkDir("build/debug");
->debug("Checking 'build/debug' directory."); checkDir("build/release");
if (!std::filesystem::is_directory("build/debug")) { checkDir("build/relwithdeb");
spdlog::get("filesystem") checkDir("build/minsizerel");
->warn("'build/debug' is not a directory. Deleting.");
deleteDir("build/debug");
}
if (!std::filesystem::exists("build/debug")) {
spdlog::get("filesystem")
->info("Creating 'build/debug' directory.");
createDir("build/debug");
}
spdlog::get("filesystem")
->debug("Checking 'build/release' directory.");
if (!std::filesystem::is_directory("build/release")) {
spdlog::get("filesystem")
->warn("'build/release' is not a directory. Deleting.");
deleteDir("build/release");
}
if (!std::filesystem::exists("build/release")) {
spdlog::get("filesystem")
->info("Creating 'build/release' directory.");
createDir("build/release");
}
spdlog::get("filesystem")
->debug("Checking 'build/relwithdeb' directory.");
if (!std::filesystem::is_directory("build/relwithdeb")) {
spdlog::get("filesystem")
->warn("'build/relwithdeb' is not a directory. Deleting.");
deleteDir("build/relwithdeb");
}
if (!std::filesystem::exists("build/relwithdeb")) {
spdlog::get("filesystem")
->info("Creating 'build/relwithdeb' directory.");
createDir("build/relwithdeb");
}
spdlog::get("filesystem")
->debug("Checking 'build/minsizerel' directory.");
if (!std::filesystem::is_directory("build/minsizerel")) {
spdlog::get("filesystem")
->warn("'build/minsizerel' is not a directory. Deleting.");
deleteDir("build/minsizerel");
}
if (!std::filesystem::exists("build/minsizerel")) {
spdlog::get("filesystem")
->info("Creating 'build/minsizerel' directory.");
createDir("build/minsizerel");
};
break; break;
case debug: case debug:
spdlog::get("filesystem") checkDir("build/debug");
->debug("Checking 'build/debug' directory.");
if (!std::filesystem::is_directory("build/debug")) {
spdlog::get("filsystem")
->warn("'build/debug' is not a directory. Deleting.");
deleteDir("build/debug");
}
if (!std::filesystem::exists("build/debug")) {
spdlog::get("filesystem")
->info("Creating 'build/debug' directory.");
createDir("build/debug");
}
break; break;
case release: case release:
spdlog::get("filesystem") checkDir("build/release");
->debug("Checking 'build/release' directory.");
if (!std::filesystem::is_directory("build/release")) {
spdlog::get("filesystem")
->warn("'build/release' is not a directory. Deleting.");
deleteDir("build/release");
}
if (!std::filesystem::exists("build/release")) {
spdlog::get("filesystem")
->info("Creating 'build/release' directory.");
createDir("build/release");
}
break; break;
case relwithdeb: case relwithdeb:
spdlog::get("filesystem") checkDir("build/relwithdeb");
->debug("Checking 'build/relwithdeb' directory.");
if (!std::filesystem::is_directory("build/relwithdeb")) {
spdlog::get("filesystem")
->warn("'build/relwithdeb' is not a directory. Deleting.");
deleteDir("build/relwithdeb");
}
if (!std::filesystem::exists("build/relwithdeb")) {
spdlog::get("filesystem")
->info("Creating 'build/relwithdeb' directory.");
createDir("build/relwithdeb");
};
break; break;
case minsizerel: case minsizerel:
spdlog::get("filesystem") checkDir("build/minsizerel");
->debug("Checking 'build/minsizerel' directory.");
if (!std::filesystem::is_directory("build/minsizerel")) {
spdlog::get("filesystem")
->warn("'build/minsizerel' is not a directory. Deleting.");
deleteDir("build/minsizerel");
}
if (!std::filesystem::exists("build/minsizerel")) {
spdlog::get("filesystem")
->info("Creating 'build/minsizerel' directory.");
createDir("build/minsizerel");
};
break; break;
} }