docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
docc_paths.h
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4#include <optional>
5#include <vector>
6
8
9namespace docc::util {
10
11std::optional<std::filesystem::path> find_lib_location();
12
13class DoccPaths {
14public:
15 virtual ~DoccPaths() = default;
16
17 [[nodiscard]] virtual std::vector<std::filesystem::path> get_default_include_paths() const = 0;
18 [[nodiscard]] virtual std::vector<std::filesystem::path> get_default_library_paths() const = 0;
19};
20
22public:
23 enum class DoccRootMode {
24 None, // dont know
25 CMake, // from source in git folder structure
26 Pip, // installed as a python package
27 GlobalDist, // expect all relevant parts to be installed in globally available and searched paths
28 Dist // within a specific folder, we have lib, include etc. subdirs. Classic docc package
29 };
30
31private:
32 std::filesystem::path bin_root_;
33 std::filesystem::path src_root_;
34 DoccRootMode root_mode_;
35
36public:
37 DefaultDoccPaths(std::filesystem::path bin_root, std::filesystem::path src_root, DoccRootMode root_mode);
38
39 const std::filesystem::path& bin_root() const { return bin_root_; }
40 const std::filesystem::path& src_root() const { return src_root_; }
41 DoccRootMode root_mode() const { return root_mode_; }
42
43 static std::unique_ptr<DefaultDoccPaths> from_lib_location(std::optional<std::filesystem::path> lib_location);
44 static std::unique_ptr<DefaultDoccPaths> from_root(const std::string_view& root);
45
46 std::vector<std::filesystem::path> get_default_include_paths() const override;
47 std::vector<std::filesystem::path> get_default_library_paths() const override;
48
49 std::optional<std::filesystem::path> get_builtin_target_plugin_src_path(const std::string& plugin) const;
50 std::optional<std::filesystem::path> get_builtin_target_plugin_rt_lib_path(const std::string& plugin) const;
51 std::optional<std::filesystem::path> get_builtin_target_plugin_rt_include_path(const std::string& plugin) const;
52 std::optional<std::filesystem::path>
53 get_builtin_target_plugin_rt_libexec_src_path(const std::string& plugin, const std::string& rt_name) const;
54};
55
56} // namespace docc::util
std::optional< std::filesystem::path > get_builtin_target_plugin_rt_lib_path(const std::string &plugin) const
static std::unique_ptr< DefaultDoccPaths > from_root(const std::string_view &root)
std::vector< std::filesystem::path > get_default_library_paths() const override
DefaultDoccPaths(std::filesystem::path bin_root, std::filesystem::path src_root, DoccRootMode root_mode)
const std::filesystem::path & bin_root() const
Definition docc_paths.h:39
std::optional< std::filesystem::path > get_builtin_target_plugin_src_path(const std::string &plugin) const
DoccRootMode root_mode() const
Definition docc_paths.h:41
std::optional< std::filesystem::path > get_builtin_target_plugin_rt_libexec_src_path(const std::string &plugin, const std::string &rt_name) const
const std::filesystem::path & src_root() const
Definition docc_paths.h:40
static std::unique_ptr< DefaultDoccPaths > from_lib_location(std::optional< std::filesystem::path > lib_location)
std::vector< std::filesystem::path > get_default_include_paths() const override
std::optional< std::filesystem::path > get_builtin_target_plugin_rt_include_path(const std::string &plugin) const
DoccRootMode
Definition docc_paths.h:23
@ GlobalDist
Definition docc_paths.h:27
@ Dist
Definition docc_paths.h:28
@ None
Definition docc_paths.h:24
@ CMake
Definition docc_paths.h:25
Definition docc_paths.h:13
virtual std::vector< std::filesystem::path > get_default_include_paths() const =0
virtual ~DoccPaths()=default
virtual std::vector< std::filesystem::path > get_default_library_paths() const =0
Definition cuda_query_compute_capability.h:8
std::optional< std::filesystem::path > find_lib_location()