aboutsummaryrefslogtreecommitdiff
path: root/include/Package.hpp
blob: 475e11b3d33afef3156d720c6baf3ee64f3028bf (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
#ifndef SIBS_PACKAGE_HPP
#define SIBS_PACKAGE_HPP

#include "../external/rapidjson/document.h"
#include "Result.hpp"
#include <string>

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
    };
    
    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);
    };
}

#endif //SIBS_PACKAGE_HPP