MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Toolchain.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Acquisition.hpp"
4#include "Process.hpp"
5
8
9namespace MayaFlux::Platform {
10
11namespace fs = std::filesystem;
12
13#ifdef MAYAFLUX_PLATFORM_MACOS
14inline Acquired<std::filesystem::path> resolve_homebrew_prefix()
15{
16 std::string reported = exec_command("brew --prefix 2>/dev/null");
17 trim_output(reported);
18 if (!reported.empty() && detail::path_is_directory(reported)) {
19 return std::filesystem::path(reported);
20 }
21
22 const std::filesystem::path standard = "/opt/homebrew";
23 if (detail::path_is_directory(standard)) {
24 return standard;
25 }
26
27 return std::unexpected(AcquireFailure {
29 .request = "brew --prefix",
30 .tried = { standard } });
31}
32
33inline Acquired<std::filesystem::path> homebrew_prefix()
34{
35 static const Acquired<std::filesystem::path> prefix = resolve_homebrew_prefix();
36 return prefix;
37}
38#endif
39
41 std::vector<std::string> library_dirs;
42 std::vector<std::string> include_dirs;
43 std::vector<std::string> vswhere_paths;
44 std::vector<std::string> windows_kits_roots;
45 std::vector<std::string> macos_sdk_paths;
46};
47
49{
50#if defined(MAYAFLUX_PLATFORM_WINDOWS)
51 static const PlatformCandidates table {
52 .vswhere_paths = {
53 "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe",
54 "C:\\Program Files\\Microsoft Visual Studio\\Installer\\vswhere.exe" },
55 .windows_kits_roots = {
56 "C:\\Program Files (x86)\\Windows Kits\\10",
57 "C:\\Program Files\\Windows Kits\\10" },
58 };
59#elif defined(MAYAFLUX_PLATFORM_MACOS)
60 static const PlatformCandidates table {
61 .library_dirs = { "/usr/local/lib", "/usr/lib", "/lib", "/usr/local/lib64", "/usr/lib64", "/lib64" },
62 .include_dirs = { "/usr/include", "/usr/local/include" },
63 .macos_sdk_paths = {
64 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
65 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" },
66 };
67#else
68 static const PlatformCandidates table {
69 .library_dirs = { "/usr/local/lib", "/usr/lib", "/lib", "/usr/local/lib64", "/usr/lib64", "/lib64" },
70 .include_dirs = { "/usr/include", "/usr/local/include" },
71 };
72#endif
73 return table;
74}
75
76inline std::vector<std::string> dependency_fallbacks(std::string_view leaf)
77{
78 std::vector<std::string> paths;
79#ifdef MAYAFLUX_PLATFORM_MACOS
80 if (const auto prefix = homebrew_prefix()) {
81 paths.push_back((*prefix / "include" / leaf).string());
82 }
83#endif
84 for (const auto& dir : platform_candidates().include_dirs) {
85 paths.push_back((fs::path(dir) / leaf).string());
86 }
87 return paths;
88}
89
91 std::string vendored_root;
92 std::string_view env_hint;
93 std::vector<std::string> fallback_paths;
94 std::vector<std::string_view> aliases;
95 std::string_view marker_file;
96 std::vector<std::string_view> system_include_suffixes;
97};
98
99inline const std::vector<DependencyHint>& dependency_hints()
100{
101 static const std::vector<DependencyHint> hints = {
102 { .env_hint = Config::EIGEN_HINT,
103 .fallback_paths = dependency_fallbacks("eigen3"),
104 .aliases = { "eigen", "Eigen" } },
105 { .env_hint = Config::FREETYPE_HINT,
106 .fallback_paths = dependency_fallbacks("freetype2"),
107 .aliases = { "freetype2", "freetype" } },
108 { .vendored_root = (fs::path(Config::SOURCE_DIR) / "third_party/magic_enum").string(),
109 .env_hint = Config::MAGIC_ENUM_HINT,
110 .aliases = { "magic_enum" },
111 .marker_file = "magic_enum.hpp",
112 .system_include_suffixes = { "", "MayaFlux/thirdparty/magic_enum", "magic_enum" } },
113 };
114 return hints;
115}
116
117inline const DependencyHint* find_dependency_hint(std::string_view name)
118{
119 for (const auto& hint : dependency_hints()) {
120 if (std::ranges::contains(hint.aliases, name)) {
121 return &hint;
122 }
123 }
124 return nullptr;
125}
126
127namespace detail {
128
129 template <typename T, typename Compute>
130 T memoize_nonempty(Memory::SnapshotCell<T>& cell, Compute&& compute)
131 {
132 if (auto view = cell.read(); view && !view->empty()) {
133 return *view;
134 }
135 T value = std::forward<Compute>(compute)();
136 if (!value.empty()) {
137 cell.publish(value);
138 }
139 return value;
140 }
141
142}
143
144/**
145 * @brief Host toolchain and dependency discovery.
146 *
147 * Every function returns by value. Results that cost a process spawn or a
148 * filesystem walk are remembered per module in a SnapshotCell, and only a
149 * non-empty answer is remembered, so a lookup that missed is retried on the
150 * next call. An empty result means nothing was found.
151 */
153public:
154 /** @brief The clang resource directory, from `clang -print-resource-dir`, or empty. */
155 static std::string get_clang_resource_dir();
156
157 /** @brief The system include directories, in search order. */
158 static std::vector<std::string> get_system_includes();
159
160 /** @brief The existing system library directories, in search order. */
161 static std::vector<std::string> get_system_libraries();
162
163 /**
164 * @brief The absolute path of a shared library, or empty.
165 *
166 * A non-empty prefix is searched first, under its lib, lib64 and bin. Then the
167 * system library directories are searched directly. An empty prefix means no
168 * prefix, never the working directory. Names must be plain file names.
169 */
170 static std::string find_dep_library(const std::string& library_name, const std::string& prefix = "");
171
172 /** @brief The include directory of a named dependency, or empty. */
173 static std::string get_dep_includes(const std::string& library_name);
174
175 static std::string resolve_dependency_include(const DependencyHint& hint);
176
177#ifdef MAYAFLUX_PLATFORM_MACOS
178 static std::string get_macos_sdk_path();
179#endif // MAYAFLUX_PLATFORM_MACOS
180
181private:
182 static std::vector<std::string> get_clang_includes();
183
184 static std::vector<std::string> parse_clang_search_paths(const std::string& output);
185
186 static std::string find_latest_sdk_version(const fs::path& base);
187
188#ifdef MAYAFLUX_PLATFORM_WINDOWS
189
190 static std::string find_latest_vs_installation();
191
192 static std::string find_latest_msvc_version(const fs::path& msvc_base);
193
194 static std::vector<std::string> get_msvc_includes();
195
196 static std::vector<std::string> get_msvc_libraries();
197
198 static std::vector<std::string> get_windows_sdk_includes();
199
200 static std::vector<std::string> get_windows_sdk_libraries();
201
202 static std::vector<std::string> probe_sdk_paths(const std::string& subpath,
203 const std::vector<std::string>& subdirs,
204 const std::string& arch = "");
205
206#else
207 static std::vector<std::string> get_unix_library_paths();
208#ifdef MAYAFLUX_PLATFORM_MACOS
209 static std::string get_xcode_system_includes();
210#endif // MAYAFLUX_PLATFORM_MACOS
211
212#endif // MAYAFLUX_PLATFORM_WINDOWS
213};
214
216{
218
219 return detail::memoize_nonempty(cache, [] {
220 auto result = exec_command("clang -print-resource-dir");
221 trim_output(result);
222
223 if (!result.empty()
224 && (result.find("error:") == std::string::npos)
225 && (result.find("clang") != std::string::npos
226 || result.find("lib") != std::string::npos
227 || fs::exists(result))) {
228 return result;
229 }
230 return std::string {};
231 });
232}
233
234inline std::vector<std::string> SystemConfig::get_system_includes()
235{
237
238 return detail::memoize_nonempty(cache, [] {
239 std::vector<std::string> includes;
240
241#ifdef MAYAFLUX_PLATFORM_WINDOWS
242 auto msvc_includes = get_msvc_includes();
243 includes.insert(includes.end(), msvc_includes.begin(), msvc_includes.end());
244
245 auto sdk_includes = get_windows_sdk_includes();
246 includes.insert(includes.end(), sdk_includes.begin(), sdk_includes.end());
247#endif // MAYAFLUX_PLATFORM_WINDOWS
248
249 auto clang_includes = get_clang_includes();
250 includes.insert(includes.end(), clang_includes.begin(), clang_includes.end());
251
252#ifdef MAYAFLUX_PLATFORM_MACOS
253 std::string xcode_includes = SystemConfig::get_xcode_system_includes();
254 if (!xcode_includes.empty()) {
255 includes.push_back(xcode_includes);
256 }
257
258 if (const auto prefix = homebrew_prefix(); prefix && fs::exists(*prefix / "include")) {
259 includes.push_back((*prefix / "include").string());
260 }
261#endif // MAYAFLUX_PLATFORM_MACOS
262
263 return includes;
264 });
265}
266
267inline std::vector<std::string> SystemConfig::get_system_libraries()
268{
270
271 return detail::memoize_nonempty(cache, [] {
272 std::vector<std::string> lib_paths;
273
274#ifdef MAYAFLUX_PLATFORM_WINDOWS
275 auto msvc_libs = get_msvc_libraries();
276 lib_paths.insert(lib_paths.end(), msvc_libs.begin(), msvc_libs.end());
277
278 auto sdk_libs = get_windows_sdk_libraries();
279 lib_paths.insert(lib_paths.end(), sdk_libs.begin(), sdk_libs.end());
280#else
281 auto system_libs = get_unix_library_paths();
282 lib_paths.insert(lib_paths.end(), system_libs.begin(), system_libs.end());
283#endif
284
285 return lib_paths;
286 });
287}
288
289inline std::string SystemConfig::find_dep_library(const std::string& library_name, const std::string& prefix)
290{
291 if (!prefix.empty()) {
292 if (const auto found = acquire_library(LibraryFromPrefix { .prefix = prefix, .base_name = library_name })) {
293 return found->path.string();
294 }
295 }
296
297 std::vector<fs::path> directories;
298 for (const auto& directory : get_system_libraries()) {
299 directories.emplace_back(directory);
300 }
301
302 if (const auto found = acquire_library(LibraryFromDirectories { .directories = std::move(directories), .base_name = library_name })) {
303 return found->path.string();
304 }
305
306 return {};
307}
308
309inline std::string SystemConfig::get_dep_includes(const std::string& library_name)
310{
312
313 if (const auto view = cache.read()) {
314 if (const auto hit = view->find(library_name); hit != view->end()) {
315 return hit->second;
316 }
317 }
318
319 std::string result;
320 if (const auto* hint = find_dependency_hint(library_name)) {
321 result = resolve_dependency_include(*hint);
322 }
323
324 if (!result.empty()) {
326 entries.insert_or_assign(library_name, result);
327 });
328 }
329
330 return result;
331}
332
334{
335 const auto is_hit = [&hint](const fs::path& dir) {
336 return fs::exists(hint.marker_file.empty() ? dir : dir / hint.marker_file);
337 };
338
339 if (!hint.vendored_root.empty() && is_hit(fs::path(hint.vendored_root))) {
340 return hint.vendored_root;
341 }
342
343 if (!hint.env_hint.empty() && is_hit(fs::path(hint.env_hint))) {
344 return std::string(hint.env_hint);
345 }
346
347 for (const auto& path : hint.fallback_paths) {
348 if (is_hit(fs::path(path))) {
349 return path;
350 }
351 }
352
353 for (const auto& include : get_system_includes()) {
354 for (const auto& suffix : hint.system_include_suffixes) {
355 const fs::path candidate = suffix.empty()
356 ? fs::path(include)
357 : fs::path(include) / suffix;
358 if (is_hit(candidate)) {
359 return candidate.string();
360 }
361 }
362 }
363
364 return {};
365}
366
367inline std::vector<std::string> SystemConfig::get_clang_includes()
368{
369#ifdef MAYAFLUX_PLATFORM_WINDOWS
370 const char* cmd = "echo. | clang -v -E -x c++ - 2>&1";
371#else
372 const char* cmd = "clang -v -E -x c++ - 2>&1 < /dev/null";
373#endif
374
375 auto clang_output = exec_command(cmd);
376 return parse_clang_search_paths(clang_output);
377}
378
379inline std::vector<std::string> SystemConfig::parse_clang_search_paths(const std::string& output)
380{
381 std::vector<std::string> paths;
382 bool in_search_paths = false;
383
384 std::istringstream stream(output);
385 std::string line;
386
387 while (std::getline(stream, line)) {
388 if (line.find("#include <...> search starts here:") != std::string::npos) {
389 in_search_paths = true;
390 continue;
391 }
392 if (line.find("End of search list.") != std::string::npos) {
393 break;
394 }
395 if (in_search_paths) {
396 auto start = line.find_first_not_of(" \t");
397 if (start != std::string::npos) {
398 auto end = line.find_last_not_of(" \t");
399 std::string path = line.substr(start, end - start + 1);
400 if (!path.empty()) {
401 paths.push_back(path);
402 }
403 }
404 }
405 }
406 return paths;
407}
408
409inline std::string SystemConfig::find_latest_sdk_version(const fs::path& base)
410{
411 if (!fs::exists(base)) {
412 return "";
413 }
414
415 std::string latest_version;
416 for (const auto& entry : fs::directory_iterator(base)) {
417 if (entry.is_directory()) {
418 std::string name = entry.path().filename().string();
419 if (!name.empty() && std::isdigit(name[0])) {
420 if (latest_version.empty() || name > latest_version) {
421 latest_version = name;
422 }
423 }
424 }
425 }
426 return latest_version;
427}
428
429#ifdef MAYAFLUX_PLATFORM_WINDOWS
430
431inline bool is_vs_installation(const fs::path& candidate)
432{
433 std::error_code code;
434 return !candidate.empty()
435 && fs::is_directory(candidate, code)
436 && fs::is_directory(candidate / "VC" / "Tools" / "MSVC", code);
437}
438
439inline std::string query_vswhere(const std::string& vswhere_command)
440{
441 const std::string command = vswhere_command
442 + " -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath 2>nul";
443 std::string output = exec_command(command.c_str());
444 trim_output(output);
445 return is_vs_installation(fs::path(output)) ? output : std::string {};
446}
447
448inline std::string SystemConfig::find_latest_vs_installation()
449{
450 std::vector<std::string> commands { "vswhere" };
451
452 for (const char* name : { "ProgramFiles(x86)", "ProgramFiles", "ProgramW6432" }) {
453 const std::string root = safe_getenv(name);
454 if (root.empty()) {
455 continue;
456 }
457 const fs::path exe = fs::path(root) / "Microsoft Visual Studio" / "Installer" / "vswhere.exe";
458 std::error_code code;
459 if (fs::is_regular_file(exe, code)) {
460 commands.push_back("\"" + exe.string() + "\"");
461 }
462 }
463
464 for (const auto& path : platform_candidates().vswhere_paths) {
465 std::error_code code;
466 if (fs::is_regular_file(path, code)) {
467 commands.push_back("\"" + path + "\"");
468 }
469 }
470
471 for (const auto& command : commands) {
472 if (auto found = query_vswhere(command); !found.empty()) {
473 return found;
474 }
475 }
476
477 const std::string developer_prompt = safe_getenv("VSINSTALLDIR");
478 if (is_vs_installation(fs::path(developer_prompt))) {
479 return developer_prompt;
480 }
481
482 return "";
483}
484
485inline std::string SystemConfig::find_latest_msvc_version(const fs::path& msvc_base)
486{
487 if (!fs::exists(msvc_base)) {
488 return "";
489 }
490
491 std::string latest_version;
492 for (const auto& entry : fs::directory_iterator(msvc_base)) {
493 if (entry.is_directory()) {
494 std::string name = entry.path().filename().string();
495 if (!name.empty() && std::isdigit(name[0])) {
496 if (latest_version.empty() || name > latest_version) {
497 latest_version = name;
498 }
499 }
500 }
501 }
502 return latest_version;
503}
504
505inline std::vector<std::string> SystemConfig::get_msvc_includes()
506{
507 std::vector<std::string> includes;
508
509 std::string vs_path = find_latest_vs_installation();
510 if (!vs_path.empty()) {
511 fs::path msvc_base = fs::path(vs_path) / "VC" / "Tools" / "MSVC";
512 std::string version = find_latest_msvc_version(msvc_base);
513
514 if (!version.empty()) {
515 fs::path include_path = msvc_base / version / "include";
516 if (fs::exists(include_path)) {
517 includes.push_back(include_path.string());
518 }
519 }
520 }
521
522 if (includes.empty()) {
523 std::string vc_dir = safe_getenv("VCINSTALLDIR");
524 if (!vc_dir.empty() && fs::exists(vc_dir)) {
525 fs::path include_path = fs::path(vc_dir) / "include";
526 if (fs::exists(include_path)) {
527 includes.push_back(include_path.string());
528 }
529 }
530 }
531
532 return includes;
533}
534
535inline std::vector<std::string> SystemConfig::get_msvc_libraries()
536{
537 std::vector<std::string> lib_paths;
538
539 std::string vs_path = find_latest_vs_installation();
540 if (!vs_path.empty()) {
541 fs::path msvc_base = fs::path(vs_path) / "VC" / "Tools" / "MSVC";
542 std::string version = find_latest_msvc_version(msvc_base);
543
544 if (!version.empty()) {
545 fs::path lib_path = msvc_base / version / "lib" / "x64";
546 if (fs::exists(lib_path)) {
547 lib_paths.push_back(lib_path.string());
548 }
549 }
550 }
551
552 if (lib_paths.empty()) {
553 std::string vc_dir = safe_getenv("VCINSTALLDIR");
554 if (!vc_dir.empty() && fs::exists(vc_dir)) {
555 fs::path lib_path = fs::path(vc_dir) / "lib" / "x64";
556 if (fs::exists(lib_path)) {
557 lib_paths.push_back(lib_path.string());
558 }
559 }
560 }
561
562 return lib_paths;
563}
564
565inline std::vector<std::string> SystemConfig::get_windows_sdk_includes()
566{
567 std::vector<std::string> includes;
568
569 std::string sdk_dir = safe_getenv("WindowsSdkDir");
570 std::string sdk_ver = safe_getenv("WindowsSDKVersion");
571
572 if (!sdk_dir.empty() && !sdk_ver.empty() && fs::exists(sdk_dir)) {
573 fs::path base = fs::path(sdk_dir);
574 std::string version = std::string(sdk_ver);
575 if (!version.empty() && version.back() == '\\') {
576 version.pop_back();
577 }
578
579 std::vector<std::string> subdirs = { "ucrt", "shared", "um", "winrt", "cppwinrt" };
580 for (const auto& subdir : subdirs) {
581 fs::path include_path = base / "Include" / version / subdir;
582 if (fs::exists(include_path)) {
583 includes.push_back(include_path.string());
584 }
585 }
586 }
587
588 if (includes.empty()) {
589 includes = probe_sdk_paths("Include",
590 std::vector<std::string> { "ucrt", "shared", "um", "winrt", "cppwinrt" });
591 }
592
593 return includes;
594}
595
596inline std::vector<std::string> SystemConfig::get_windows_sdk_libraries()
597{
598 std::vector<std::string> lib_paths;
599
600 std::string sdk_dir = safe_getenv("WindowsSdkDir");
601 std::string sdk_ver = safe_getenv("WindowsSDKVersion");
602
603 if (!sdk_dir.empty() && !sdk_ver.empty() && fs::exists(sdk_dir)) {
604 fs::path base = fs::path(sdk_dir);
605 std::string version = std::string(sdk_ver);
606 if (!version.empty() && version.back() == '\\') {
607 version.pop_back();
608 }
609
610 std::vector<std::string> subdirs = { "ucrt", "um" };
611 for (const auto& subdir : subdirs) {
612 fs::path lib_path = base / "Lib" / version / subdir / "x64";
613 if (fs::exists(lib_path)) {
614 lib_paths.push_back(lib_path.string());
615 }
616 }
617 }
618
619 if (lib_paths.empty()) {
620 lib_paths = probe_sdk_paths("Lib",
621 std::vector<std::string> { "ucrt", "um" }, "x64");
622 }
623
624 return lib_paths;
625}
626
627inline std::vector<std::string> SystemConfig::probe_sdk_paths(const std::string& subpath,
628 const std::vector<std::string>& subdirs,
629 const std::string& arch)
630{
631 std::vector<std::string> paths;
632 for (const auto& base_path : platform_candidates().windows_kits_roots) {
633 if (fs::exists(base_path)) {
634 fs::path search_dir = fs::path(base_path) / subpath;
635 std::string version = find_latest_sdk_version(search_dir);
636
637 if (!version.empty()) {
638 for (const auto& subdir : subdirs) {
639 fs::path final_path = fs::path(base_path) / subpath / version / subdir;
640 if (!arch.empty()) {
641 final_path = final_path / arch;
642 }
643 if (fs::exists(final_path)) {
644 paths.push_back(final_path.string());
645 }
646 }
647 break;
648 }
649 }
650 }
651
652 return paths;
653}
654
655#else
656
657inline std::vector<std::string> SystemConfig::get_unix_library_paths()
658{
659 std::vector<std::string> lib_paths;
660
661 std::string ld_library_path = safe_getenv("LD_LIBRARY_PATH");
662 if (!ld_library_path.empty()) {
663 std::istringstream stream(ld_library_path);
664 std::string path;
665 while (std::getline(stream, path, ':')) {
666 if (!path.empty() && fs::exists(path)) {
667 lib_paths.push_back(path);
668 }
669 }
670 }
671
672#if defined(MAYAFLUX_PLATFORM_MACOS)
673 if (const auto prefix = homebrew_prefix(); prefix && fs::exists(*prefix / "lib")) {
674 lib_paths.push_back((*prefix / "lib").string());
675 }
676#endif
677
678 for (const auto& path : platform_candidates().library_dirs) {
679 if (fs::exists(path)) {
680 lib_paths.push_back(path);
681 }
682 }
683
684 return lib_paths;
685}
686
687#ifdef MAYAFLUX_PLATFORM_MACOS
688
689inline std::string SystemConfig::get_macos_sdk_path()
690{
691 const char* cmd = "xcrun --show-sdk-path 2>/dev/null";
692 std::string sdk_path = exec_command(cmd);
693 trim_output(sdk_path);
694
695 if (!sdk_path.empty() && fs::exists(sdk_path)) {
696 return sdk_path;
697 }
698
699 for (const auto& path : platform_candidates().macos_sdk_paths) {
700 if (fs::exists(path)) {
701 return path;
702 }
703 }
704
705 return "";
706}
707
708inline std::string SystemConfig::get_xcode_system_includes()
709{
710 std::string sdk_path = get_macos_sdk_path();
711 if (sdk_path.empty()) {
712 return "";
713 }
714
715 std::string include_path = sdk_path + "/usr/include";
716 if (fs::exists(include_path)) {
717 return include_path;
718 }
719
720 return "";
721}
722
723#endif // MAYAFLUX_PLATFORM_MACOS
724
725#endif // MAYAFLUX_PLATFORM_WINDOWS
726
727} // namespace MayaFlux::Platform
bool insert_or_assign(const K &key, V value)
Sets the value for key, adding the entry if it is absent.
Definition FlatMap.hpp:44
Map kept as one sorted vector, cheap to copy.
Definition FlatMap.hpp:21
Guard read() const noexcept
Pins the current snapshot.
void publish(T value)
Replaces the snapshot with value, whatever it was.
bool update(Edit edit)
Edits a copy of the current snapshot and publishes it.
Lock-free cell holding one immutable snapshot of a value, read without blocking.
static std::string resolve_dependency_include(const DependencyHint &hint)
static std::vector< std::string > get_unix_library_paths()
static std::string find_latest_sdk_version(const fs::path &base)
static std::string get_clang_resource_dir()
The clang resource directory, from clang -print-resource-dir, or empty.
static std::vector< std::string > parse_clang_search_paths(const std::string &output)
static std::string find_dep_library(const std::string &library_name, const std::string &prefix="")
The absolute path of a shared library, or empty.
static std::string get_dep_includes(const std::string &library_name)
The include directory of a named dependency, or empty.
static std::vector< std::string > get_clang_includes()
static std::vector< std::string > get_system_libraries()
The existing system library directories, in search order.
static std::vector< std::string > get_system_includes()
The system include directories, in search order.
Host toolchain and dependency discovery.
T memoize_nonempty(Memory::SnapshotCell< T > &cell, Compute &&compute)
bool path_is_directory(const std::filesystem::path &path)
const DependencyHint * find_dependency_hint(std::string_view name)
std::vector< std::string > dependency_fallbacks(std::string_view leaf)
Definition Toolchain.hpp:76
std::expected< T, AcquireFailure > Acquired
const std::vector< DependencyHint > & dependency_hints()
Definition Toolchain.hpp:99
void trim_output(std::string &str)
Definition Process.hpp:52
std::string safe_getenv(const char *var)
Definition Process.hpp:11
Acquired< LibraryLocation > acquire_library(const LibrarySource &source)
Resolve a library request to a location the loader can open.
const PlatformCandidates & platform_candidates()
Definition Toolchain.hpp:48
std::string exec_command(const char *cmd)
Definition Process.hpp:31
Why an acquisition request was refused, with every path that was checked.
std::vector< std::string > fallback_paths
Definition Toolchain.hpp:93
std::vector< std::string_view > aliases
Definition Toolchain.hpp:94
std::vector< std::string_view > system_include_suffixes
Definition Toolchain.hpp:96
A shared library given by name, searched directly inside each of several directories.
A shared library given by name, searched under one prefix.
std::vector< std::string > vswhere_paths
Definition Toolchain.hpp:43
std::vector< std::string > library_dirs
Definition Toolchain.hpp:41
std::vector< std::string > windows_kits_roots
Definition Toolchain.hpp:44
std::vector< std::string > macos_sdk_paths
Definition Toolchain.hpp:45
std::vector< std::string > include_dirs
Definition Toolchain.hpp:42