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/
.idea
*.dot
scripts/

289
.vscode/tasks.json vendored
View File

@@ -1,98 +1,197 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Configure: Debug",
"type": "shell",
"command": "./scripts/build_script configure -b debug",
"group": {
"isDefault": false
},
"problemMatcher": [],
"detail": "Configure Debug"
},
{
"label": "Build: Debug",
"type": "shell",
"command": "./scripts/build_script build -b debug",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "Build Debug"
},
{
"label": "Configure: Relwithdeb",
"type": "shell",
"command": "./scripts/build_script configure -b relwithdeb",
"group": {
"isDefault": false
},
"problemMatcher": [],
"detail": "Configure Release with debug info"
},
{
"label": "Build: Relwithdeb",
"type": "shell",
"command": "./scripts/build_script build -b relwithdeb",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "Build Release with debug info"
},
{
"label": "Configure: Release",
"type": "shell",
"command": "./scripts/build_script configure -b release",
"group": {
"isDefault": false
},
"problemMatcher": [],
"detail": "Configure Release"
},
{
"label": "Build: Release",
"type": "shell",
"command": "./scripts/build_script build -b release",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "Build Release"
},
{
"label": "Clean: Debug",
"type": "shell",
"command": "./scripts/build_script clean -b debug",
"group": {
"isDefault": false
},
"detail": "Clean debug files"
},
{
"label": "Build: All",
"type": "shell",
"command": "./scripts/build_script build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "Build all types"
},
{
"label": "Clean: All",
"type": "shell",
"command": "./scripts/build_script clean",
"group": {
"isDefault": false
},
"problemMatcher": [],
"detail": "Clean All files"
"version": "2.0.0",
"tasks": [
{
"label": "Configure: Debug",
"type": "shell",
"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": {
"isDefault": false
},
"problemMatcher": [],
"detail": "Configure Debug"
},
{
"label": "Build: Debug",
"type": "shell",
"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": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "Build Debug"
},
{
"label": "Configure: Relwithdeb",
"type": "shell",
"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": {
"isDefault": false
},
"problemMatcher": [],
"detail": "Configure Release with debug info"
},
{
"label": "Build: Relwithdeb",
"type": "shell",
"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": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "Build Release with debug info"
},
{
"label": "Configure: Release",
"type": "shell",
"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": {
"isDefault": false
},
"problemMatcher": [],
"detail": "Configure Release"
},
{
"label": "Build: Release",
"type": "shell",
"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": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "Build Release"
},
{
"label": "Clean: Debug",
"type": "shell",
"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": {
"isDefault": false
},
"detail": "Clean debug files"
},
{
"label": "Build: All",
"type": "shell",
"command": "./scripts/build_script build",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' build"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "Build all types"
},
{
"label": "Clean: All",
"type": "shell",
"command": "./scripts/build_script clean",
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-Command",
"& './scripts/build_script.exe' clean"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
"group": {
"isDefault": false
},
"problemMatcher": [],
"detail": "Clean All files"
}
]
}

View File

@@ -9,12 +9,12 @@ add_compile_options(-Wno-deprecated-declarations)
file(GLOB REQUIRED_CMAKE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.required.cmake")
foreach (cmake_file ${REQUIRED_CMAKE_FILES})
include(${cmake_file})
include(${cmake_file})
endforeach ()
file(GLOB CMAKE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.cmake")
foreach (cmake_file ${CMAKE_FILES})
include(${cmake_file})
include(${cmake_file})
endforeach ()
include_directories(src/)

View File

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

View File

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

View File

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