VWR-24254: Add support for using ld.gold on linux.

To use ld.gold configure with:
  -DCMAKE_EXE_LINKER_FLAGS:STRING="-Wl,-use-gold".
ld.gold links the viewer on my machine in 8 seconds, as
opposed to 19 seconds with ld.bfd. Moreover, it uses a
LOT less memory during linking (about 750 MB instead of
2.5 GB!).

VWR-24254: Don't link with fontconfig on non-linux.

While we already added fontconfig in the above patch,
that code turned out to also be used by Windows and
Darwin (contrary to the comments in the code).
After looking at the history of commits and a
discussion on IRC it was decided that the original
coder (Kyle Ambroff <ambroff@lindenlab.com>) really
meant (LINUX AND VIEWER) instead of (NOT LINUX OR VIEWER).
master
Aleric Inglewood 2010-12-15 20:55:10 +01:00
parent 3f5d67bcb7
commit 86380bb177
5 changed files with 25 additions and 5 deletions

View File

@ -77,6 +77,7 @@ Aleric Inglewood
VWR-24247
VWR-24251
VWR-24252
VWR-24254
VWR-24261
SNOW-84
SNOW-477

View File

@ -6,6 +6,11 @@ set(DB_FIND_REQUIRED ON)
if (STANDALONE)
include(FindBerkeleyDB)
else (STANDALONE)
set(DB_LIBRARIES db-4.2)
if (LINUX)
# Need to add dependency pthread explicitely to support ld.gold.
set(DB_LIBRARIES db-4.2 pthread)
else (LINUX)
set(DB_LIBRARIES db-4.2)
endif (LINUX)
set(DB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)

View File

@ -13,7 +13,14 @@ set(LLCOMMON_INCLUDE_DIRS
${Boost_INCLUDE_DIRS}
)
set(LLCOMMON_LIBRARIES llcommon)
if (LINUX)
# In order to support using ld.gold on linux, we need to explicitely
# specify all libraries that llcommon uses.
# llcommon uses `clock_gettime' which is provided by librt on linux.
set(LLCOMMON_LIBRARIES llcommon rt)
else (LINUX)
set(LLCOMMON_LIBRARIES llcommon)
endif (LINUX)
add_definitions(${TCMALLOC_FLAG})

View File

@ -5,4 +5,10 @@ set(LLPLUGIN_INCLUDE_DIRS
${LIBS_OPEN_DIR}/llplugin
)
set(LLPLUGIN_LIBRARIES llplugin)
if (LINUX)
# In order to support using ld.gold on linux, we need to explicitely
# specify all libraries that llplugin uses.
set(LLPLUGIN_LIBRARIES llplugin pthread)
else (LINUX)
set(LLPLUGIN_LIBRARIES llplugin)
endif (LINUX)

View File

@ -59,12 +59,13 @@ set(viewer_HEADER_FILES
# Libraries on which this library depends, needed for Linux builds
# Sort by high-level to low-level
if (NOT LINUX OR VIEWER)
if (LINUX AND VIEWER)
set(llwindow_LINK_LIBRARIES
${UI_LIBRARIES} # for GTK
${SDL_LIBRARY}
fontconfig # For FCInit and other FC* functions.
)
endif (NOT LINUX OR VIEWER)
endif (LINUX AND VIEWER)
if (DARWIN)
list(APPEND llwindow_SOURCE_FILES