fix
This commit is contained in:
parent
cbc7b45b8d
commit
72effdee9b
3 changed files with 18 additions and 11 deletions
|
|
@ -37,6 +37,8 @@ namespace Crafter {
|
|||
}
|
||||
|
||||
void Configuration::SetDataFromJson(const nlohmann::json& configs, const nlohmann::json& config, fs::path workingDir) {
|
||||
type = static_cast<ConfigurationType>(-1);
|
||||
debug = static_cast<bool>(2);
|
||||
if(config.contains("extends")) {
|
||||
const std::vector<std::string> extends = config["extends"].get<std::vector<std::string>>();
|
||||
for(const std::string& extendName : extends) {
|
||||
|
|
@ -60,6 +62,8 @@ namespace Crafter {
|
|||
}
|
||||
if(config.contains("debug")) {
|
||||
debug = config["debug"].get<bool>();
|
||||
} else if(static_cast<int>(debug) == 2) {
|
||||
debug = false;
|
||||
}
|
||||
if(config.contains("type")) {
|
||||
std::string typeString = config["type"].get<std::string>();
|
||||
|
|
@ -72,6 +76,8 @@ namespace Crafter {
|
|||
} else {
|
||||
throw std::invalid_argument("Unknown type: " + typeString);
|
||||
}
|
||||
} else if(static_cast<int>(type) == -1) {
|
||||
type = CRAFTER_CONFIGURATION_TYPE_EXECUTABLE;
|
||||
}
|
||||
if(config.contains("march")) {
|
||||
march = config["march"].get<std::string>();
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue