vcpkg/ports/osgearth/RocksDB.patch
2019-08-15 13:27:14 +08:00

84 lines
2.3 KiB
Diff

diff --git a/CMakeModules/FindRocksDB.cmake b/CMakeModules/FindRocksDB.cmake
index 109b383..8382ed9 100644
--- a/CMakeModules/FindRocksDB.cmake
+++ b/CMakeModules/FindRocksDB.cmake
@@ -40,5 +40,49 @@ find_package_handle_standard_args(ROCKSDB
"Could NOT find ROCKSDB"
)
+if(ROCKSDB_FOUND)
+ FIND_PACKAGE(ZLIB REQUIRED)
+
+ include(SelectLibraryConfigurations)
+ # Find Snappy library
+ find_library(SNAPPY_LIBRARY_DEBUG NAMES snappyd)
+ find_library(SNAPPY_LIBRARY_RELEASE NAMES snappy)
+ select_library_configurations(SNAPPY)
+ find_package_handle_standard_args(SNAPPY
+ FOUND_VAR
+ SNAPPY_FOUND
+ REQUIRED_VARS
+ SNAPPY_LIBRARY
+ FAIL_MESSAGE
+ "Could NOT find SNAPPY"
+ )
+
+ # Find LZ4 library
+ find_library(LZ4_LIBRARY_DEBUG NAMES lz4d)
+ find_library(LZ4_LIBRARY_RELEASE NAMES lz4)
+ select_library_configurations(LZ4)
+ find_package_handle_standard_args(LZ4
+ FOUND_VAR
+ LZ4_FOUND
+ REQUIRED_VARS
+ LZ4_LIBRARY
+ FAIL_MESSAGE
+ "Could NOT find LZ4"
+ )
+
+ # Find ZSTD library
+ find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd)
+ find_library(ZSTD_LIBRARY_RELEASE NAMES zstd)
+ select_library_configurations(ZSTD)
+ find_package_handle_standard_args(ZSTD
+ FOUND_VAR
+ ZSTD_FOUND
+ REQUIRED_VARS
+ ZSTD_LIBRARY
+ FAIL_MESSAGE
+ "Could NOT find ZSTD_"
+ )
+endif(ROCKSDB_FOUND)
+
set(ROCKSDB_INCLUDE_DIRS ${ROCKSDB_INCLUDE_DIR} )
set(ROCKSDB_LIBRARIES ${ROCKSDB_LIBRARY})
-
-
diff --git a/src/osgEarthDrivers/cache_rocksdb/CMakeLists.txt b/src/osgEarthDrivers/cache_rocksdb/CMakeLists.txt
index 68ad85d..86bb18a 100644
--- a/src/osgEarthDrivers/cache_rocksdb/CMakeLists.txt
+++ b/src/osgEarthDrivers/cache_rocksdb/CMakeLists.txt
@@ -16,7 +16,19 @@ SET(TARGET_SRC
RocksDBCacheDriver.cpp
)
-SET(TARGET_LIBRARIES_VARS ROCKSDB_LIBRARY ZLIB_LIBRARY)
+if(SNAPPY_FOUND)
+ SET(ROCKSDB_DEPENDENT_LIBRARY ${ROCKSDB_DEPENDENT_LIBRARY} ${SNAPPY_LIBRARY})
+endif(SNAPPY_FOUND)
+
+if(LZ4_FOUND)
+ SET(ROCKSDB_DEPENDENT_LIBRARY ${ROCKSDB_DEPENDENT_LIBRARY} ${LZ4_LIBRARY})
+endif(LZ4_FOUND)
+
+if(ZSTD_FOUND)
+ SET(ROCKSDB_DEPENDENT_LIBRARY ${ROCKSDB_DEPENDENT_LIBRARY} ${ZSTD_LIBRARY})
+endif(ZSTD_FOUND)
+
+SET(TARGET_LIBRARIES_VARS ROCKSDB_LIBRARY ZLIB_LIBRARY ROCKSDB_DEPENDENT_LIBRARY)
IF(MSVC)
SET(TARGET_EXTERNAL_LIBRARIES ws2_32 winmm rpcrt4 shlwapi)
-
-