Fix h file generated by dependency to appear in current src directory

This commit is contained in:
Thraix
2019-07-11 19:15:13 +02:00
parent f3b798e85e
commit 5a103442f8
3 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# This Makefile was generated using MakeGen v1.1.2 made by Tim Håkansson
# This Makefile was generated using MakeGen v1.1.3 made by Tim Håkansson
# and is licensed under MIT. Full source of the project can be found at
# https://github.com/Thraix/MakeGen
CC=@g++
+1 -1
View File
@@ -13,7 +13,7 @@
// Release , should be backwards compatible with any minor version
#define MAKEGEN_VERSION_RELEASE 1
// Minor changes, should be compatible with any other minor version with same major and release.
#define MAKEGEN_VERSION_MINOR 2
#define MAKEGEN_VERSION_MINOR 3
#define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
const static unsigned int FLAG_HELP = BIT(0);
+6 -4
View File
@@ -7,7 +7,8 @@ void HFileGen::Create(const ConfigFile& conf)
{
std::set<std::string> hFiles;
std::vector<std::string> files;
FileUtils::GetAllFiles(conf.srcdir,files);
std::string path = conf.configPath + conf.srcdir;
FileUtils::GetAllFiles(path,files);
// include paramenter with the path of the file
// For example src/graphics/Window.h -> graphics/Window.h if src is a src folder
for(auto it = files.begin(); it!=files.end();++it)
@@ -15,16 +16,17 @@ void HFileGen::Create(const ConfigFile& conf)
size_t extensionPos = it->find_last_of(".");
if(extensionPos != std::string::npos)
{
std::string filename = it->substr(conf.srcdir.length());
if(it->substr(extensionPos+1) == "h" && filename != conf.hFile)
std::string filename = it->substr(path.length());
if(it->substr(extensionPos+1) == "h" && filename != conf.configPath + conf.hFile)
{
// Make files sorted in alphabetical order
hFiles.emplace(filename);
}
}
}
LOG_INFO(conf.configPath);
std::ofstream os(conf.srcdir+"/"+conf.hFile);
std::ofstream os(conf.configPath + conf.srcdir+"/"+conf.hFile);
os << "#pragma once" << std::endl << std::endl;
for(auto&& hFile : hFiles)
os << "#include <" << hFile << ">" << std::endl;