- [NEW] "exclude" permet excloure arxius al compilar
This commit is contained in:
58
main.cpp
58
main.cpp
@@ -18,11 +18,36 @@ std::string folder_char = "\\";
|
|||||||
std::string folder_char = "/";
|
std::string folder_char = "/";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<std::string> keys = {"libs", "cppflags", "executable", "sourcepath", "buildpath"};
|
std::vector<std::string> exclude;
|
||||||
enum tokens {LIBS, CPPFLAGS, EXECUTABLE, SOURCEPATH, BUILDPATH};
|
std::vector<std::string> keys = {"libs", "cppflags", "executable", "sourcepath", "buildpath", "exclude"};
|
||||||
|
enum tokens {LIBS, CPPFLAGS, EXECUTABLE, SOURCEPATH, BUILDPATH, EXCLUDE};
|
||||||
|
|
||||||
bool must_link = false;
|
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)
|
char *getBufferFromFile(const char* filename)
|
||||||
{
|
{
|
||||||
FILE *f = fopen(filename, "rb");
|
FILE *f = fopen(filename, "rb");
|
||||||
@@ -86,6 +111,10 @@ void loadLagueirtoFile()
|
|||||||
build_path = token;
|
build_path = token;
|
||||||
//std::cout << "BUILDPATH: " << build_path << std::endl;
|
//std::cout << "BUILDPATH: " << build_path << std::endl;
|
||||||
break;
|
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;
|
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)
|
bool HeadersNeedRecompile(std::string file, std::filesystem::file_time_type object_file_write_time)
|
||||||
{
|
{
|
||||||
auto include_files = getIncludes(file);
|
auto include_files = getIncludes(file);
|
||||||
@@ -319,7 +326,8 @@ int main(int argc, char *argv[])
|
|||||||
std::string file_extension = getFileExtension(source_file);
|
std::string file_extension = getFileExtension(source_file);
|
||||||
if (file_extension=="cpp" || file_extension=="c")
|
if (file_extension=="cpp" || file_extension=="c")
|
||||||
{
|
{
|
||||||
MaybeRecompile(source_file);
|
if (!contains(exclude, entry.path().filename()))
|
||||||
|
MaybeRecompile(source_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user