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/

289
.vscode/tasks.json vendored
View File

@@ -1,98 +1,197 @@
{ {
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "Configure: Debug", "label": "Configure: Debug",
"type": "shell", "type": "shell",
"command": "./scripts/build_script configure -b debug", "command": "./scripts/build_script configure -b debug",
"group": { "windows": {
"isDefault": false "command": "powershell.exe",
}, "args": [
"problemMatcher": [], "-NoProfile",
"detail": "Configure Debug" "-Command",
}, "& './scripts/build_script.exe' configure -b debug -v"
{ ],
"label": "Build: Debug", "options": {
"type": "shell", "cwd": "${workspaceFolder}"
"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"
} }
] },
"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") file(GLOB REQUIRED_CMAKE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.required.cmake")
foreach (cmake_file ${REQUIRED_CMAKE_FILES}) foreach (cmake_file ${REQUIRED_CMAKE_FILES})
include(${cmake_file}) include(${cmake_file})
endforeach () endforeach ()
file(GLOB CMAKE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.cmake") file(GLOB CMAKE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.cmake")
foreach (cmake_file ${CMAKE_FILES}) foreach (cmake_file ${CMAKE_FILES})
include(${cmake_file}) include(${cmake_file})
endforeach () endforeach ()
include_directories(src/) include_directories(src/)

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")
->info("Creating 'build/debug' directory.");
createDir(path);
return;
}
spdlog::get("filesystem") spdlog::get("filesystem")
->warn("'build' is not a directory. Deleting."); ->warn("'build/debug' is not a directory. Deleting.");
deleteDir("build"); deleteDir("build/debug");
}
if (!std::filesystem::exists("build")) {
spdlog::get("filesystem")->info("Creating 'build' directory");
createDir("build");
} }
}
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;
} }