blob: dbae5f2e263d17868a24f42db7e7634742a893e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#ifndef SIBS_PACKAGE_HPP
#define SIBS_PACKAGE_HPP
#include "../external/rapidjson/document.h"
#include "Platform.hpp"
#include "Result.hpp"
#include <string>
#include <vector>
namespace sibs
{
enum class PackageType : int
{
// Compile as executable when compiling project with this directly.
// If used in dependency, then fail because you can't (currently) have dependency to executable.
EXECUTABLE,
// Compile as static library when compiling project with this directly.
// If used in dependency, then this is the preferred library type, but the dependant project can override this.
STATIC,
// Compile as dynamic library when compiling project with this directly.
// If used in dependency, then this is the preferred library type, but the dependant project can override this.
DYNAMIC,
// Identical to DYNAMIC
LIBRARY
};
struct PackageMetadata
{
std::string description;
std::string version;
std::vector<std::string> platforms;
std::vector<std::string> urls;
};
class Package
{
public:
/*
* Get package list from url which contains json file.
* Returns json document structure (rapidjson)
*/
static Result<rapidjson::Document*> 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<std::string> getPackageUrl(const char *packageName, const char *packageVersion, Platform platform);
};
}
#endif //SIBS_PACKAGE_HPP
|