Android NDK port for LevelDB.

This commit is contained in:
Gabor Cselle 2011-09-01 13:31:52 -07:00
parent 7263023651
commit adf4a95904
5 changed files with 82 additions and 37 deletions

View File

@ -18,6 +18,9 @@ $(shell sh ./build_detect_platform)
# this file is generated by build_detect_platform to set build flags # this file is generated by build_detect_platform to set build flags
include build_config.mk include build_config.mk
# Read in common build variable definitions and source file list.
include common.mk
# If Snappy is installed, add compilation and linker flags # If Snappy is installed, add compilation and linker flags
# (see http://code.google.com/p/snappy/) # (see http://code.google.com/p/snappy/)
ifeq ($(SNAPPY), 1) ifeq ($(SNAPPY), 1)
@ -36,46 +39,11 @@ else
GOOGLE_PERFTOOLS_LDFLAGS= GOOGLE_PERFTOOLS_LDFLAGS=
endif endif
CFLAGS = -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS) CFLAGS = -c $(C_INCLUDES:%=-I%) $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
LDFLAGS=$(PLATFORM_LDFLAGS) $(SNAPPY_LDFLAGS) $(GOOGLE_PERFTOOLS_LDFLAGS) LDFLAGS=$(PLATFORM_LDFLAGS) $(SNAPPY_LDFLAGS) $(GOOGLE_PERFTOOLS_LDFLAGS)
LIBOBJECTS = \ LIBOBJECTS = $(SOURCES:.cc=.o) port/port_posix.o
./db/builder.o \
./db/c.o \
./db/db_impl.o \
./db/db_iter.o \
./db/filename.o \
./db/dbformat.o \
./db/log_reader.o \
./db/log_writer.o \
./db/memtable.o \
./db/repair.o \
./db/table_cache.o \
./db/version_edit.o \
./db/version_set.o \
./db/write_batch.o \
./port/port_posix.o \
./table/block.o \
./table/block_builder.o \
./table/format.o \
./table/iterator.o \
./table/merger.o \
./table/table.o \
./table/table_builder.o \
./table/two_level_iterator.o \
./util/arena.o \
./util/cache.o \
./util/coding.o \
./util/comparator.o \
./util/crc32c.o \
./util/env.o \
./util/env_posix.o \
./util/hash.o \
./util/histogram.o \
./util/logging.o \
./util/options.o \
./util/status.o
TESTUTIL = ./util/testutil.o TESTUTIL = ./util/testutil.o
TESTHARNESS = ./util/testharness.o $(TESTUTIL) TESTHARNESS = ./util/testharness.o $(TESTUTIL)

12
README
View File

@ -1,3 +1,15 @@
Android NDK port for LevelDB.
This git branch contains a make system to build LevelDB
against the Android NDK: http://developer.android.com/sdk/ndk/index.html
To build:
- Download install the Android NDK
- cd into this directory
- $ ndk-build
====
leveldb: A key-value store leveldb: A key-value store
Authors: Sanjay Ghemawat (sanjay@google.com) and Jeff Dean (jeff@google.com) Authors: Sanjay Ghemawat (sanjay@google.com) and Jeff Dean (jeff@google.com)

44
common.mk Normal file
View File

@ -0,0 +1,44 @@
# Copyright (c) 2011 The LevelDB Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. See the AUTHORS file for names of contributors.
# Definitions of build variable common between Android and non-Android builds.
# Also add /include directory for extra leveldb includes.
C_INCLUDES = . ./include
SOURCES = \
./db/builder.cc \
./db/c.cc \
./db/db_impl.cc \
./db/db_iter.cc \
./db/filename.cc \
./db/dbformat.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 \
./table/block.cc \
./table/block_builder.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/cache.cc \
./util/coding.cc \
./util/comparator.cc \
./util/crc32c.cc \
./util/env.cc \
./util/env_posix.cc \
./util/hash.cc \
./util/histogram.cc \
./util/logging.cc \
./util/options.cc \
./util/status.cc

17
jni/Android.mk Normal file
View File

@ -0,0 +1,17 @@
# Copyright (c) 2011 The LevelDB Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. See the AUTHORS file for names of contributors.
# To build for Android, add the Android NDK to your path and type 'ndk-build'.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include common.mk
LOCAL_MODULE := leveldb
LOCAL_C_INCLUDES := $(C_INCLUDES)
LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS := -DLEVELDB_PLATFORM_ANDROID -std=gnu++0x
LOCAL_SRC_FILES := $(SOURCES:%.cc=../%.cc) ../port/port_android.cc
include $(BUILD_SHARED_LIBRARY)

4
jni/Application.mk Normal file
View File

@ -0,0 +1,4 @@
# Copyright (c) 2011 The LevelDB Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. See the AUTHORS file for names of contributors.
APP_ABI := armeabi-v7a
APP_STL := gnustl_static