mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-23 02:57:09 +01:00
[leveldb] Port update (#6900)
This commit is contained in:
parent
f63ddfec5e
commit
578139ece7
@ -1,92 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(leveldb C CXX)
|
||||
|
||||
option(INSTALL_HEADERS "Install header files" ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
IF (MSVC)
|
||||
add_definitions(
|
||||
-DWIN32
|
||||
-D_CRT_NONSTDC_NO_DEPRECATE
|
||||
-D_SCL_SECURE_NO_WARNINGS
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
-DNOMINMAX
|
||||
-DLEVELDB_PLATFORM_WINDOWS
|
||||
-DLEVELDB_ATOMIC_PRESENT
|
||||
)
|
||||
else ()
|
||||
add_definitions(
|
||||
-DLEVELDB_PLATFORM_POSIX
|
||||
-DLEVELDB_ATOMIC_PRESENT
|
||||
)
|
||||
endif()
|
||||
set(SRCS
|
||||
db/builder.cc
|
||||
db/c.cc
|
||||
db/dbformat.cc
|
||||
db/db_impl.cc
|
||||
db/db_iter.cc
|
||||
db/dumpfile.cc
|
||||
db/filename.cc
|
||||
db/log_reader.cc
|
||||
db/log_writer.cc
|
||||
db/memtable.cc
|
||||
db/repair.cc
|
||||
db/table_cache.cc
|
||||
db/version_edit.cc
|
||||
db/version_set.cc
|
||||
db/write_batch.cc
|
||||
helpers/memenv/memenv.cc
|
||||
port/port_posix_sse.cc
|
||||
table/block.cc
|
||||
table/block_builder.cc
|
||||
table/filter_block.cc
|
||||
table/format.cc
|
||||
table/iterator.cc
|
||||
table/merger.cc
|
||||
table/table.cc
|
||||
table/table_builder.cc
|
||||
table/two_level_iterator.cc
|
||||
util/arena.cc
|
||||
util/bloom.cc
|
||||
util/cache.cc
|
||||
util/coding.cc
|
||||
util/comparator.cc
|
||||
util/crc32c.cc
|
||||
util/env.cc
|
||||
util/filter_policy.cc
|
||||
util/hash.cc
|
||||
util/histogram.cc
|
||||
util/logging.cc
|
||||
util/options.cc
|
||||
util/status.cc
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
set(SRCS ${SRCS} port/port_win.cc util/env_win.cc)
|
||||
else ()
|
||||
set(SRCS ${SRCS} port/port_posix.cc util/env_posix.cc)
|
||||
ENDIF()
|
||||
|
||||
add_library(leveldb ${SRCS})
|
||||
|
||||
target_include_directories(leveldb
|
||||
PUBLIC include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(leveldb PUBLIC Iphlpapi.lib Shlwapi.lib)
|
||||
|
||||
install(TARGETS leveldb
|
||||
RUNTIME DESTINATION bin
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
|
||||
if(INSTALL_HEADERS)
|
||||
file(GLOB HEADERS include/leveldb/*.h)
|
||||
install(FILES ${HEADERS} DESTINATION include/leveldb)
|
||||
install(FILES helpers/memenv/memenv.h DESTINATION include)
|
||||
endif()
|
@ -1,4 +1,4 @@
|
||||
Source: leveldb
|
||||
Version: 2017-10-25-8b1cd3753b184341e837b30383832645135d3d73-3
|
||||
Homepage: https://github.com/bitcoin-core/leveldb
|
||||
Description: LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
|
||||
Source: leveldb
|
||||
Version: 1.22
|
||||
Homepage: https://github.com/bitcoin-core/leveldb
|
||||
Description: LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
|
||||
|
19
ports/leveldb/fix-install_path.patch
Normal file
19
ports/leveldb/fix-install_path.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 1409c06..c81d219 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -440,12 +440,12 @@ if(LEVELDB_INSTALL)
|
||||
install(
|
||||
EXPORT leveldbTargets
|
||||
NAMESPACE leveldb::
|
||||
- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/leveldb"
|
||||
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/../share/leveldb"
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"${PROJECT_SOURCE_DIR}/cmake/leveldbConfig.cmake"
|
||||
"${PROJECT_BINARY_DIR}/leveldbConfigVersion.cmake"
|
||||
- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/leveldb"
|
||||
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/../share/leveldb"
|
||||
)
|
||||
endif(LEVELDB_INSTALL)
|
@ -1,63 +0,0 @@
|
||||
db/c.cc | 2 ++
|
||||
port/port_win.h | 7 +++++++
|
||||
util/env_win.cc | 6 ++++--
|
||||
3 files changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/db/c.cc b/db/c.cc
|
||||
index 08ff0ad..b23e3dc 100644
|
||||
--- a/db/c.cc
|
||||
+++ b/db/c.cc
|
||||
@@ -5,7 +5,9 @@
|
||||
#include "leveldb/c.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
+#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
+#endif
|
||||
#include "leveldb/cache.h"
|
||||
#include "leveldb/comparator.h"
|
||||
#include "leveldb/db.h"
|
||||
diff --git a/port/port_win.h b/port/port_win.h
|
||||
index e8bf46e..989c15c 100644
|
||||
--- a/port/port_win.h
|
||||
+++ b/port/port_win.h
|
||||
@@ -32,9 +32,16 @@
|
||||
#define STORAGE_LEVELDB_PORT_PORT_WIN_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
+#if !(_MSC_VER >= 1900)
|
||||
#define snprintf _snprintf
|
||||
+#endif
|
||||
#define close _close
|
||||
#define fread_unlocked _fread_nolock
|
||||
+#ifdef _WIN64
|
||||
+#define ssize_t int64_t
|
||||
+#else
|
||||
+#define ssize_t int32_t
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
diff --git a/util/env_win.cc b/util/env_win.cc
|
||||
index d32c4e6..3b4c92b 100644
|
||||
--- a/util/env_win.cc
|
||||
+++ b/util/env_win.cc
|
||||
@@ -761,14 +761,16 @@ uint64_t Win32Env::NowMicros()
|
||||
static Status CreateDirInner( const std::string& dirname )
|
||||
{
|
||||
Status sRet;
|
||||
- DWORD attr = ::GetFileAttributes(dirname.c_str());
|
||||
+ std::wstring dirnameW;
|
||||
+ ToWidePath(dirname, dirnameW);
|
||||
+ DWORD attr = ::GetFileAttributesW(dirnameW.c_str());
|
||||
if (attr == INVALID_FILE_ATTRIBUTES) { // doesn't exist:
|
||||
std::size_t slash = dirname.find_last_of("\\");
|
||||
if (slash != std::string::npos){
|
||||
sRet = CreateDirInner(dirname.substr(0, slash));
|
||||
if (!sRet.ok()) return sRet;
|
||||
}
|
||||
- BOOL result = ::CreateDirectory(dirname.c_str(), NULL);
|
||||
+ BOOL result = ::CreateDirectoryW(dirnameW.c_str(), NULL);
|
||||
if (result == FALSE) {
|
||||
sRet = Status::IOError(dirname, "Could not create directory.");
|
||||
return sRet;
|
@ -4,17 +4,14 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
BRANCH "bitcoin-fork"
|
||||
REPO "bitcoin-core/leveldb"
|
||||
REF "8b1cd3753b184341e837b30383832645135d3d73"
|
||||
SHA512 f5ad5fd21fb28ee052a4f3873abd58dab508c71621bcd482ab9e6ef4b57eca182c81502ddfe59736f5b2a54f2d05b397dd15982b3bd5d9039cd481eae3c7b958
|
||||
REPO "google/leveldb"
|
||||
REF 1.22
|
||||
SHA512 f9bbf5f466e7f707b94e19261762319ea9f65d41911690e84f59098551e2e69beccf756a414d705ade74ee96fd979bdb8b94c171c6f2cc83873cbd4a9380dbab
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix-install_path.patch
|
||||
)
|
||||
|
||||
vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES ${CMAKE_CURRENT_LIST_DIR}/msvc_code_fix.diff)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA # Disable this option if project cannot be built with Ninja
|
||||
@ -23,5 +20,8 @@ vcpkg_configure_cmake(
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/leveldb RENAME copyright)
|
||||
|
Loading…
x
Reference in New Issue
Block a user