MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Build.hpp
Go to the documentation of this file.
1#pragma once
2
4
5/**
6 * @brief The Clang resource directory a build scan uses.
7 *
8 * @p configured when it names a directory, else the output of
9 * `clang -print-resource-dir`.
10 *
11 * @return The directory, or empty when neither exists.
12 */
13[[nodiscard]] std::string resolve_resource_dir(const std::string& configured);
14
15/**
16 * @brief Writes a depfile of the form `target: dependency...` that CMake's DEPFILE reads.
17 *
18 * Paths use forward slashes. Spaces, hashes and dollar signs are escaped.
19 *
20 * @return false with @p error set when the file cannot be written.
21 */
22[[nodiscard]] bool write_depfile(const std::filesystem::path& path, const std::string& target,
23 const std::vector<std::filesystem::path>& dependencies, std::string& error);
24
25/**
26 * @brief Writes @p content when it differs, then marks @p path as modified now.
27 *
28 * A build graph compares the timestamp of an output with its inputs. An
29 * unchanged file that kept an old timestamp would be rebuilt every time its
30 * header changes.
31 *
32 * @return false with @p error set when the file cannot be written or touched.
33 */
34[[nodiscard]] bool write_generated(const std::filesystem::path& path, const std::string& content, std::string& error);
35
36/** @brief @p dependencies without files that end in a generated sidecar suffix. */
37[[nodiscard]] std::vector<std::filesystem::path> without_sidecars(std::vector<std::filesystem::path> dependencies);
38
39}
bool write_generated(const std::filesystem::path &path, const std::string &content, std::string &error)
Writes content when it differs, then marks path as modified now.
Definition Build.cpp:92
std::string resolve_resource_dir(const std::string &configured)
The Clang resource directory a build scan uses.
Definition Build.cpp:60
std::vector< std::filesystem::path > without_sidecars(std::vector< std::filesystem::path > dependencies)
dependencies without files that end in a generated sidecar suffix.
Definition Build.cpp:106
bool write_depfile(const std::filesystem::path &path, const std::string &target, const std::vector< std::filesystem::path > &dependencies, std::string &error)
Writes a depfile of the form target: dependency... that CMake's DEPFILE reads.
Definition Build.cpp:72