Skip to content

Commit 6b9931d

Browse files
committed
SERVER-18569 Standalone ASIO build system integration
1 parent 3dc2084 commit 6b9931d

File tree

5 files changed

+41
-0
lines changed

5 files changed

+41
-0
lines changed

SConstruct

+2
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ add_option( "use-system-stemmer", "use system version of stemmer", 0, True )
291291

292292
add_option( "use-system-yaml", "use system version of yaml", 0, True )
293293

294+
add_option( "use-system-asio", "use system version of ASIO", 0, True )
295+
294296
add_option( "use-system-all" , "use all system libraries", 0 , True )
295297

296298
# deprecated

src/third_party/SConscript

+23
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ if not use_system_version_of_library('yaml'):
5151
thirdPartyIncludePathList.append(
5252
('yaml', '#/src/third_party/yaml-cpp-0.5.1/include'))
5353

54+
if not use_system_version_of_library('asio'):
55+
thirdPartyIncludePathList.append(
56+
('asio', '#/src/third_party/asio-asio-1-11-0/asio/include'))
57+
5458
def injectAllThirdPartyIncludePaths(thisEnv):
5559
thisEnv.AppendUnique(CPPPATH=[entry[1] for entry in thirdPartyIncludePathList])
5660

@@ -295,3 +299,22 @@ if wiredtiger:
295299
'shim_wiredtiger.cpp'
296300
])
297301

302+
if use_system_version_of_library("asio"):
303+
asioEnv = env.Clone(
304+
SYSLIBDEPS=[
305+
env['LIBDEPS_ASIO_SYSLIBDEP'],
306+
])
307+
else:
308+
asioEnv = env.Clone()
309+
asioEnv.InjectThirdPartyIncludePaths(libraries=['asio'])
310+
asioEnv.SConscript('asio-asio-1-11-0/SConscript', exports={ 'env' : asioEnv })
311+
asioEnv = asioEnv.Clone(
312+
LIBDEPS=[
313+
'asio-asio-1-11-0/asio',
314+
])
315+
316+
asioEnv.Library(
317+
target="shim_asio",
318+
source=[
319+
'shim_asio.cpp'
320+
])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Import("env")
2+
3+
env.Library(
4+
target="asio",
5+
source=[
6+
"asio/src/asio.cpp",
7+
]
8+
)

src/third_party/asio-asio-1-11-0/asio/include/asio/detail/config.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
#ifndef ASIO_DETAIL_CONFIG_HPP
1212
#define ASIO_DETAIL_CONFIG_HPP
1313

14+
// MongoDB modification. We want this standalone, and we want separate
15+
// compilation for what we can to cut down on compile times.
16+
# define ASIO_STANDALONE // MongoDB
17+
# define ASIO_SEPARATE_COMPILATION // MongoDB
18+
1419
#if defined(ASIO_STANDALONE)
1520
# define ASIO_DISABLE_BOOST_ARRAY 1
1621
# define ASIO_DISABLE_BOOST_ASSERT 1

src/third_party/shim_asio.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This file intentionally blank. shim_asio.cpp is part of the
2+
// third_party/asio library, which is just a placeholder for forwarding
3+
// library dependencies.

0 commit comments

Comments
 (0)