Refactor into a oop

This commit is contained in:
2026-06-28 08:18:15 -04:00
parent 1c7909b8f6
commit 1813b3f5cf
9 changed files with 184 additions and 173 deletions

View File

@@ -1,109 +1,109 @@
#include "commands.h"
#include "app.h"
void buildProject(const BuildType buildType, bool dryrun) {
checkBuildDirs(buildType, dryrun);
switch (buildType) {
void Application::buildProject() {
checkBuildDirs();
switch (m_BuildType) {
case none:
configureDir("build/debug", "Debug", dryrun);
buildDir("build/debug", dryrun);
configureDir("build/release", "Release", dryrun);
buildDir("build/release", dryrun);
configureDir("build/relwithdeb", "RelWithDeb", dryrun);
buildDir("build/relwithdeb", dryrun);
configureDir("build/minsizerel", "MinSizeRel", dryrun);
buildDir("build/minsizerel", dryrun);
configureDir("build/debug", "Debug");
buildDir("build/debug");
configureDir("build/release", "Release");
buildDir("build/release");
configureDir("build/relwithdeb", "RelWithDeb");
buildDir("build/relwithdeb");
configureDir("build/minsizerel", "MinSizeRel");
buildDir("build/minsizerel");
break;
case debug:
configureDir("build/debug", "Debug", dryrun);
buildDir("build/debug", dryrun);
configureDir("build/debug", "Debug");
buildDir("build/debug");
break;
case release:
configureDir("build/release", "Release", dryrun);
buildDir("build/release", dryrun);
configureDir("build/release", "Release");
buildDir("build/release");
break;
case relwithdeb:
configureDir("build/relwithdeb", "RelWithDeb", dryrun);
buildDir("build/relwithdeb", dryrun);
configureDir("build/relwithdeb", "RelWithDeb");
buildDir("build/relwithdeb");
break;
case minsizerel:
configureDir("build/minsizerel", "MinSizeRel", dryrun);
buildDir("build/minsizerel", dryrun);
configureDir("build/minsizerel", "MinSizeRel");
buildDir("build/minsizerel");
break;
}
}
void configureProject(const BuildType buildType, bool dryrun) {
checkBuildDirs(buildType, dryrun);
switch (buildType) {
void Application::configureProject() {
checkBuildDirs();
switch (m_BuildType) {
case none:
configureDir("build/debug", "Debug", dryrun);
configureDir("build/release", "Release", dryrun);
configureDir("build/relwithdeb", "RelWithDeb", dryrun);
configureDir("build/minsizerel", "MinSizeRel", dryrun);
configureDir("build/debug", "Debug");
configureDir("build/release", "Release");
configureDir("build/relwithdeb", "RelWithDeb");
configureDir("build/minsizerel", "MinSizeRel");
break;
case debug:
configureDir("build/debug", "Debug", dryrun);
configureDir("build/debug", "Debug");
break;
case release:
configureDir("build/release", "Release", dryrun);
configureDir("build/release", "Release");
break;
case relwithdeb:
configureDir("build/relwithbeb", "RelWithDeb", dryrun);
configureDir("build/relwithbeb", "RelWithDeb");
break;
case minsizerel:
configureDir("build/minsizerel", "MinSizeRel", dryrun);
configureDir("build/minsizerel", "MinSizeRel");
break;
}
}
void cleanProject(const BuildType buildType, bool dryrun) {
checkBuildDirs(buildType, dryrun);
void Application::cleanProject() {
checkBuildDirs();
switch (buildType) {
switch (m_BuildType) {
case none:
cleanDir("build/debug", dryrun);
cleanDir("build/release", dryrun);
cleanDir("build/relwithdeb", dryrun);
cleanDir("build/minsizerel", dryrun);
cleanDir("build/debug");
cleanDir("build/release");
cleanDir("build/relwithdeb");
cleanDir("build/minsizerel");
break;
case debug:
cleanDir("build/debug", dryrun);
cleanDir("build/debug");
break;
case release:
cleanDir("build/release", dryrun);
cleanDir("build/release");
break;
case relwithdeb:
cleanDir("build/relwithdeb", dryrun);
cleanDir("build/relwithdeb");
break;
case minsizerel:
cleanDir("build/minsizerel", dryrun);
cleanDir("build/minsizerel");
break;
}
}
void deleteProject(const BuildType buildType, bool dryrun) {
switch (buildType) {
void Application::deleteProject() {
switch (m_BuildType) {
case none:
deleteDir("build", dryrun);
deleteDir("build");
break;
case debug:
deleteDir("build/debug", dryrun);
deleteDir("build/debug");
break;
case release:
deleteDir("build/release", dryrun);
deleteDir("build/release");
break;
case relwithdeb:
deleteDir("build/relwithdeb", dryrun);
deleteDir("build/relwithdeb");
break;
case minsizerel:
deleteDir("build/minsizerel", dryrun);
deleteDir("build/minsizerel");
break;
}
}
void rebuildProject(const BuildType buildType, bool dryrun) {
deleteProject(buildType, dryrun);
checkBuildDirs(buildType, dryrun);
configureProject(buildType, dryrun);
buildProject(buildType, dryrun);
void Application::rebuildProject() {
deleteProject();
checkBuildDirs();
configureProject();
buildProject();
}