summaryrefslogtreecommitdiff
path: root/site_scons/mongo/build_profiles.py
blob: 96528c2b4699d605135f2bd675a6f0b3c634f115 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
"""Dictionary to store available build profiles."""
from dataclasses import dataclass
from typing import Any, List, Optional
import mongo.generators as mongo_generators


@dataclass
class BuildProfile:
    ninja: str
    variables_files: List
    allocator: str
    sanitize: Optional[str]
    link_model: str
    dbg: str
    opt: str
    ICECC: Optional[str]
    CCACHE: Optional[str]
    NINJA_PREFIX: str
    VARIANT_DIR: Any
    disable_warnings_as_errors: Optional[List]


BUILD_PROFILES = {
    # These options were the default settings before implementing build profiles.
    "default":
        BuildProfile(
            ninja="disabled",
            variables_files=[],
            allocator="auto",
            sanitize=None,
            link_model="auto",
            dbg="off",
            opt="auto",
            ICECC=None,
            CCACHE=None,
            NINJA_PREFIX="build",
            VARIANT_DIR=mongo_generators.default_variant_dir_generator,
            disable_warnings_as_errors=[],
        ),
    # This build has fast runtime speed & fast build time at the cost of debuggability.
    "fast":
        BuildProfile(
            ninja="enabled",
            variables_files=[
                './etc/scons/mongodbtoolchain_stable_clang.vars',
                './etc/scons/developer_versions.vars',
            ],
            allocator="auto",
            sanitize=None,
            link_model="dynamic",
            dbg="off",
            opt="off",
            ICECC="icecc",
            CCACHE="ccache",
            NINJA_PREFIX="fast",
            VARIANT_DIR="fast",
            disable_warnings_as_errors=[],
        ),
    # This build has fast runtime speed & debuggability at the cost of build time.
    "opt":
        BuildProfile(
            ninja="enabled",
            variables_files=[
                './etc/scons/mongodbtoolchain_stable_clang.vars',
                './etc/scons/developer_versions.vars',
            ],
            allocator="auto",
            sanitize=None,
            link_model="dynamic",
            dbg="off",
            opt="on",
            ICECC="icecc",
            CCACHE="ccache",
            NINJA_PREFIX="opt",
            VARIANT_DIR="opt",
            disable_warnings_as_errors=[],
        ),
    # This build leverages santizers & is the suggested build profile to use for development.
    "san":
        BuildProfile(
            ninja="enabled",
            variables_files=[
                './etc/scons/mongodbtoolchain_stable_clang.vars',
                './etc/scons/developer_versions.vars',
            ],
            allocator="system",
            sanitize="undefined,address",
            link_model="dynamic",
            dbg="on",
            opt="debug",
            ICECC="icecc",
            CCACHE="ccache",
            NINJA_PREFIX="san",
            VARIANT_DIR="san",
            disable_warnings_as_errors=[],
        ),

    #These options are the preferred settings for compiledb to generating compile_commands.json
    "compiledb":
        BuildProfile(
            ninja="disabled",
            variables_files=[
                './etc/scons/mongodbtoolchain_stable_clang.vars',
                './etc/scons/developer_versions.vars',
            ],
            allocator="auto",
            sanitize=None,
            link_model="dynamic",
            dbg="on",
            opt="off",
            ICECC=None,
            CCACHE=None,
            NINJA_PREFIX="build",
            VARIANT_DIR=mongo_generators.default_variant_dir_generator,
            disable_warnings_as_errors=['source'],
        ),
}