| 73 | } |
| 74 | |
| 75 | std::optional<fs::path> findInDefaultPath(std::string const& lib_name) |
| 76 | { |
| 77 | auto const searchPath = |
| 78 | { |
| 79 | fs::current_path() / "deps", |
| 80 | fs::current_path() / "deps" / "lib", |
| 81 | fs::current_path() / ".." / "deps", |
| 82 | fs::current_path() / ".." / "deps" / "lib", |
| 83 | fs::current_path() / ".." / ".." / "deps", |
| 84 | fs::current_path() / ".." / ".." / "deps" / "lib", |
| 85 | fs::current_path(), |
| 86 | #ifdef __APPLE__ |
| 87 | fs::current_path().root_path() / fs::path("usr") / "local" / "lib", |
| 88 | #endif |
| 89 | }; |
| 90 | for (auto const& basePath: searchPath) |
| 91 | { |
| 92 | fs::path p = basePath / lib_name; |
| 93 | if (fs::exists(p)) |
| 94 | return p; |
| 95 | } |
| 96 | return std::nullopt; |
| 97 | } |
| 98 | |
| 99 | } |
| 100 | |