diff --git a/implementations/Crafter.Build-Configuration.cpp b/implementations/Crafter.Build-Configuration.cpp index b9d6867..8e4aee9 100644 --- a/implementations/Crafter.Build-Configuration.cpp +++ b/implementations/Crafter.Build-Configuration.cpp @@ -37,6 +37,8 @@ namespace Crafter { } void Configuration::SetDataFromJson(const nlohmann::json& configs, const nlohmann::json& config, fs::path workingDir) { + type = static_cast(-1); + debug = static_cast(2); if(config.contains("extends")) { const std::vector extends = config["extends"].get>(); for(const std::string& extendName : extends) { @@ -60,6 +62,8 @@ namespace Crafter { } if(config.contains("debug")) { debug = config["debug"].get(); + } else if(static_cast(debug) == 2) { + debug = false; } if(config.contains("type")) { std::string typeString = config["type"].get(); @@ -72,6 +76,8 @@ namespace Crafter { } else { throw std::invalid_argument("Unknown type: " + typeString); } + } else if(static_cast(type) == -1) { + type = CRAFTER_CONFIGURATION_TYPE_EXECUTABLE; } if(config.contains("march")) { march = config["march"].get(); diff --git a/implementations/Crafter.Build-Project.cpp b/implementations/Crafter.Build-Project.cpp index 3a407f8..5a2a11e 100644 --- a/implementations/Crafter.Build-Project.cpp +++ b/implementations/Crafter.Build-Project.cpp @@ -68,17 +68,17 @@ namespace Crafter { } void Project::Build(Configuration& config) const { if(binDir.empty()) { - Build(config, "bin"/fs::path(config.name)); + Build(config, path/("bin"/fs::path(config.name))); } else { - Build(config, this->binDir/config.name); + Build(config, path/this->binDir/config.name); } } void Project::Build(Configuration& config, const fs::path& binDir) const { fs::path buildDir; if(this->buildDir.empty()) { - buildDir = "build"/fs::path(config.name); + buildDir = path/("build"/fs::path(config.name)); } else { - buildDir = this->buildDir/config.name; + buildDir = path/this->buildDir/config.name; } Build(config, binDir, buildDir, name); } @@ -112,6 +112,7 @@ namespace Crafter { } }); + std::string command = "clang++"; if(!config.target.empty()) { command += std::format(" -target={}", config.target); @@ -202,7 +203,7 @@ clang++ -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --pr } else { depBuildDir = fs::path(config.dependencies[i].path).parent_path()/project.buildDir/depConfig.name; } - project.Build(depConfig, binDir, depBuildDir); + project.Build(depConfig, pcmDir, depBuildDir); libMutex.lock(); if (depLibSet.insert(project.name).second) { libsString+=std::format(" -l{}", project.name); @@ -337,15 +338,15 @@ clang++ -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --pr TestResult Project::RunTest(Test& test) const { fs::path binDir; if(this->binDir.empty()) { - binDir = "bin"/fs::path(test.config.name); + binDir = path/("bin"/fs::path(test.config.name)); } else { - binDir = this->binDir/test.config.name; + binDir = path/this->binDir/test.config.name; } fs::path buildDir; if(this->buildDir.empty()) { - buildDir = "build"/fs::path(test.config.name); + buildDir = path/("build"/fs::path(test.config.name)); } else { - buildDir = this->buildDir/test.config.name; + buildDir = path/this->buildDir/test.config.name; } try { diff --git a/implementations/main.cpp b/implementations/main.cpp index ffe0700..8fcc91c 100644 --- a/implementations/main.cpp +++ b/implementations/main.cpp @@ -70,9 +70,9 @@ int main(int argc, char* argv[]) { binDir = std::format("{}/{}", project.binDir.string(), config.name); } if(config.debug) { - system(std::format("cd {} && ./{}", (projectPath/fs::path(binDir)).string(), project.name).c_str()); + system(std::format("cd {} && ./{}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str()); } else { - system(std::format("cd {} && lldb -o run {}", (projectPath/fs::path(binDir)).string(), project.name).c_str()); + system(std::format("cd {} && lldb -o run {}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str()); } return 0; }