Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2edb275040 | |||
| 89eae8bd58 | |||
| bb30daedae |
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
lagueirto
|
lagueirto
|
||||||
.vscode/*
|
.vscode/*
|
||||||
lagueirto.exe
|
*.exe
|
||||||
|
*.zip
|
||||||
@@ -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 = "";
|
||||||
|
|
||||||
@@ -319,9 +320,17 @@ bool HeadersNeedRecompile(FileInfo file, std::filesystem::file_time_type object_
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MustRecompile(FileInfo file) {
|
std::string generate_object_file_name(std::string filename) {
|
||||||
std::string object_file = build_path + folder_char + std::filesystem::path(file.filename).stem().string() + ".o";
|
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
|
// si el objecte no existeix, fa falta recompilar
|
||||||
if (!std::filesystem::exists(object_file)) {
|
if (!std::filesystem::exists(object_file)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -341,7 +350,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;
|
||||||
|
|||||||
Reference in New Issue
Block a user