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
|
||||
# https://github.com/Thraix/MakeGen
|
||||
CC=@g++
|
||||
|
||||
+1
-1
@@ -19,5 +19,5 @@
|
||||
<srcdir>src/</srcdir>
|
||||
</configuration>
|
||||
<target>Release</target>
|
||||
<version>v1.3.2</version>
|
||||
<version>v1.3.3</version>
|
||||
</makegen>
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// Release, should be backwards compatible with any minor version
|
||||
#define MAKEGEN_VERSION_RELEASE 3
|
||||
// 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))
|
||||
|
||||
|
||||
+6
-1
@@ -29,8 +29,13 @@ IncludeDeps::IncludeDeps(const std::string& filename, bool projectHFile, const s
|
||||
{
|
||||
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:
|
||||
std::filesystem::path includeFileRelativeToSource = std::filesystem::relative(path.parent_path(), ".").string() + "/" + include;
|
||||
if (FileUtils::FileExists(includeFileRelativeToSource.string()))
|
||||
{
|
||||
auto itD = allDeps.find(includeFileRelativeToSource.string());
|
||||
|
||||
+9
-5
@@ -15,7 +15,7 @@ class IncludeDeps
|
||||
{
|
||||
public:
|
||||
std::map<std::string, IncludeDeps*> dependencies;
|
||||
std::string filepath;
|
||||
std::filesystem::path filepath;
|
||||
bool projectHFile;
|
||||
static std::set<std::string> printSet;
|
||||
static int printCounter;
|
||||
@@ -28,14 +28,18 @@ class IncludeDeps
|
||||
|
||||
std::ostream& Output(std::ostream& stream, const ConfigFile& conf)
|
||||
{
|
||||
std::string filePathRelativeToConfig = std::filesystem::relative(conf.GetConfigPath() + "/" + filepath, "./").string();
|
||||
if(printSet.find(filePathRelativeToConfig) != printSet.end())
|
||||
std::string filePathInMakeFile = filepath;
|
||||
if(!filepath.is_absolute())
|
||||
filePathInMakeFile = std::filesystem::relative(conf.GetConfigPath() + "/" + filepath.string(), "./").string();
|
||||
|
||||
if(printSet.find(filePathInMakeFile) != printSet.end())
|
||||
return stream;
|
||||
printSet.emplace(filePathRelativeToConfig);
|
||||
printSet.emplace(filePathInMakeFile);
|
||||
printCounter++;
|
||||
|
||||
if(!projectHFile)
|
||||
{
|
||||
stream << " " << filePathRelativeToConfig;
|
||||
stream << " " << filePathInMakeFile;
|
||||
}
|
||||
for(auto it = dependencies.begin(); it != dependencies.end(); ++it)
|
||||
{
|
||||
|
||||
+8
-2
@@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
struct HFile
|
||||
@@ -10,7 +11,7 @@ struct HFile
|
||||
std::string filename;
|
||||
bool isProjectHFile;
|
||||
|
||||
std::string filepath;
|
||||
std::filesystem::path filepath;
|
||||
|
||||
HFile(const std::string& filename, const std::string& directory, bool isProjectHFile)
|
||||
: filename{filename}, isProjectHFile{isProjectHFile}, filepath{directory+filename}
|
||||
@@ -20,6 +21,11 @@ struct HFile
|
||||
{
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user