Bug fixes + rework check dir
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
build/
|
||||
.idea
|
||||
*.dot
|
||||
scripts/
|
||||
|
||||
99
.vscode/tasks.json
vendored
99
.vscode/tasks.json
vendored
@@ -5,6 +5,17 @@
|
||||
"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
|
||||
},
|
||||
@@ -15,6 +26,17 @@
|
||||
"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
|
||||
@@ -26,6 +48,17 @@
|
||||
"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
|
||||
},
|
||||
@@ -36,6 +69,17 @@
|
||||
"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
|
||||
@@ -47,6 +91,17 @@
|
||||
"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
|
||||
},
|
||||
@@ -57,6 +112,17 @@
|
||||
"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
|
||||
@@ -68,6 +134,17 @@
|
||||
"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
|
||||
},
|
||||
@@ -77,6 +154,17 @@
|
||||
"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
|
||||
@@ -88,6 +176,17 @@
|
||||
"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
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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")
|
||||
->warn("'build' is not a directory. Deleting.");
|
||||
deleteDir("build");
|
||||
->info("Creating 'build/debug' directory.");
|
||||
createDir(path);
|
||||
return;
|
||||
}
|
||||
if (!std::filesystem::exists("build")) {
|
||||
spdlog::get("filesystem")->info("Creating 'build' directory");
|
||||
createDir("build");
|
||||
spdlog::get("filesystem")
|
||||
->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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user