Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae8f476c84 | |||
| 2edb275040 | |||
| 89eae8bd58 | |||
| bb30daedae |
+3
-1
@@ -1,3 +1,5 @@
|
||||
lagueirto
|
||||
.vscode/*
|
||||
lagueirto.exe
|
||||
*.exe
|
||||
*.zip
|
||||
build/*
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <condition_variable>
|
||||
#include <atomic>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
@@ -22,9 +23,9 @@ std::vector<std::string> source_paths;
|
||||
std::string build_path = "";
|
||||
std::string compiler = "g++";
|
||||
#ifdef _WIN32
|
||||
std::string folder_char = "\\";
|
||||
char folder_char = '\\';
|
||||
#else
|
||||
std::string folder_char = "/";
|
||||
char folder_char = '/';
|
||||
#endif
|
||||
std::string loaded_section = "";
|
||||
|
||||
@@ -175,14 +176,18 @@ bool loadLagueirtoFile(const std::string §ion_to_load)
|
||||
if (end == std::string::npos) continue;
|
||||
|
||||
current_section = line.substr(1, end - 1);
|
||||
|
||||
// Detectar si es default
|
||||
std::string rest = trim_copy(line.substr(end + 1));
|
||||
found_any_section = true;
|
||||
if (rest == "default") found_default = true;
|
||||
if (section_to_load.empty() && rest == "default") active = true;
|
||||
else active = (current_section == section_to_load);
|
||||
if (active) loaded_section = current_section;
|
||||
if (active) {
|
||||
loaded_section = current_section;
|
||||
std::cout << " > " << current_section << " < " << std::endl;
|
||||
} else {
|
||||
std::cout << " - " << current_section << std::endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -319,9 +324,17 @@ bool HeadersNeedRecompile(FileInfo file, std::filesystem::file_time_type object_
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MustRecompile(FileInfo file) {
|
||||
std::string object_file = build_path + folder_char + std::filesystem::path(file.filename).stem().string() + ".o";
|
||||
std::string generate_object_file_name(std::string filename) {
|
||||
std::filesystem::path cwd = std::filesystem::weakly_canonical(std::filesystem::current_path());
|
||||
std::filesystem::path target = std::filesystem::weakly_canonical(filename);
|
||||
std::string out = std::filesystem::relative(target, cwd).replace_extension("o").generic_string();
|
||||
for (char& c : out) if (c == '/') c = '.';
|
||||
return build_path + folder_char + out;
|
||||
}
|
||||
|
||||
bool MustRecompile(FileInfo file) {
|
||||
std::string object_file = generate_object_file_name(file.filename);
|
||||
|
||||
// si el objecte no existeix, fa falta recompilar
|
||||
if (!std::filesystem::exists(object_file)) {
|
||||
return true;
|
||||
@@ -341,7 +354,7 @@ bool MustRecompile(FileInfo file) {
|
||||
}
|
||||
|
||||
void Recompile(std::string source_file) {
|
||||
std::string object_file = build_path + folder_char + std::filesystem::path(source_file).stem().string() + ".o";
|
||||
std::string object_file = generate_object_file_name(source_file);
|
||||
must_link = true;
|
||||
std::string command = compiler + " " + source_file + " " + cppflags + " -c -o " + object_file;
|
||||
//std::cout << command << std::endl;
|
||||
@@ -537,7 +550,7 @@ std::cout << " |___/ v" << LAGUEIRTO_VERSION << std::endl;
|
||||
}
|
||||
|
||||
if (must_recompile_all) {
|
||||
std::cout << "remove: '" << build_path << "'" << std::endl;
|
||||
std::cout << "Doing a full rebuild" << std::endl;
|
||||
std::filesystem::remove_all(build_path);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user