Skip to content

Commit

Permalink
Merge pull request microsoft#7695 from longhuan2018/Fix-osgearth-with…
Browse files Browse the repository at this point in the history
…-rocksdbrocksdb(lz4,snappy,zlib,tbb,zstd)-failed

[osgearth]Fix osgearth rocksdb plugin build falied
  • Loading branch information
cbezault authored Aug 15, 2019
2 parents 7cf6c63 + 4b81f7f commit e236942
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ports/osgearth/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: osgearth
Version: 2.10.1
Version: 2.10.2
Description: osgEarth - Dynamic map generation toolkit for OpenSceneGraph Copyright 2015 Pelican Mapping.
Build-Depends: osg
84 changes: 84 additions & 0 deletions ports/osgearth/RocksDB.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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)
-
-
14 changes: 4 additions & 10 deletions ports/osgearth/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@ if(NOT OSG_PLUGINS_SUBDIR_LENGTH EQUAL 1)
endif()
string(REPLACE "${CURRENT_INSTALLED_DIR}/tools/osg/" "" OSG_PLUGINS_SUBDIR "${OSG_PLUGINS_SUBDIR}")

vcpkg_download_distfile(
VS2017PATCH
URLS "https://github.com/remoe/osgearth/commit/f7081cc4f9991c955c6a0ef7b7b50e48360d14fd.diff"
FILENAME "osgearth-f7081cc4f9991c955c6a0ef7b7b50e48360d14fd.patch"
SHA512 eadb47a5713c00c05add8627e5cad22844db041da34081d59104151a1a1e2d5ac9552909d67171bfc0449a3e4d2930dd3a7914d3ec7ef7ff1015574e9c9a6105
)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO gwaldron/osgearth
REF osgearth-2.10.1
SHA512 a74e6922ae29f85b4227b23a83dbccba92e08b7880533c281ceb244703c38b51a02823fdee3199c975c969db963b35ebad0e3bfed3c1e218a36d130b20a48e5b
REF osgearth-2.10.2
SHA512 fa306a82374716dafae9d834ed0fb07a7369ae0961696de36b6e2af45bc150040295985d9b9781ab713fd0707691451a6a8f173b34253749ab22764f51e60045
HEAD_REF master
PATCHES ${VS2017PATCH}
PATCHES
RocksDB.patch
)

vcpkg_configure_cmake(
Expand Down

0 comments on commit e236942

Please sign in to comment.