summaryrefslogtreecommitdiff
path: root/src/mongo/base/SConscript
blob: f71721623baae4ed824eccbbd30fd7686d1fd046 (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
# -*- mode: python -*-

Import("env")

env = env.Clone()

# This needs to use its own env to tell scons to suppress scanning the .tpl.h and .tpl.cpp inputs
# for #includes since they aren't directly preprocessed. Scons will still scan the generated files
# to produce the correct implicit dependencies when they are compiled.
env_for_error_codes = env.Clone()
env_for_error_codes['SCANNERS'] = []
generateErrorCodes = env_for_error_codes.Command(
    target=[
        'error_codes.h',
        'error_codes.cpp',
    ],
    source=[
        'generate_error_codes.py',
        'error_codes.yml',
        'error_codes.tpl.h',
        'error_codes.tpl.cpp',
    ],
    action=[
        '$PYTHON ${SOURCES[0]} ${SOURCES[1]} ${SOURCES[2]} ${TARGETS[0]}',
        '$PYTHON ${SOURCES[0]} ${SOURCES[1]} ${SOURCES[3]} ${TARGETS[1]}',
    ],
)

env.Alias('generated-sources', generateErrorCodes)

env.Library(
    target=[
        'system_error',
    ],
    source=[
        'system_error.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
)

env.Library(
    target=[
        'environment_buffer',
    ],
    source=[
        'environment_buffer.cpp',
    ],
    # Because `::environ` is resolved in `/usr/lib/crt1.o` on FreeBSD, this library
    # needs to be marked `incomplete` on FreeBSD.
    LIBDEPS_TAGS=[] if not env.TargetOSIs('freebsd') else [
        'illegal_cyclic_or_unresolved_dependencies_allowlisted',
    ],
)

env.Library(
    target=[
        'secure_allocator',
    ],
    source=[
        'secure_allocator.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/server_options_core',
        '$BUILD_DIR/mongo/util/processinfo',
        '$BUILD_DIR/mongo/util/secure_zero_memory',
    ],
)

env.CppUnitTest(
    target='base_test',
    source=[
        'clonable_ptr_test.cpp',
        'counter_test.cpp',
        'data_builder_test.cpp',
        'data_cursor_test.cpp',
        'data_range_cursor_test.cpp',
        'data_range_test.cpp',
        'data_type_string_data_test.cpp',
        'data_type_terminated_test.cpp',
        'data_type_validated_test.cpp',
        'data_view_test.cpp',
        'dependency_graph_test.cpp',
        'encoded_value_storage_test.cpp',
        'initializer_test.cpp',
        'murmurhash3_test.cpp',
        'parse_number_test.cpp',
        'secure_allocator_test.cpp',
        'status_test.cpp',
        'status_with_test.cpp',
        'string_data_test.cpp',
        'system_error_test.cpp',
        'uuid_test.cpp',
    ],
    AIB_COMPONENT='platform',
    LIBDEPS=[
        'secure_allocator',
        'system_error',
    ],
)

env.Benchmark(
    target='status_bm',
    source=[
        'status_bm.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/util/processinfo',
    ],
)