Skip to content

Commit

Permalink
Updated from extremeheat/leveldb-mcpe
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlegiantJGC committed Feb 13, 2021
1 parent a30386a commit 751094f
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ build_config.mk
*_test
db_bench
leveldbutil
bin/

CMakeCache*
*.cmake
CMakeFiles*

# build
build*/
Win32/
leveldb.dir/
77 changes: 77 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
project(leveldb)
cmake_minimum_required(VERSION 3.2)

include(CheckCXXCompilerFlag)

list(APPEND SOURCES db/builder.cc)
list(APPEND SOURCES db/c.cc)
list(APPEND SOURCES db/db_impl.cc)
list(APPEND SOURCES db/db_iter.cc)
list(APPEND SOURCES db/dbformat.cc)
list(APPEND SOURCES db/filename.cc)
list(APPEND SOURCES db/log_reader.cc)
list(APPEND SOURCES db/log_writer.cc)
list(APPEND SOURCES db/memtable.cc)
list(APPEND SOURCES db/repair.cc)
list(APPEND SOURCES db/table_cache.cc)
list(APPEND SOURCES db/version_edit.cc)
list(APPEND SOURCES db/version_set.cc)
list(APPEND SOURCES db/write_batch.cc)
list(APPEND SOURCES table/block.cc)
list(APPEND SOURCES table/block_builder.cc)
list(APPEND SOURCES table/filter_block.cc)
list(APPEND SOURCES table/format.cc)
list(APPEND SOURCES table/iterator.cc)
list(APPEND SOURCES table/merger.cc)
list(APPEND SOURCES table/table.cc)
list(APPEND SOURCES table/table_builder.cc)
list(APPEND SOURCES table/two_level_iterator.cc)
list(APPEND SOURCES util/arena.cc)
list(APPEND SOURCES util/bloom.cc)
list(APPEND SOURCES util/cache.cc)
list(APPEND SOURCES util/coding.cc)
list(APPEND SOURCES util/comparator.cc)
list(APPEND SOURCES util/crc32c.cc)
list(APPEND SOURCES util/env.cc)
list(APPEND SOURCES util/filter_policy.cc)
list(APPEND SOURCES util/hash.cc)
list(APPEND SOURCES util/histogram.cc)
list(APPEND SOURCES util/logging.cc)
list(APPEND SOURCES util/options.cc)
list(APPEND SOURCES util/status.cc)
list(APPEND SOURCES db/zlib_compressor.cc)
list(APPEND SOURCES db/zstd_compressor.cc)
list(APPEND SOURCES port/port_posix_sse.cc)
include_directories(. include)

if (UNIX)
list(APPEND SOURCES port/port_posix.cc)
list(APPEND SOURCES util/env_posix.cc)

add_definitions(-DLEVELDB_PLATFORM_POSIX "-DDLLX=")
if(APPLE)
add_definitions(-DOS_MACOSX)
endif()

CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)

if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

elseif (WIN32)
list(APPEND SOURCES port/port_win.cc)
list(APPEND SOURCES util/env_win.cc)
list(APPEND SOURCES util/win_logger.cc)
add_definitions(-DLEVELDB_PLATFORM_WINDOWS "-DDLLX=__declspec(dllexport)")
endif()

add_library(leveldb ${SOURCES})

find_package(ZLIB REQUIRED)
if (ZLIB_FOUND)
include_directories( ${ZLIB_INCLUDE_DIRS} )
target_link_libraries( leveldb ${ZLIB_LIBRARIES} )
endif(ZLIB_FOUND)
4 changes: 4 additions & 0 deletions db/c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -16,7 +18,9 @@
#include "leveldb/status.h"
#include "leveldb/write_batch.h"
#include "leveldb/zlib_compressor.h"
#ifdef SNAPPY
#include "leveldb/snappy_compressor.h"
#endif

using leveldb::Cache;
using leveldb::Comparator;
Expand Down
2 changes: 1 addition & 1 deletion port/port_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#ifdef SNAPPY
#include <snappy/snappy.h>
#elif defined(ZLIB)
#include <zlib/zlib.h>
#include <zlib.h>
#endif

namespace leveldb {
Expand Down
2 changes: 2 additions & 0 deletions port/port_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include <cassert>
#include <condition_variable>

typedef ptrdiff_t ssize_t;

namespace leveldb {
namespace port {

Expand Down

0 comments on commit 751094f

Please sign in to comment.