summaryrefslogtreecommitdiff
path: root/src/mongo/scripting/SConscript
blob: 42972531d6f9882545d505750381d845bafc3715 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# -*- mode: python -*-

import libdeps

Import([
    'env',
    'get_option',
    'serverJs',
    'usemozjs',
])

env.Library(
    target='scripting_common',
    source=[
        'deadline_monitor.cpp',
        'dbdirectclient_factory.cpp',
        'engine.cpp',
        'utils.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/client/clientdriver',
        '$BUILD_DIR/mongo/shell/mongojs',
        '$BUILD_DIR/mongo/util/md5',
    ],
)

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

env.CppUnitTest(
    target='bson_template_evaluator_test',
    source=[
        'bson_template_evaluator_test.cpp',
    ],
    LIBDEPS=[
        'bson_template_evaluator',
    ],
)

env.Library(
    target='scripting_none',
    source=[
        'engine_none.cpp',
    ],
    LIBDEPS=[
        'bson_template_evaluator',
        'scripting_common',
    ],
)

if usemozjs:
    scriptingEnv = env.Clone()
    scriptingEnv.InjectThirdPartyIncludePaths(libraries=['mozjs'])

    # TODO: get rid of all of this /FI and -include stuff and migrate to a shim
    # header we include in all of our files.
    if env.TargetOSIs('windows'):
        scriptingEnv.Append(CCFLAGS=[
            '/FI', 'js-config.h',
            '/FI', 'js/RequiredDefines.h',
        ])
    else:
        scriptingEnv.Append(
            CCFLAGS=[
                '-include', 'js-config.h',
                '-include', 'js/RequiredDefines.h',
                '-Wno-invalid-offsetof',
            ],
            CXXFLAGS=[
                '-Wno-non-virtual-dtor',
            ],
        )

    scriptingEnv.Prepend(CPPDEFINES=[
        'JS_USE_CUSTOM_ALLOCATOR',
        'STATIC_JS_API=1',
    ])

    if get_option('spider-monkey-dbg') == "on":
        scriptingEnv.Prepend(CPPDEFINES=[
            'DEBUG',
            'JS_DEBUG',
        ])

    scriptingEnv.JSHeader(
        target='mozjs/mongohelpers_js.cpp',
        source=[
            'mozjs/mongohelpers.js'
        ]
    )

    env.Alias('generated-sources', 'mozjs/mongohelpers_js.cpp')

    scriptingEnv.Library(
        target='scripting',
        source=[
            'mozjs/base.cpp',
            'mozjs/bindata.cpp',
            'mozjs/bson.cpp',
            'mozjs/code.cpp',
            'mozjs/countdownlatch.cpp',
            'mozjs/cursor.cpp',
            'mozjs/cursor_handle.cpp',
            'mozjs/db.cpp',
            'mozjs/dbcollection.cpp',
            'mozjs/dbpointer.cpp',
            'mozjs/dbquery.cpp',
            'mozjs/dbref.cpp',
            'mozjs/engine.cpp',
            'mozjs/error.cpp',
            'mozjs/exception.cpp',
            'mozjs/global.cpp',
            'mozjs/idwrapper.cpp',
            'mozjs/implscope.cpp',
            'mozjs/internedstring.cpp',
            'mozjs/jscustomallocator.cpp',
            'mozjs/jsstringwrapper.cpp',
            'mozjs/jsthread.cpp',
            'mozjs/maxkey.cpp',
            'mozjs/minkey.cpp',
            'mozjs/mongo.cpp',
            'mozjs/mongohelpers.cpp',
            'mozjs/mongohelpers_js.cpp',
            'mozjs/nativefunction.cpp',
            'mozjs/numberdecimal.cpp',
            'mozjs/numberint.cpp',
            'mozjs/numberlong.cpp',
            'mozjs/object.cpp',
            'mozjs/objectwrapper.cpp',
            'mozjs/oid.cpp',
            'mozjs/PosixNSPR.cpp',
            'mozjs/proxyscope.cpp',
            'mozjs/regexp.cpp',
            'mozjs/timestamp.cpp',
            'mozjs/uri.cpp',
            'mozjs/valuereader.cpp',
            'mozjs/valuewriter.cpp',
        ],
        LIBDEPS=[
            'bson_template_evaluator',
            'scripting_common',
            ('$BUILD_DIR/third_party/shim_mozjs', libdeps.dependency.Private),
            '$BUILD_DIR/mongo/shell/mongojs',
            '$BUILD_DIR/mongo/db/service_context',
        ],
    )
else:
    env.Library(
        target='scripting',
        source=[
        ],
        LIBDEPS=[
            'scripting_none',
        ],
    )

env.Library(
    target='scripting_server',
    source=[
        'scripting_server.cpp',
    ],
    LIBDEPS=[
        'scripting' if serverJs else 'scripting_none',
    ],
)

env.CppUnitTest(
    target='deadline_monitor_test',
    source=[
        'deadline_monitor_test.cpp',
    ],
    LIBDEPS=[
        'scripting_common',
    ],
)