Fix absolute paths causing Makefile errors
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# This Makefile was generated using MakeGen v1.3.2 made by Tim Håkansson
|
# This Makefile was generated using MakeGen v1.3.3 made by Tim Håkansson
|
||||||
# and is licensed under MIT. Full source of the project can be found at
|
# and is licensed under MIT. Full source of the project can be found at
|
||||||
# https://github.com/Thraix/MakeGen
|
# https://github.com/Thraix/MakeGen
|
||||||
CC=@g++
|
CC=@g++
|
||||||
|
|||||||
+1
-1
@@ -19,5 +19,5 @@
|
|||||||
<srcdir>src/</srcdir>
|
<srcdir>src/</srcdir>
|
||||||
</configuration>
|
</configuration>
|
||||||
<target>Release</target>
|
<target>Release</target>
|
||||||
<version>v1.3.2</version>
|
<version>v1.3.3</version>
|
||||||
</makegen>
|
</makegen>
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
// Release, should be backwards compatible with any minor version
|
// Release, should be backwards compatible with any minor version
|
||||||
#define MAKEGEN_VERSION_RELEASE 3
|
#define MAKEGEN_VERSION_RELEASE 3
|
||||||
// Minor changes, generally bug fixes
|
// Minor changes, generally bug fixes
|
||||||
#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))
|
#define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -29,8 +29,13 @@ IncludeDeps::IncludeDeps(const std::string& filename, bool projectHFile, const s
|
|||||||
{
|
{
|
||||||
std::string include = GetIncludeFile(line);
|
std::string include = GetIncludeFile(line);
|
||||||
|
|
||||||
|
std::filesystem::path includeFileRelativeToSource;
|
||||||
|
if (path.is_absolute())
|
||||||
|
includeFileRelativeToSource = std::filesystem::relative("/", ".").string() + "/" + include;
|
||||||
|
else
|
||||||
|
includeFileRelativeToSource = std::filesystem::relative(path.parent_path(), ".").string() + "/" + include;
|
||||||
|
|
||||||
// Check if file can be found relative to current file:
|
// Check if file can be found relative to current file:
|
||||||
std::filesystem::path includeFileRelativeToSource = std::filesystem::relative(path.parent_path(), ".").string() + "/" + include;
|
|
||||||
if (FileUtils::FileExists(includeFileRelativeToSource.string()))
|
if (FileUtils::FileExists(includeFileRelativeToSource.string()))
|
||||||
{
|
{
|
||||||
auto itD = allDeps.find(includeFileRelativeToSource.string());
|
auto itD = allDeps.find(includeFileRelativeToSource.string());
|
||||||
|
|||||||
+9
-5
@@ -15,7 +15,7 @@ class IncludeDeps
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::map<std::string, IncludeDeps*> dependencies;
|
std::map<std::string, IncludeDeps*> dependencies;
|
||||||
std::string filepath;
|
std::filesystem::path filepath;
|
||||||
bool projectHFile;
|
bool projectHFile;
|
||||||
static std::set<std::string> printSet;
|
static std::set<std::string> printSet;
|
||||||
static int printCounter;
|
static int printCounter;
|
||||||
@@ -28,14 +28,18 @@ class IncludeDeps
|
|||||||
|
|
||||||
std::ostream& Output(std::ostream& stream, const ConfigFile& conf)
|
std::ostream& Output(std::ostream& stream, const ConfigFile& conf)
|
||||||
{
|
{
|
||||||
std::string filePathRelativeToConfig = std::filesystem::relative(conf.GetConfigPath() + "/" + filepath, "./").string();
|
std::string filePathInMakeFile = filepath;
|
||||||
if(printSet.find(filePathRelativeToConfig) != printSet.end())
|
if(!filepath.is_absolute())
|
||||||
|
filePathInMakeFile = std::filesystem::relative(conf.GetConfigPath() + "/" + filepath.string(), "./").string();
|
||||||
|
|
||||||
|
if(printSet.find(filePathInMakeFile) != printSet.end())
|
||||||
return stream;
|
return stream;
|
||||||
printSet.emplace(filePathRelativeToConfig);
|
printSet.emplace(filePathInMakeFile);
|
||||||
printCounter++;
|
printCounter++;
|
||||||
|
|
||||||
if(!projectHFile)
|
if(!projectHFile)
|
||||||
{
|
{
|
||||||
stream << " " << filePathRelativeToConfig;
|
stream << " " << filePathInMakeFile;
|
||||||
}
|
}
|
||||||
for(auto it = dependencies.begin(); it != dependencies.end(); ++it)
|
for(auto it = dependencies.begin(); it != dependencies.end(); ++it)
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-2
@@ -1,8 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
#include <iostream>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
|
|
||||||
struct HFile
|
struct HFile
|
||||||
@@ -10,7 +11,7 @@ struct HFile
|
|||||||
std::string filename;
|
std::string filename;
|
||||||
bool isProjectHFile;
|
bool isProjectHFile;
|
||||||
|
|
||||||
std::string filepath;
|
std::filesystem::path filepath;
|
||||||
|
|
||||||
HFile(const std::string& filename, const std::string& directory, bool isProjectHFile)
|
HFile(const std::string& filename, const std::string& directory, bool isProjectHFile)
|
||||||
: filename{filename}, isProjectHFile{isProjectHFile}, filepath{directory+filename}
|
: filename{filename}, isProjectHFile{isProjectHFile}, filepath{directory+filename}
|
||||||
@@ -20,6 +21,11 @@ struct HFile
|
|||||||
{
|
{
|
||||||
return h1.filename < h2.filename;
|
return h1.filename < h2.filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend std::ostream& operator<<(std::ostream& ostream, const HFile& hFile)
|
||||||
|
{
|
||||||
|
return ostream << "filename: " << hFile.filename << "\tfilepath: " << hFile.filepath.string();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
|
|||||||
Reference in New Issue
Block a user