diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2016-10-17 21:04:49 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-10-18 04:00:35 +0000 |
commit | 303948500fee5f24600643638e3ed5cc5fa14132 (patch) | |
tree | ba35789f15a357782841066f76c1cf358bcf5945 /cmake | |
parent | 867f2829c1c4e1f67b14a5ace5cc9f29e971a6c9 (diff) |
CQL: add LZ4/Snappy decompression support on Windows
Change-Id: I34374cf29357e2ed5062da1a5245b9adbabf732d
Reviewed-on: https://code.wireshark.org/review/18249
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/FindLZ4.cmake | 26 | ||||
-rw-r--r-- | cmake/modules/FindSNAPPY.cmake | 26 |
2 files changed, 44 insertions, 8 deletions
diff --git a/cmake/modules/FindLZ4.cmake b/cmake/modules/FindLZ4.cmake index 5445c573ca..cbcd2b4659 100644 --- a/cmake/modules/FindLZ4.cmake +++ b/cmake/modules/FindLZ4.cmake @@ -3,15 +3,20 @@ # Find LZ4 includes and library # # LZ4_INCLUDE_DIRS - where to find lz4.h, etc. -# LZ4_LIBRARIES - List of libraries when using lz4. -# LZ4_FOUND - True if lz4 found. +# LZ4_LIBRARIES - List of libraries when using LZ4. +# LZ4_FOUND - True if LZ4 found. +# LZ4_DLL_DIR - (Windows) Path to the LZ4 DLL +# LZ4_DLL - (Windows) Name of the LZ4 DLL + +include( FindWSWinLibs ) +FindWSWinLibs( "lz4-.*" "LZ4_HINTS" ) find_package(PkgConfig) pkg_search_module(LZ4 lz4 liblz4) find_path(LZ4_INCLUDE_DIR NAMES lz4.h - HINTS "${LZ4_INCLUDEDIR}" + HINTS "${LZ4_INCLUDEDIR}" "${LZ4_HINTS}/include" PATHS /usr/local/include /usr/include @@ -19,7 +24,7 @@ find_path(LZ4_INCLUDE_DIR find_library(LZ4_LIBRARY NAMES lz4 liblz4 - HINTS "${LZ4_LIBDIR}" + HINTS "${LZ4_LIBDIR}" "${LZ4_HINTS}/lib" PATHS /usr/local/lib /usr/lib @@ -31,6 +36,19 @@ find_package_handle_standard_args( LZ4 DEFAULT_MSG LZ4_INCLUDE_DIR LZ4_LIBRARY ) if( LZ4_FOUND ) set( LZ4_INCLUDE_DIRS ${LZ4_INCLUDE_DIR} ) set( LZ4_LIBRARIES ${LZ4_LIBRARY} ) + if (WIN32) + set ( LZ4_DLL_DIR "${LZ4_HINTS}/bin" + CACHE PATH "Path to LZ4 DLL" + ) + file( GLOB _lz4_dll RELATIVE "${LZ4_DLL_DIR}" + "${LZ4_DLL_DIR}/liblz4-*.dll" + ) + set ( LZ4_DLL ${_lz4_dll} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "LZ4 DLL file name" + ) + mark_as_advanced( LZ4_DLL_DIR LZ4_DLL ) + endif() else() set( LZ4_INCLUDE_DIRS ) set( LZ4_LIBRARIES ) diff --git a/cmake/modules/FindSNAPPY.cmake b/cmake/modules/FindSNAPPY.cmake index cc018bbcba..99e8b60fc4 100644 --- a/cmake/modules/FindSNAPPY.cmake +++ b/cmake/modules/FindSNAPPY.cmake @@ -3,22 +3,27 @@ # Find Snappy includes and library # # SNAPPY_INCLUDE_DIRS - where to find snappy.h, etc. -# SNAPPY_LIBRARIES - List of libraries when using snappy. -# SNAPPY_FOUND - True if snappy found. +# SNAPPY_LIBRARIES - List of libraries when using Snappy. +# SNAPPY_FOUND - True if Snappy found. +# SNAPPY_DLL_DIR - (Windows) Path to the Snappy DLL +# SNAPPY_DLL - (Windows) Name of the Snappy DLL + +include( FindWSWinLibs ) +FindWSWinLibs( "snappy-.*" "SNAPPY_HINTS" ) find_package(PkgConfig) pkg_search_module(SNAPPY libsnappy) find_path(SNAPPY_INCLUDE_DIR NAMES snappy.h - HINTS "${SNAPPY_INCLUDEDIR}" + HINTS "${SNAPPY_INCLUDEDIR}" "${SNAPPY_HINTS}/include" /usr/include /usr/local/include ) find_library(SNAPPY_LIBRARY NAMES snappy - HINTS "${SNAPPY_LIBDIR}" + HINTS "${SNAPPY_LIBDIR}" "${SNAPPY_HINTS}/lib" PATHS /usr/lib /usr/local/lib @@ -30,6 +35,19 @@ find_package_handle_standard_args( SNAPPY DEFAULT_MSG SNAPPY_INCLUDE_DIR SNAPPY_ if( SNAPPY_FOUND ) set( SNAPPY_INCLUDE_DIRS ${SNAPPY_INCLUDE_DIR} ) set( SNAPPY_LIBRARIES ${SNAPPY_LIBRARY} ) + if (WIN32) + set ( SNAPPY_DLL_DIR "${SNAPPY_HINTS}/bin" + CACHE PATH "Path to Snappy DLL" + ) + file( GLOB _snappy_dll RELATIVE "${SNAPPY_DLL_DIR}" + "${SNAPPY_DLL_DIR}/libsnappy-*.dll" + ) + set ( SNAPPY_DLL ${_snappy_dll} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "Snappy DLL file name" + ) + mark_as_advanced( SNAPPY_DLL_DIR SNAPPY_DLL ) + endif() else() set( SNAPPY_INCLUDE_DIRS ) set( SNAPPY_LIBRARIES ) |