This commit is contained in:
parent
52c4eed8c6
commit
bc9ceb8f24
3 changed files with 50 additions and 28 deletions
|
|
@ -87,13 +87,20 @@ export namespace Crafter {
|
|||
std::string output;
|
||||
};
|
||||
|
||||
// The host target triple, detected once per process by running
|
||||
// `clang++ -print-target-triple` and cached. Used as the default for
|
||||
// Configuration::target so projects don't have to hardcode it for the
|
||||
// no-cross-compile case. Returns "" if clang isn't on PATH or doesn't
|
||||
// print a triple — those projects still need an explicit cfg.target.
|
||||
CRAFTER_API std::string HostTarget();
|
||||
|
||||
struct Configuration {
|
||||
fs::path path;
|
||||
std::string outputName;
|
||||
std::string name;
|
||||
std::string march = "native";
|
||||
std::string mtune = "native";
|
||||
std::string target;
|
||||
std::string target = HostTarget();
|
||||
std::string sysroot;
|
||||
bool debug = false;
|
||||
ConfigurationType type = ConfigurationType::Executable;
|
||||
|
|
@ -135,4 +142,15 @@ export namespace Crafter {
|
|||
// outputName is set; index.html is generated against the current
|
||||
// outputName so renaming the binary later requires another call.
|
||||
CRAFTER_API void EnableWasiBrowserRuntime(Configuration& cfg);
|
||||
|
||||
// Apply the framework's standard CLI args + env vars onto cfg:
|
||||
// --debug cfg.debug = true
|
||||
// --target=<triple> cfg.target = <triple>
|
||||
// --march=<value> cfg.march = <value>
|
||||
// --mtune=<value> cfg.mtune = <value>
|
||||
// $CRAFTER_BUILD_MARCH / $CRAFTER_BUILD_MTUNE seed march/mtune.
|
||||
// Env applies first, then args, so CLI wins over env wins over caller's
|
||||
// pre-set defaults. Project-specific flags (e.g. --shared, --timing) are
|
||||
// not handled here — parse them in your own loop alongside this call.
|
||||
CRAFTER_API void ApplyStandardArgs(Configuration& cfg, std::span<const std::string_view> args);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue