diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-11-04 04:29:04 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | f1a80658b08c8b489772052b5569cb1d3086db08 (patch) | |
tree | 32102f20750e8bd3b4ebb822f12bd4711d4fc602 /src | |
parent | 31899d0a48108515d13508b660fb3bb82b869430 (diff) |
Store dependencies in different directories depending on target platform
This fixed conflicts in cache filepath when building 32-bit and 64-bit project on the same
machine or when doing cross compilation.
Diffstat (limited to 'src')
-rw-r--r-- | src/CmakeModule.cpp | 3 | ||||
-rw-r--r-- | src/GlobalLib.cpp | 8 | ||||
-rw-r--r-- | src/main.cpp | 4 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp index 91c572d..a573e85 100644 --- a/src/CmakeModule.cpp +++ b/src/CmakeModule.cpp @@ -23,7 +23,8 @@ namespace sibs if (!globalLibDirResult) return Result<bool>::Err(globalLibDirResult); FileString globalLibDir = globalLibDirResult.unwrap(); - globalLibDir += TINYDIR_STRING("/.cache/sibs/lib"); + globalLibDir += TINYDIR_STRING("/.cache/sibs/lib/"); + globalLibDir += toFileString(asString(config.platform)); Result<bool> createGlobalLibDirResult = createDirectoryRecursive(globalLibDir.c_str()); if(createGlobalLibDirResult.isErr()) return createGlobalLibDirResult; diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp index 7f9d949..5c0e16d 100644 --- a/src/GlobalLib.cpp +++ b/src/GlobalLib.cpp @@ -102,7 +102,7 @@ namespace sibs // TODO: If return error is invalid url, then the message should be converted to // invalid package name/version. A check should be done if it is the name or version // that is invalid. - Result<bool> downloadDependencyResult = GlobalLib::downloadDependency(gitDependency); + Result<bool> downloadDependencyResult = GlobalLib::downloadDependency(gitDependency, parentConfig.platform); if(!downloadDependencyResult) return downloadDependencyResult; @@ -276,6 +276,8 @@ namespace sibs return Result<bool>::Err(libPathResult); FileString libPath = libPathResult.unwrap(); libPath += TINYDIR_STRING("/.cache/sibs/lib/"); + libPath += toFileString(asString(platform)); + libPath += TINYDIR_STRING("/"); libPath += toFileString(dependency->name); libPath += TINYDIR_STRING("/"); libPath += toFileString(package.version.toString()); @@ -308,13 +310,15 @@ namespace sibs return archiveExtractResult; } - Result<bool> GlobalLib::downloadDependency(GitDependency *dependency) + Result<bool> GlobalLib::downloadDependency(GitDependency *dependency, Platform platform) { Result<FileString> libPathResult = getHomeDir(); if (!libPathResult) return Result<bool>::Err(libPathResult); FileString libPath = libPathResult.unwrap(); libPath += TINYDIR_STRING("/.cache/sibs/lib/"); + libPath += toFileString(asString(platform)); + libPath += TINYDIR_STRING("/"); libPath += toFileString(dependency->name); // We dont care if the directory already exists. Nothing will happen if it does diff --git a/src/main.cpp b/src/main.cpp index ab8cd59..1265d3d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -101,10 +101,6 @@ using namespace std::chrono; // TODO: If dependencies are using a version that is not within our dependency version range then ask the user if they still want to use the dependency (the closest matching dependency). // Currently if dependency version does not match, build will always fail with no option to ignore version mismatch. -// TODO: Move global lib dependencies into different directories depending on the target platform, because one system can be used -// to build packages for the host platfrom and another platform by cross compilation. If cross compilation is used and a dependency is installed that is not compatible with the target platform then the dependency that fits the target platform wont be downloaded -// since the dependency already exists locally (but for a different platform). - #if OS_FAMILY == OS_FAMILY_POSIX #define fout std::cout #define ferr std::cerr |