summaryrefslogtreecommitdiff
path: root/src/SConscript.client
blob: a2cfe1c58d9f6ca2b99a464299da6c17e6ae88fd (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
184
185
186
# -*- mode: python -*-

# This SConscript describes build and install rules for the Mongo C++ driver and associated exmaple
# programs.

Import('env clientEnv')

env.Command(['mongo/base/error_codes.h', 'mongo/base/error_codes.cpp',],
            ['mongo/base/generate_error_codes.py', 'mongo/base/error_codes.err'],
            '$PYTHON $SOURCES $TARGETS')

env.Command(['mongo/db/auth/action_type.h', 'mongo/db/auth/action_type.cpp'], 
            ['mongo/db/auth/generate_action_types.py', 'mongo/db/auth/action_types.txt'],
            '$PYTHON $SOURCES $TARGETS')

clientSourceBasic = [
    'mongo/base/configuration_variable_manager.cpp',
    'mongo/base/error_codes.cpp',
    'mongo/base/global_initializer.cpp',
    'mongo/base/global_initializer_registerer.cpp',
    'mongo/base/init.cpp',
    'mongo/base/initializer.cpp',
    'mongo/base/initializer_context.cpp',
    'mongo/base/initializer_dependency_graph.cpp',
    'mongo/base/make_string_vector.cpp',
    'mongo/base/parse_number.cpp',
    'mongo/base/status.cpp',
    'mongo/base/string_data.cpp',
    'mongo/bson/bson_validate.cpp',
    'mongo/bson/oid.cpp',
    'mongo/bson/util/bson_extract.cpp',
    'mongo/buildinfo.cpp',
    'mongo/client/clientAndShell.cpp',
    'mongo/client/clientOnly.cpp',
    'mongo/client/connpool.cpp',
    'mongo/client/dbclient.cpp',
    'mongo/client/dbclient_rs.cpp',
    'mongo/client/dbclientcursor.cpp',
    'mongo/client/distlock.cpp',
    'mongo/client/gridfs.cpp',
    'mongo/client/model.cpp',
    'mongo/client/sasl_client_authenticate.cpp',
    'mongo/client/syncclusterconnection.cpp',
    'mongo/db/jsobj.cpp',
    'mongo/db/json.cpp',
    'mongo/db/lasterror.cpp',
    'mongo/db/namespace.cpp',
    'mongo/db/dbmessage.cpp',
    'mongo/pch.cpp',
    'mongo/platform/random.cpp',
    'mongo/util/assert_util.cpp',
    'mongo/util/background.cpp',
    'mongo/util/base64.cpp',
    'mongo/util/concurrency/rwlockimpl.cpp',
    'mongo/util/concurrency/spin_lock.cpp',
    'mongo/util/concurrency/synchronization.cpp',
    'mongo/util/concurrency/task.cpp',
    'mongo/util/concurrency/thread_pool.cpp',
    'mongo/util/concurrency/mutexdebugger.cpp',
    'mongo/util/debug_util.cpp',
    'mongo/util/stacktrace.cpp',
    'mongo/util/file_allocator.cpp',
    'mongo/util/fail_point.cpp',
    'mongo/util/fail_point_registry.cpp',
    'mongo/util/fail_point_service.cpp',
    'mongo/util/histogram.cpp',
    'mongo/util/intrusive_counter.cpp',
    'mongo/util/log.cpp',
    'mongo/util/md5.cpp',
    'mongo/util/md5main.cpp',
    'mongo/util/net/httpclient.cpp',
    'mongo/util/net/listen.cpp',
    'mongo/util/net/message.cpp',
    'mongo/util/net/message_port.cpp',
    'mongo/util/net/sock.cpp',
    'mongo/util/net/ssl_manager.cpp',
    'mongo/util/password.cpp',
    'mongo/util/ramlog.cpp',
    'mongo/util/signal_handlers.cpp',
    'mongo/util/stringutils.cpp',
    'mongo/util/text.cpp',
    'mongo/util/time_support.cpp',
    'mongo/util/timer.cpp',
    'mongo/util/trace.cpp',
    'mongo/util/util.cpp',
    'mongo/util/version.cpp',
    'third_party/murmurhash3/MurmurHash3.cpp',
    ]

clientSourceSasl = ['mongo/client/sasl_client_authenticate_impl.cpp',
                    'mongo/client/sasl_client_session.cpp']

clientSourceAll = clientSourceBasic + clientSourceSasl

if env['MONGO_BUILD_SASL_CLIENT']:
    clientSource = clientSourceAll
else:
    clientSource = clientSourceBasic

exampleSourceMap = [
        ('authTest', 'mongo/client/examples/authTest.cpp'),
        ('clientTest', 'mongo/client/examples/clientTest.cpp'),
        ('firstExample', 'mongo/client/examples/first.cpp'),
        ('httpClientTest', 'mongo/client/examples/httpClientTest.cpp'),
        ('rsExample', 'mongo/client/examples/rs.cpp'),
        ('secondExample', 'mongo/client/examples/second.cpp'),
        ('tutorial', 'mongo/client/examples/tutorial.cpp'),
        ('whereExample', 'mongo/client/examples/whereExample.cpp'),
        ]

clientHeaderDirectories = [
    "base/",
    "bson/",
    "bson/util/",
    "client/",
    "db/",
    "db/auth/",
    "db/stats/",
    "db/repl/",
    "db/ops/",
    "platform/",
    "s/",
    "scripting/",
    "shell/",
    "util/",
    "util/concurrency/",
    "util/mongoutils/",
    "util/net/", 
    "" 
    ]

clientHeaders = []
for path in clientHeaderDirectories:
    clientHeaders.extend(Glob('mongo/%s/*.h' % path))
    clientHeaders.extend(Glob('mongo/%s/*.hpp' % path))

mongoclient_lib = env.Library('mongoclient', clientSource),
mongoclient_install = env.Install('#/', [
        mongoclient_lib,
        #env.SharedLibrary('mongoclient', clientSource),
        ])
env.Alias('mongoclient', mongoclient_install)

clientTests = clientEnv.Install('#/', [
        clientEnv.Program(target,
                          [source, mongoclient_lib]) for (target, source) in exampleSourceMap])

clientTests.append(
    clientEnv.Install('#/', clientEnv.Program('bsondemo', 'mongo/bson/bsondemo/bsondemo.cpp')))

clientEnv.Alias('clientTests', clientTests, [])

env.Install(
    '#/',
    env.Command('$CLIENT_ARCHIVE',
                ['#buildscripts/make_archive.py',
                 '$CLIENT_SCONSTRUCT',
                 '$CLIENT_LICENSE',
                 'SConscript.client',
                 'mongo/base/generate_error_codes.py',
                 'mongo/base/error_codes.err',
                 'mongo/db/auth/generate_action_types.py',
                 'mongo/db/auth/action_types.txt',
                 'third_party/murmurhash3/MurmurHash3.h',
                 '#buildscripts/make_archive.py',
                 clientSourceAll,
                 clientHeaders,
                 [source for (target, source) in exampleSourceMap],
                 'mongo/bson/bsondemo/bsondemo.cpp',
                 ],
                '${PYTHON} ${SOURCES[0]} -o $TARGET '
                '--transform ${str(Dir(BUILD_DIR))}/client_build=$CLIENT_DIST_BASENAME/src '
                '--transform ${str(Dir(BUILD_DIR))}=$CLIENT_DIST_BASENAME/src '
                '--transform distsrc/client=$CLIENT_DIST_BASENAME '
                '--transform =$CLIENT_DIST_BASENAME/ '
                '${TEMPFILE(SOURCES[1:])}'))

# install
prefix = GetOption("prefix")

env.Install(prefix + "/lib", '${LIBPREFIX}mongoclient${LIBSUFFIX}')

for x in clientHeaderDirectories:
    inst = env.Install(prefix + "/include/mongo/" + x,
                       [Glob('mongo/%s*.h' % x), Glob('mongo/%s*.hpp' % x)])
    env.AddPostAction(inst, Chmod('$TARGET', 0644))