1. jni 编译protobuf
在源码下建立jni目录
-
cong@msi:/work/cloud/mifi_arm/protobuf-2.5.0_jni$ tree jni/
-
jni/
-
├── Android.mk
-
└── Application.mk
2. Android.mk与Application.mk的内容如下
jni/Application.mk
-
APP_MODULES := protobuf
-
APP_PLATFORM := android-9
-
APP_ABI := armeabi-v7a
-
APP_STL := gnustl_static
-
APP_OPTIM := release
-
-
APP_CPPFLAGS := -fexceptions -frtti
jni/Android.mk
-
LOCAL_PATH := $(call my-dir)
-
SRC_PATH := ../src
-
-
include $(CLEAR_VARS)
-
-
LOCAL_CFLAGS:= -DHAVE_PTHREAD=1
-
-
LOCAL_SRC_FILES:= \
-
$(SRC_PATH)/google/protobuf/io/coded_stream.cc \
-
$(SRC_PATH)/google/protobuf/stubs/common.cc \
-
$(SRC_PATH)/google/protobuf/descriptor.cc \
-
$(SRC_PATH)/google/protobuf/descriptor.pb.cc \
-
$(SRC_PATH)/google/protobuf/descriptor_database.cc \
-
$(SRC_PATH)/google/protobuf/dynamic_message.cc \
-
$(SRC_PATH)/google/protobuf/extension_set.cc \
-
$(SRC_PATH)/google/protobuf/extension_set_heavy.cc \
-
$(SRC_PATH)/google/protobuf/generated_message_reflection.cc \
-
$(SRC_PATH)/google/protobuf/generated_message_util.cc \
-
$(SRC_PATH)/google/protobuf/io/gzip_stream.cc \
-
$(SRC_PATH)/google/protobuf/compiler/importer.cc \
-
$(SRC_PATH)/google/protobuf/message.cc \
-
$(SRC_PATH)/google/protobuf/message_lite.cc \
-
$(SRC_PATH)/google/protobuf/stubs/once.cc \
-
$(SRC_PATH)/google/protobuf/compiler/parser.cc \
-
$(SRC_PATH)/google/protobuf/io/printer.cc \
-
$(SRC_PATH)/google/protobuf/reflection_ops.cc \
-
$(SRC_PATH)/google/protobuf/repeated_field.cc \
-
$(SRC_PATH)/google/protobuf/service.cc \
-
$(SRC_PATH)/google/protobuf/stubs/structurally_valid.cc \
-
$(SRC_PATH)/google/protobuf/stubs/strutil.cc \
-
$(SRC_PATH)/google/protobuf/stubs/substitute.cc \
-
$(SRC_PATH)/google/protobuf/text_format.cc \
-
$(SRC_PATH)/google/protobuf/io/tokenizer.cc \
-
$(SRC_PATH)/google/protobuf/unknown_field_set.cc \
-
$(SRC_PATH)/google/protobuf/wire_format.cc \
-
$(SRC_PATH)/google/protobuf/wire_format_lite.cc \
-
$(SRC_PATH)/google/protobuf/io/zero_copy_stream.cc \
-
$(SRC_PATH)/google/protobuf/io/zero_copy_stream_impl.cc \
-
$(SRC_PATH)/google/protobuf/io/zero_copy_stream_impl_lite.cc \
-
$(SRC_PATH)/google/protobuf/stubs/stringprintf.cc
-
-
LOCAL_C_INCLUDES:= \
-
$(LOCAL_PATH)/../src \
-
$(LOCAL_PATH)/../
-
-
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -lz
-
LOCAL_SHARED_LIBRARIES:=
-
LOCAL_MODULE:= protobuf
-
LOCAL_MODULE_TAGS := optional
-
-
include $(BUILD_SHARED_LIBRARY)
3. 这样就可以在protobuf-2.5.0的目录下编译了
阅读(2034) | 评论(0) | 转发(0) |