mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
Changes to make rippled compile on OSX
This commit is contained in:
committed by
Vinnie Falco
parent
8950fcd47b
commit
8042ec4e60
95
SConstruct
95
SConstruct
@@ -14,6 +14,12 @@ FreeBSD = bool('FreeBSD' == platform.system())
|
|||||||
Linux = bool('Linux' == platform.system())
|
Linux = bool('Linux' == platform.system())
|
||||||
Ubuntu = bool(Linux and 'Ubuntu' == platform.linux_distribution()[0])
|
Ubuntu = bool(Linux and 'Ubuntu' == platform.linux_distribution()[0])
|
||||||
|
|
||||||
|
#
|
||||||
|
# We expect this to be set
|
||||||
|
#
|
||||||
|
BOOST_HOME = os.environ.get("RIPPLED_BOOST_HOME", None)
|
||||||
|
|
||||||
|
|
||||||
if OSX or Ubuntu:
|
if OSX or Ubuntu:
|
||||||
CTAGS = 'ctags'
|
CTAGS = 'ctags'
|
||||||
elif FreeBSD:
|
elif FreeBSD:
|
||||||
@@ -31,9 +37,6 @@ env = Environment(
|
|||||||
|
|
||||||
GCC_VERSION = re.split('\.', commands.getoutput(env['CXX'] + ' -dumpversion'))
|
GCC_VERSION = re.split('\.', commands.getoutput(env['CXX'] + ' -dumpversion'))
|
||||||
|
|
||||||
# Use clang
|
|
||||||
#env.Replace(CC = 'clang')
|
|
||||||
#env.Replace(CXX = 'clang++')
|
|
||||||
|
|
||||||
# Use a newer gcc on FreeBSD
|
# Use a newer gcc on FreeBSD
|
||||||
if FreeBSD:
|
if FreeBSD:
|
||||||
@@ -42,6 +45,13 @@ if FreeBSD:
|
|||||||
env.Append(CCFLAGS = ['-Wl,-rpath=/usr/local/lib/gcc46'])
|
env.Append(CCFLAGS = ['-Wl,-rpath=/usr/local/lib/gcc46'])
|
||||||
env.Append(LINKFLAGS = ['-Wl,-rpath=/usr/local/lib/gcc46'])
|
env.Append(LINKFLAGS = ['-Wl,-rpath=/usr/local/lib/gcc46'])
|
||||||
|
|
||||||
|
if OSX:
|
||||||
|
env.Replace(CC= 'clang')
|
||||||
|
env.Replace(CXX= 'clang++')
|
||||||
|
env.Append(CXXFLAGS = ['-std=c++11', '-stdlib=libc++'])
|
||||||
|
env.Append(LINKFLAGS='-stdlib=libc++')
|
||||||
|
env['FRAMEWORKS'] = ['AppKit']
|
||||||
|
|
||||||
#
|
#
|
||||||
# Builder for CTags
|
# Builder for CTags
|
||||||
#
|
#
|
||||||
@@ -66,16 +76,7 @@ if FreeBSD:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# The required version of boost is documented in the README file.
|
# The required version of boost is documented in the README file.
|
||||||
#
|
BOOST_LIBS = [
|
||||||
# We whitelist platforms where the non -mt version is linked with pthreads.
|
|
||||||
# This can be verified with: ldd libboost_filesystem.*
|
|
||||||
# If a threading library is included the platform can be whitelisted.
|
|
||||||
#
|
|
||||||
# FreeBSD and Ubuntu non-mt libs do link with pthreads.
|
|
||||||
|
|
||||||
if FreeBSD or Ubuntu:
|
|
||||||
env.Append(
|
|
||||||
LIBS = [
|
|
||||||
'boost_date_time',
|
'boost_date_time',
|
||||||
'boost_filesystem',
|
'boost_filesystem',
|
||||||
'boost_program_options',
|
'boost_program_options',
|
||||||
@@ -83,19 +84,19 @@ if FreeBSD or Ubuntu:
|
|||||||
'boost_system',
|
'boost_system',
|
||||||
'boost_thread',
|
'boost_thread',
|
||||||
'boost_random',
|
'boost_random',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# We whitelist platforms where the non -mt version is linked with pthreads. This
|
||||||
|
# can be verified with: ldd libboost_filesystem.* If a threading library is
|
||||||
|
# included the platform can be whitelisted.
|
||||||
|
if FreeBSD or Ubuntu or OSX:
|
||||||
|
# non-mt libs do link with pthreads.
|
||||||
|
env.Append(
|
||||||
|
LIBS = BOOST_LIBS
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
env.Append(
|
env.Append(
|
||||||
LIBS = [
|
LIBS = [l + '-mt' for l in BOOST_LIBS]
|
||||||
'boost_date_time-mt',
|
|
||||||
'boost_filesystem-mt',
|
|
||||||
'boost_program_options-mt',
|
|
||||||
'boost_regex-mt',
|
|
||||||
'boost_system-mt',
|
|
||||||
'boost_thread-mt',
|
|
||||||
'boost_random-mt',
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
@@ -114,13 +115,23 @@ INCLUDE_PATHS = [
|
|||||||
'Subtrees/leveldb',
|
'Subtrees/leveldb',
|
||||||
'Subtrees/leveldb/port',
|
'Subtrees/leveldb/port',
|
||||||
'Subtrees/leveldb/include',
|
'Subtrees/leveldb/include',
|
||||||
'Subtrees/beast'
|
'Subtrees/beast',
|
||||||
]
|
]
|
||||||
|
|
||||||
COMPILED_FILES = [
|
# if BOOST_HOME:
|
||||||
'Subtrees/beast/modules/beast_asio/beast_asio.cpp',
|
# INCLUDE_PATHS.append(BOOST_HOME)
|
||||||
|
|
||||||
|
if OSX:
|
||||||
|
COMPILED_FILES = [
|
||||||
|
'Subtrees/beast/modules/beast_core/beast_core.mm'
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
COMPILED_FILES = [
|
||||||
|
'Subtrees/beast/modules/beast_core/beast_core.cpp'
|
||||||
|
]
|
||||||
|
|
||||||
|
COMPILED_FILES.extend([
|
||||||
'Subtrees/beast/modules/beast_basics/beast_basics.cpp',
|
'Subtrees/beast/modules/beast_basics/beast_basics.cpp',
|
||||||
'Subtrees/beast/modules/beast_core/beast_core.cpp',
|
|
||||||
'Subtrees/beast/modules/beast_crypto/beast_crypto.cpp',
|
'Subtrees/beast/modules/beast_crypto/beast_crypto.cpp',
|
||||||
'Subtrees/beast/modules/beast_db/beast_db.cpp',
|
'Subtrees/beast/modules/beast_db/beast_db.cpp',
|
||||||
'Subtrees/beast/modules/beast_sqdb/beast_sqdb.cpp',
|
'Subtrees/beast/modules/beast_sqdb/beast_sqdb.cpp',
|
||||||
@@ -133,8 +144,8 @@ COMPILED_FILES = [
|
|||||||
'modules/ripple_app/ripple_app_pt6.cpp',
|
'modules/ripple_app/ripple_app_pt6.cpp',
|
||||||
'modules/ripple_app/ripple_app_pt7.cpp',
|
'modules/ripple_app/ripple_app_pt7.cpp',
|
||||||
'modules/ripple_app/ripple_app_pt8.cpp',
|
'modules/ripple_app/ripple_app_pt8.cpp',
|
||||||
'modules/ripple_asio/ripple_asio.cpp',
|
|
||||||
'modules/ripple_basics/ripple_basics.cpp',
|
'modules/ripple_basics/ripple_basics.cpp',
|
||||||
|
'modules/ripple_basio/ripple_basio.cpp',
|
||||||
'modules/ripple_core/ripple_core.cpp',
|
'modules/ripple_core/ripple_core.cpp',
|
||||||
'modules/ripple_data/ripple_data.cpp',
|
'modules/ripple_data/ripple_data.cpp',
|
||||||
'modules/ripple_hyperleveldb/ripple_hyperleveldb.cpp',
|
'modules/ripple_hyperleveldb/ripple_hyperleveldb.cpp',
|
||||||
@@ -143,7 +154,7 @@ COMPILED_FILES = [
|
|||||||
'modules/ripple_mdb/ripple_mdb.c',
|
'modules/ripple_mdb/ripple_mdb.c',
|
||||||
'modules/ripple_net/ripple_net.cpp',
|
'modules/ripple_net/ripple_net.cpp',
|
||||||
'modules/ripple_websocket/ripple_websocket.cpp'
|
'modules/ripple_websocket/ripple_websocket.cpp'
|
||||||
]
|
])
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -161,10 +172,13 @@ VariantDir('build/obj/Subtrees', 'Subtrees', duplicate=0)
|
|||||||
for path in INCLUDE_PATHS:
|
for path in INCLUDE_PATHS:
|
||||||
env.Append (CPPPATH = [ path ])
|
env.Append (CPPPATH = [ path ])
|
||||||
|
|
||||||
|
if BOOST_HOME:
|
||||||
|
env.Prepend (CPPPATH = [ BOOST_HOME ])
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Apparently, only linux uses -ldl
|
# Apparently, only linux uses -ldl
|
||||||
if not FreeBSD:
|
if Linux: # not FreeBSD:
|
||||||
env.Append(
|
env.Append(
|
||||||
LIBS = [
|
LIBS = [
|
||||||
'dl', # dynamic linking for linux
|
'dl', # dynamic linking for linux
|
||||||
@@ -172,18 +186,31 @@ if not FreeBSD:
|
|||||||
)
|
)
|
||||||
|
|
||||||
env.Append(
|
env.Append(
|
||||||
LIBS = [
|
LIBS = \
|
||||||
'rt', # for clock_nanosleep in beast
|
# rt is for clock_nanosleep in beast
|
||||||
|
['rt'] if not OSX else [] +\
|
||||||
|
[
|
||||||
'z'
|
'z'
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# We prepend, in case there's another BOOST somewhere on the path
|
||||||
|
# such, as installed into `/usr/lib/`
|
||||||
|
if BOOST_HOME is not None:
|
||||||
|
env.Prepend(
|
||||||
|
LIBPATH = ["%s/stage/lib" % BOOST_HOME])
|
||||||
|
|
||||||
|
if not OSX:
|
||||||
|
env.Append(LINKFLAGS = [
|
||||||
|
'-rdynamic', '-pthread',
|
||||||
|
])
|
||||||
|
|
||||||
DEBUGFLAGS = ['-g', '-DDEBUG']
|
DEBUGFLAGS = ['-g', '-DDEBUG']
|
||||||
|
|
||||||
env.Append(LINKFLAGS = ['-rdynamic', '-pthread'])
|
env.Append(CCFLAGS = ['-pthread', '-Wall', '-Wno-sign-compare', '-Wno-char-subscripts']+DEBUGFLAGS)
|
||||||
env.Append(CCFLAGS = ['-pthread', '-Wall', '-Wno-sign-compare', '-Wno-char-subscripts'])
|
|
||||||
env.Append(CXXFLAGS = ['-O0', '-pthread', '-Wno-invalid-offsetof', '-Wformat']+DEBUGFLAGS)
|
env.Append(CXXFLAGS = ['-O0', '-pthread', '-Wno-invalid-offsetof', '-Wformat']+DEBUGFLAGS)
|
||||||
|
|
||||||
|
|
||||||
# RTTI is required for Beast and CountedObject.
|
# RTTI is required for Beast and CountedObject.
|
||||||
#
|
#
|
||||||
env.Append(CXXFLAGS = ['-frtti'])
|
env.Append(CXXFLAGS = ['-frtti'])
|
||||||
|
|||||||
Reference in New Issue
Block a user