summaryrefslogtreecommitdiff
path: root/src/mongo/embedded/mongo_embedded/SConscript
blob: c4e737e995e805052918abd06fd5749003fff277 (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
# -*- mode: python; -*-

from functools import partial
import libdeps_tool as libdeps

Import("env")
Import("get_option")

env = env.Clone()

env.AutoInstall(
    '$PREFIX_DOCDIR/mongo_embedded',
    source=[
        '#/LICENSE-Community.txt',
        '../LICENSE-Embedded.txt',
    ],
    AIB_COMPONENT='embedded',
    AIB_ROLE='base',
)

mongoEmbeddedEnv = env.Clone()
mongoEmbeddedEnv.AppendUnique(CPPDEFINES=[
    'MONGO_EMBEDDED_COMPILING',
], )

if get_option('link-model') == 'static':
    mongoEmbeddedEnv.AppendUnique(CPPDEFINES=[
        'MONGO_EMBEDDED_STATIC',
    ], )
elif get_option('link-model') == 'dynamic-sdk':
    # TODO(SERVER-59134): This fails to honor the libdeps-debug flag
    mongoEmbeddedEnv['LIBDEPS_SHLIBEMITTER'] = partial(
        libdeps.libdeps_emitter,
        builder='SharedArchive',
        visibility_map=libdeps.dependency_visibility_honored,
    )

mongoEmbeddedEnv.AppendUnique(SHLINKFLAGS=[
    '$MONGO_EXPORT_FILE_SHLINKFLAGS',
], )

if mongoEmbeddedEnv.TargetOSIs('darwin'):
    # The current version and compatibility are the *minor* ABI
    # version metadata. If you extend (but do not break) the ABI, you
    # should increment current_version but leave compatibiity_version
    # at 1. If you break ABI, you should bump the entire library from
    # v1 to v2, in which case you would then reset both
    # current_version and compatibility_version to 1. You should never
    # need to set compatibility_version to anything but 1.
    mongoEmbeddedEnv.AppendUnique(
        SHLINKFLAGS=[
            '-Wl,-current_version,1',
            '-Wl,-compatibility_version,1',
        ], )

mongoEmbeddedTargets = mongoEmbeddedEnv.Library(
    target='mongo_embedded',
    source=[
        'mongo_embedded.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/embedded/embedded',
        '$BUILD_DIR/mongo/rpc/message',
        '$BUILD_DIR/mongo/transport/transport_layer_mock',
    ],
    AIB_COMPONENT='embedded',
)

env.AutoInstall(
    '$PREFIX_INCLUDEDIR/mongo_embedded/v1/mongo_embedded',
    source=['mongo_embedded.h'],
    AIB_COMPONENT='embedded',
    AIB_ROLE='dev',
)

yamlEnv = env.Clone()
yamlEnv.InjectThirdParty(libraries=['yaml'])

if get_option('link-model') != 'dynamic-sdk':
    mongoEmbeddedTest = yamlEnv.CppUnitTest(
        target='mongo_embedded_test',
        source=[
            'mongo_embedded_test.cpp',
            'mongo_embedded_test.idl',
        ],
        LIBDEPS=[
            '$BUILD_DIR/mongo/base',
            '$BUILD_DIR/mongo/bson/bson_validate',
            '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
            '$BUILD_DIR/mongo/db/server_base',
            '$BUILD_DIR/mongo/rpc/message',
            '$BUILD_DIR/mongo/unittest/unittest',
            '$BUILD_DIR/mongo/util/net/network',
            '$BUILD_DIR/mongo/util/options_parser/options_parser',
            'mongo_embedded',
        ],
        UNITTEST_HAS_CUSTOM_MAINLINE=True,
        AIB_COMPONENT='embedded-test',
    )