From d8f884957d5df16a42289a2e264529d2a510f794 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Fri, 2 Jan 2026 10:16:16 +0100 Subject: [PATCH] - [NEW] "exclude" permet excloure arxius al compilar --- main.cpp | 58 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/main.cpp b/main.cpp index 5d8b828..aedc255 100644 --- a/main.cpp +++ b/main.cpp @@ -18,11 +18,36 @@ std::string folder_char = "\\"; std::string folder_char = "/"; #endif -std::vector keys = {"libs", "cppflags", "executable", "sourcepath", "buildpath"}; -enum tokens {LIBS, CPPFLAGS, EXECUTABLE, SOURCEPATH, BUILDPATH}; +std::vector exclude; +std::vector keys = {"libs", "cppflags", "executable", "sourcepath", "buildpath", "exclude"}; +enum tokens {LIBS, CPPFLAGS, EXECUTABLE, SOURCEPATH, BUILDPATH, EXCLUDE}; bool must_link = false; +bool contains(const std::vector& v, const std::string& s) { return std::find(v.begin(), v.end(), s) != v.end(); } + +std::vector split(std::string str) +{ + std::vector strings; + char tmp[100]; + int tmp_p = 0, str_p = 0; + while (str[str_p]!=0) + { + if (str[str_p]!=32) + tmp[tmp_p++] = str[str_p++]; + else + { + tmp[tmp_p]=0; + strings.push_back(tmp); + tmp_p=0; while (str[str_p]==32) str_p++; + } + } + tmp[tmp_p]=0; + strings.push_back(tmp); + + return strings; +} + char *getBufferFromFile(const char* filename) { FILE *f = fopen(filename, "rb"); @@ -86,6 +111,10 @@ void loadLagueirtoFile() build_path = token; //std::cout << "BUILDPATH: " << build_path << std::endl; break; + case EXCLUDE: + exclude = split(token); + //std::cout << "BUILDPATH: " << build_path << std::endl; + break; } } } @@ -169,28 +198,6 @@ std::vector getIncludes(std::string filename) return includes; } -std::vector split(std::string str) -{ - std::vector strings; - char tmp[100]; - int tmp_p = 0, str_p = 0; - while (str[str_p]!=0) - { - if (str[str_p]!=32) - tmp[tmp_p++] = str[str_p++]; - else - { - tmp[tmp_p]=0; - strings.push_back(tmp); - tmp_p=0; while (str[str_p]==32) str_p++; - } - } - tmp[tmp_p]=0; - strings.push_back(tmp); - - return strings; -} - bool HeadersNeedRecompile(std::string file, std::filesystem::file_time_type object_file_write_time) { auto include_files = getIncludes(file); @@ -319,7 +326,8 @@ int main(int argc, char *argv[]) std::string file_extension = getFileExtension(source_file); if (file_extension=="cpp" || file_extension=="c") { - MaybeRecompile(source_file); + if (!contains(exclude, entry.path().filename())) + MaybeRecompile(source_file); } } }