- [NEW] "exclude" permet excloure arxius al compilar

This commit is contained in:
2026-01-02 10:16:16 +01:00
parent 6f1dfd4649
commit d8f884957d

View File

@@ -18,11 +18,36 @@ std::string folder_char = "\\";
std::string folder_char = "/";
#endif
std::vector<std::string> keys = {"libs", "cppflags", "executable", "sourcepath", "buildpath"};
enum tokens {LIBS, CPPFLAGS, EXECUTABLE, SOURCEPATH, BUILDPATH};
std::vector<std::string> exclude;
std::vector<std::string> keys = {"libs", "cppflags", "executable", "sourcepath", "buildpath", "exclude"};
enum tokens {LIBS, CPPFLAGS, EXECUTABLE, SOURCEPATH, BUILDPATH, EXCLUDE};
bool must_link = false;
bool contains(const std::vector<std::string>& v, const std::string& s) { return std::find(v.begin(), v.end(), s) != v.end(); }
std::vector<std::string> split(std::string str)
{
std::vector<std::string> 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<std::string> getIncludes(std::string filename)
return includes;
}
std::vector<std::string> split(std::string str)
{
std::vector<std::string> 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);
}
}
}