blob: 83af88d6cdbb1a81adccff7739e18eab5b487c7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
* minicargo - MRustC-specific clone of `cargo`
* - By John Hodge (Mutabah)
*
* build.h
* - Definitions relating to building the crate (and dependencies)
*/
#pragma once
#include "manifest.h"
#include <path.h>
class StringList;
class StringListKV;
class Timestamp;
struct BuildOptions
{
::helpers::path output_dir;
::helpers::path build_script_overrides;
::std::vector<::helpers::path> lib_search_dirs;
bool emit_mmir = false;
const char* target_name = nullptr; // if null, host is used
enum class Mode {
/// Build the binary/library
Normal,
/// Build tests
Test,
/// Build examples
Examples,
} mode = Mode::Normal;
};
class BuildList
{
struct Entry
{
const PackageManifest* package;
bool is_host;
::std::vector<unsigned> dependents; // Indexes into the list
};
const PackageManifest& m_root_manifest;
// List is sorted by build order
::std::vector<Entry> m_list;
public:
BuildList(const PackageManifest& manifest, const BuildOptions& opts);
bool build(BuildOptions opts, unsigned num_jobs); // 0 = 1 job
};
|