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