[PATCH 2/6] Link with lz4

Eugene Velesevich evel at ispras.ru
Fri May 31 12:41:06 PDT 2013


This patch adds COMPRESSION_LIBRARIES cmake variable for handy linking with
all three compression libraries (zlib, snappy, lz4)
---
 CMakeLists.txt          |   10 +++++++++-
 cli/CMakeLists.txt      |    3 +--
 gui/CMakeLists.txt      |    3 +--
 retrace/CMakeLists.txt  |    3 +--
 wrappers/CMakeLists.txt |   27 +++++++++------------------
 5 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index db03031..0d92ef3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -225,7 +225,7 @@ set (WRAPPER_INSTALL_DIR ${LIB_ARCH_INSTALL_DIR}/wrappers)
 ##############################################################################
 # Bundled dependencies
 #
-# We always use the bundled zlib, libpng, and snappy sources:
+# We always use the bundled zlib, libpng, lz4 and snappy sources:
 # - on Windows to make it easy to deploy the wrappers DLLs
 # - on unices to prevent symbol collisions when tracing applications that link
 # against other versions of these libraries
@@ -242,6 +242,14 @@ add_subdirectory (thirdparty/snappy)
 
 include_directories (${SNAPPY_INCLUDE_DIRS})
 
+set (LZ4_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/lz4)
+set (LZ4_LIBRARIES lz4_bundled)
+add_subdirectory (thirdparty/lz4)
+
+include_directories (${LZ4_INCLUDE_DIRS})
+
+set (COMPRESSION_LIBRARIES ${LZ4_LIBRARIES} ${ZLIB_LIBRARIES} ${SNAPPY_LIBRARIES})
+
 set (PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng)
 set (PNG_DEFINITIONS "")
 set (PNG_LIBRARIES png_bundled)
diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
index 713222f..f68b3cf 100644
--- a/cli/CMakeLists.txt
+++ b/cli/CMakeLists.txt
@@ -28,8 +28,7 @@ add_executable (apitrace
 
 target_link_libraries (apitrace
     common
-    ${ZLIB_LIBRARIES}
-    ${SNAPPY_LIBRARIES}
+    ${COMPRESSION_LIBRARIES}
     ${GETOPT_LIBRARIES}
 )
 
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
index 03e3d39..47e8c24 100644
--- a/gui/CMakeLists.txt
+++ b/gui/CMakeLists.txt
@@ -76,8 +76,7 @@ add_executable(qapitrace ${qapitrace_SUBSYSTEM} ${qapitrace_SRCS} ${qapitrace_UI
 target_link_libraries (qapitrace
     image
     common
-    ${ZLIB_LIBRARIES}
-    ${SNAPPY_LIBRARIES}
+    ${COMPRESSION_LIBRARIES}
     ${QJSON_LIBRARIES}
     ${QT_LIBRARIES}
     ${CMAKE_THREAD_LIBS_INIT}
diff --git a/retrace/CMakeLists.txt b/retrace/CMakeLists.txt
index 78cceae..d1d07f6 100644
--- a/retrace/CMakeLists.txt
+++ b/retrace/CMakeLists.txt
@@ -43,8 +43,7 @@ add_library (retrace_common STATIC
 target_link_libraries (retrace_common
     image
     common
-    ${ZLIB_LIBRARIES}
-    ${SNAPPY_LIBRARIES}
+    ${COMPRESSION_LIBRARIES}
     ${GETOPT_LIBRARIES}
 )
 
diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt
index 961a74c..dd3914c 100644
--- a/wrappers/CMakeLists.txt
+++ b/wrappers/CMakeLists.txt
@@ -49,8 +49,7 @@ if (WIN32)
         target_link_libraries (ddrawtrace
             common_trace
             common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
+            ${COMPRESSION_LIBRARIES}
         )
         set_target_properties (ddrawtrace PROPERTIES
             PREFIX ""
@@ -85,8 +84,7 @@ if (WIN32)
             d3dhelpers
             common_trace
             common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
+            ${COMPRESSION_LIBRARIES}
         )
         set_target_properties (d3d8trace PROPERTIES
             PREFIX ""
@@ -122,8 +120,7 @@ if (WIN32)
             d3dhelpers
             common_trace
             common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
+            ${COMPRESSION_LIBRARIES}
         )
         set_target_properties (d3d9trace PROPERTIES
             PREFIX ""
@@ -190,8 +187,7 @@ if (WIN32)
             d3dhelpers
             common_trace
             common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
+            ${COMPRESSION_LIBRARIES}
         )
         set_target_properties (dxgitrace
             PROPERTIES PREFIX ""
@@ -282,8 +278,7 @@ if (WIN32)
         target_link_libraries (d2d1trace
             common_trace
             common
-            ${ZLIB_LIBRARIES}
-            ${SNAPPY_LIBRARIES}
+            ${COMPRESSION_LIBRARIES}
         )
         set_target_properties (d2d1trace
             PROPERTIES PREFIX ""
@@ -332,8 +327,7 @@ if (WIN32)
         glproc_gl
         common_trace
         common
-        ${ZLIB_LIBRARIES}
-        ${SNAPPY_LIBRARIES}
+        ${COMPRESSION_LIBRARIES}
     )
     set_target_properties (wgltrace PROPERTIES
         PREFIX ""
@@ -376,8 +370,7 @@ elseif (APPLE)
         glproc_gl
         common_trace
         common
-        ${ZLIB_LIBRARIES}
-        ${SNAPPY_LIBRARIES}
+        ${COMPRESSION_LIBRARIES}
         ${CMAKE_THREAD_LIBS_INIT}
         dl
     )
@@ -419,8 +412,7 @@ elseif (X11_FOUND)
         glproc_gl
         common_trace
         common
-        ${ZLIB_LIBRARIES}
-        ${SNAPPY_LIBRARIES}
+        ${COMPRESSION_LIBRARIES}
         ${LIBBACKTRACE_LIBRARIES}
         ${CMAKE_THREAD_LIBS_INIT}
         dl
@@ -469,8 +461,7 @@ if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE)
         glproc_egl
         common_trace
         common
-        ${ZLIB_LIBRARIES}
-        ${SNAPPY_LIBRARIES}
+        ${COMPRESSION_LIBRARIES}
         ${LIBBACKTRACE_LIBRARIES}
         ${CMAKE_THREAD_LIBS_INIT}
         dl
-- 
1.7.9.5



More information about the apitrace mailing list