diff options
-rw-r--r-- | backend/ninja/Ninja.cpp | 3 | ||||
-rw-r--r-- | include/GlobalLib.hpp | 2 | ||||
-rw-r--r-- | project.conf | 8 | ||||
-rw-r--r-- | src/CmakeModule.cpp | 3 | ||||
-rw-r--r-- | src/GlobalLib.cpp | 8 | ||||
-rw-r--r-- | src/main.cpp | 4 |
6 files changed, 15 insertions, 13 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 71e9c08..526fccb 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -325,7 +325,8 @@ namespace backend 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/include/GlobalLib.hpp b/include/GlobalLib.hpp index 6a6c72a..b6ac60c 100644 --- a/include/GlobalLib.hpp +++ b/include/GlobalLib.hpp @@ -24,7 +24,7 @@ namespace sibs static Result<bool> getLibsLinkerFlags(const SibsConfig &parentConfig, const FileString &globalLibRootDir, const std::string &name, const PackageVersionRange &versionRange, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc, GlobalIncludeDirCallbackFunc globalIncludeDirCallback); static Result<bool> getLibsLinkerFlags(const SibsConfig &parentConfig, const FileString &globalLibRootDir, GitDependency *gitDependency, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc, GlobalIncludeDirCallbackFunc globalIncludeDirCallback); static Result<bool> downloadDependency(PackageListDependency *dependency, Platform platform); - static Result<bool> downloadDependency(GitDependency *dependency); + static Result<bool> downloadDependency(GitDependency *dependency, Platform platform); private: static Result<bool> getLibsLinkerFlagsCommon(const SibsConfig &parentConfig, const FileString &packageDir, const std::string &dependencyName, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc, GlobalIncludeDirCallbackFunc globalIncludeDirCallback); }; diff --git a/project.conf b/project.conf index 5d4e5cb..ae1d2b0 100644 --- a/project.conf +++ b/project.conf @@ -1,7 +1,7 @@ [package] name = "sibs" type = "executable" -version = "0.2.0" +version = "0.3.0" authors = ["DEC05EBA <0xdec05eba@gmail.com>"] platforms = ["any"] @@ -9,6 +9,6 @@ platforms = ["any"] ignore_dirs = ["cmake", "cmake-build-debug", "build", "distribute", "examples", "msvc", "cmake_msvc"] [dependencies] -libcurl = "7" -libarchive = "3" -libgit2 = "0.24.0"
\ No newline at end of file +libcurl = ">=7" +libarchive = ">=3" +libgit2 = ">=0.24.0" 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 |