Skip to content
Snippets Groups Projects
Commit 86380bb1 authored by Aleric Inglewood's avatar Aleric Inglewood
Browse files

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).
parent 3f5d67bc
No related branches found
No related tags found
No related merge requests found
...@@ -77,6 +77,7 @@ Aleric Inglewood ...@@ -77,6 +77,7 @@ Aleric Inglewood
VWR-24247 VWR-24247
VWR-24251 VWR-24251
VWR-24252 VWR-24252
VWR-24254
VWR-24261 VWR-24261
SNOW-84 SNOW-84
SNOW-477 SNOW-477
......
...@@ -6,6 +6,11 @@ set(DB_FIND_REQUIRED ON) ...@@ -6,6 +6,11 @@ set(DB_FIND_REQUIRED ON)
if (STANDALONE) if (STANDALONE)
include(FindBerkeleyDB) include(FindBerkeleyDB)
else (STANDALONE) 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) set(DB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE) endif (STANDALONE)
...@@ -13,7 +13,14 @@ set(LLCOMMON_INCLUDE_DIRS ...@@ -13,7 +13,14 @@ set(LLCOMMON_INCLUDE_DIRS
${Boost_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}) add_definitions(${TCMALLOC_FLAG})
......
...@@ -5,4 +5,10 @@ set(LLPLUGIN_INCLUDE_DIRS ...@@ -5,4 +5,10 @@ set(LLPLUGIN_INCLUDE_DIRS
${LIBS_OPEN_DIR}/llplugin ${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)
...@@ -59,12 +59,13 @@ set(viewer_HEADER_FILES ...@@ -59,12 +59,13 @@ set(viewer_HEADER_FILES
# Libraries on which this library depends, needed for Linux builds # Libraries on which this library depends, needed for Linux builds
# Sort by high-level to low-level # Sort by high-level to low-level
if (NOT LINUX OR VIEWER) if (LINUX AND VIEWER)
set(llwindow_LINK_LIBRARIES set(llwindow_LINK_LIBRARIES
${UI_LIBRARIES} # for GTK ${UI_LIBRARIES} # for GTK
${SDL_LIBRARY} ${SDL_LIBRARY}
fontconfig # For FCInit and other FC* functions.
) )
endif (NOT LINUX OR VIEWER) endif (LINUX AND VIEWER)
if (DARWIN) if (DARWIN)
list(APPEND llwindow_SOURCE_FILES list(APPEND llwindow_SOURCE_FILES
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment