Use gnu gold or clang lld linkers if available

This commit is contained in:
seelabs
2017-02-28 08:36:54 -05:00
parent 1e438f51c5
commit bb61b398a6
3 changed files with 32 additions and 4 deletions

View File

@@ -509,6 +509,15 @@ macro(setup_build_boilerplate)
if (is_gcc)
add_compile_options(-Wno-unused-but-set-variable -Wno-deprecated)
# use gold linker if available
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if ("${LD_VERSION}" MATCHES "GNU gold")
append_flags(CMAKE_EXE_LINKER_FLAGS -fuse-ld=gold)
endif ()
unset(LD_VERSION)
endif()
# Generator expressions are not supported in add_definitions, use set_property instead
@@ -551,6 +560,15 @@ macro(setup_build_boilerplate)
add_compile_options(
-Wno-redeclared-class-member -Wno-mismatched-tags -Wno-deprecated-register)
add_definitions(-DBOOST_ASIO_HAS_STD_ARRAY)
# use ldd linker if available
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if ("${LD_VERSION}" MATCHES "LLD")
append_flags(CMAKE_EXE_LINKER_FLAGS -fuse-ld=lld)
endif ()
unset(LD_VERSION)
endif()
if (APPLE)

View File

@@ -552,6 +552,13 @@ def config_env(toolchain, variant, env):
if toolchain == 'clang':
env.Append(CCFLAGS=['-Wno-redeclared-class-member'])
env.Append(CPPDEFINES=['BOOST_ASIO_HAS_STD_ARRAY'])
try:
ldd_ver = subprocess.check_output([env['CLANG_CXX'], '-fuse-ld=lld', '-Wl,--version'],
stderr=subprocess.STDOUT).strip()
# have lld
env.Append(LINKFLAGS=['-fuse-ld=lld'])
except:
pass
env.Append(CXXFLAGS=[
'-frtti',
@@ -583,11 +590,17 @@ def config_env(toolchain, variant, env):
'-D_GLIBCXX_USE_CXX11_ABI' : 0
})
if toolchain == 'gcc':
env.Append(CCFLAGS=[
'-Wno-unused-but-set-variable',
'-Wno-deprecated',
])
try:
ldd_ver = subprocess.check_output([env['GNU_CXX'], '-fuse-ld=gold', '-Wl,--version'],
stderr=subprocess.STDOUT).strip()
# have ld.gold
env.Append(LINKFLAGS=['-fuse-ld=gold'])
except:
pass
boost_libs = [
# resist the temptation to alphabetize these. coroutine

View File

@@ -498,9 +498,6 @@ isDirectXrpToXrp<XRPAmount, XRPAmount> (Strand const& strand)
return (strand.size () == 2);
}
template
bool
isDirectXrpToXrp<XRPAmount, XRPAmount> (Strand const& strand);
template
bool
isDirectXrpToXrp<XRPAmount, IOUAmount> (Strand const& strand);