From a548abb5a6a83c9318e9db3cf71170a7610e2758 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 4 Jan 2018 01:01:35 +0100 Subject: Use packages list to find packages --- include/GlobalLib.hpp | 1 + include/Package.hpp | 21 +++++++++++++++++++++ include/PkgConfig.hpp | 1 + 3 files changed, 23 insertions(+) (limited to 'include') diff --git a/include/GlobalLib.hpp b/include/GlobalLib.hpp index b098543..e0cc25c 100644 --- a/include/GlobalLib.hpp +++ b/include/GlobalLib.hpp @@ -17,6 +17,7 @@ namespace sibs DEPENDENCY_VERSION_NO_MATCH = 20 }; + static Result getLibs(const std::vector &libs, const SibsConfig &parentConfig, const FileString &globalLibRootDir, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc, GlobalIncludeDirCallbackFunc globalIncludeDirCallback); static Result validatePackageExists(const FileString &globalLibRootDir, const std::string &name); static Result getLibsLinkerFlags(const SibsConfig &parentConfig, const FileString &globalLibRootDir, const std::string &name, const std::string &version, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc, GlobalIncludeDirCallbackFunc globalIncludeDirCallback); static Result downloadDependency(const Dependency &dependency); diff --git a/include/Package.hpp b/include/Package.hpp index 106a48d..475e11b 100644 --- a/include/Package.hpp +++ b/include/Package.hpp @@ -1,6 +1,10 @@ #ifndef SIBS_PACKAGE_HPP #define SIBS_PACKAGE_HPP +#include "../external/rapidjson/document.h" +#include "Result.hpp" +#include + namespace sibs { enum class PackageType : int @@ -20,6 +24,23 @@ namespace sibs // Identical to DYNAMIC LIBRARY }; + + class Package + { + public: + /* + * Get package list from url which contains json file. + * Returns json document structure (rapidjson) + */ + static Result getPackageList(const char *url); + + /* + * Return the first url in list. + * TODO: If we fail to fetch package from first url, try other other ones in the list (or if the first url is too slow / takes too long to respond). + * TODO: Add version matching with wildcard etc. If we specify "1.2.*", then it should get the latest version that matches; etc... + */ + static Result getPackageUrl(const char *packageName, const char *packageVersion); + }; } #endif //SIBS_PACKAGE_HPP diff --git a/include/PkgConfig.hpp b/include/PkgConfig.hpp index da78b91..e525843 100644 --- a/include/PkgConfig.hpp +++ b/include/PkgConfig.hpp @@ -13,6 +13,7 @@ namespace sibs class PkgConfig { public: + static Result validatePkgConfigPackageVersionExists(const Dependency &dependency); static Result validatePackageExists(const std::string &name); static Result validatePackageVersionAtLeast(const std::string &name, const std::string &version); static Result getDynamicLibsLinkerFlags(const std::vector &libs); -- cgit v1.2.3