protobuf&android
2015-02-05 21:02
330 查看
google&android
1、google编译时没有config.h
直接拷贝根目录下config.h放到google/protobuf下
2、backward_warning.h: No such file or directory错误
Change:
#include "backward_warning.h"
To:
#include "../backward/backward_warning.h"
3、Android.mk指定以下项:
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static protobuf_static
$(call import-module,google/protobuf)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../
jni/hellocpp/main.cpp下注释以下语句:
//#include "HelloWorldScene.h"
附一:
google/protobuf/Android.mk
#build google protobuf
LOCAL_PATH := $(call my-dir)
ifeq (,$(strip $(wildcard $(LOCAL_PATH)/obj/local/armeabi/libprotobuf_static.a)))
PROTOBUF_REBUILD := true
endif
libprotobuf_path := $(call my-dir)
libprotobuf_src_files :=
\
descriptor.cc \
descriptor.pb.cc \
descriptor_database.cc \
dynamic_message.cc \
extension_set.cc \
extension_set_heavy.cc \
generated_message_reflection.cc \
generated_message_util.cc \
io/coded_stream.cc \
io/gzip_stream.cc \
io/printer.cc \
io/tokenizer.cc \
io/zero_copy_stream.cc \
io/zero_copy_stream_impl.cc \
io/zero_copy_stream_impl_lite.cc \
message.cc \
message_lite.cc \
reflection_ops.cc \
repeated_field.cc \
service.cc \
stubs/common.cc \
stubs/once.cc \
stubs/structurally_valid.cc \
stubs/strutil.cc \
stubs/substitute.cc \
text_format.cc \
unknown_field_set.cc \
wire_format.cc \
wire_format_lite.cc
libprotobuf_static_libs := libstdc++
libprotobuf_cflags :=
libprotobuf_cppflags := -fuse-cxa-atexit
libprotobuf_c_includes :=$(libprotobuf_path)/../.. $(libprotobuf_path)/../../../Android $(libprotobuf_path)/.. $(libprotobuf_path)/protobuf
# Note: For now, this implementation depends on the system libstdc++
# We may want to avoid that in the future, i.e. in order to
# properly support exceptions and RTTI.
libstlport_static_libs := libstdc++
ifneq ($(PROTOBUF_REBUILD),true)
include $(CLEAR_VARS)
LOCAL_MODULE := protobuf_static
LOCAL_SRC_FILES := obj/local/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).a
LOCAL_STATIC_LIBRARIES := $(libprotobuf_static_libs)
LOCAL_EXPORT_C_INCLUDES := $(libprotobuf_c_includes)
include $(PREBUILT_STATIC_LIBRARY)
else
include $(CLEAR_VARS)
LOCAL_MODULE := protobuf_static
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := $(libprotobuf_src_files)
LOCAL_CFLAGS := $(libprotobuf_cflags)
LOCAL_CPPFLAGS := $(libprotobuf_cppflags)
LOCAL_C_INCLUDES := $(libprotobuf_c_includes)
LOCAL_STATIC_LIBRARIES := $(libprotobuf_static_libs)
LOCAL_EXPORT_C_INCLUDES := $(libprotobuf_c_includes)
include $(BUILD_STATIC_LIBRARY)
endif
1、google编译时没有config.h
直接拷贝根目录下config.h放到google/protobuf下
2、backward_warning.h: No such file or directory错误
Change:
#include "backward_warning.h"
To:
#include "../backward/backward_warning.h"
3、Android.mk指定以下项:
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static protobuf_static
$(call import-module,google/protobuf)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../
jni/hellocpp/main.cpp下注释以下语句:
//#include "HelloWorldScene.h"
附一:
google/protobuf/Android.mk
#build google protobuf
LOCAL_PATH := $(call my-dir)
ifeq (,$(strip $(wildcard $(LOCAL_PATH)/obj/local/armeabi/libprotobuf_static.a)))
PROTOBUF_REBUILD := true
endif
libprotobuf_path := $(call my-dir)
libprotobuf_src_files :=
\
descriptor.cc \
descriptor.pb.cc \
descriptor_database.cc \
dynamic_message.cc \
extension_set.cc \
extension_set_heavy.cc \
generated_message_reflection.cc \
generated_message_util.cc \
io/coded_stream.cc \
io/gzip_stream.cc \
io/printer.cc \
io/tokenizer.cc \
io/zero_copy_stream.cc \
io/zero_copy_stream_impl.cc \
io/zero_copy_stream_impl_lite.cc \
message.cc \
message_lite.cc \
reflection_ops.cc \
repeated_field.cc \
service.cc \
stubs/common.cc \
stubs/once.cc \
stubs/structurally_valid.cc \
stubs/strutil.cc \
stubs/substitute.cc \
text_format.cc \
unknown_field_set.cc \
wire_format.cc \
wire_format_lite.cc
libprotobuf_static_libs := libstdc++
libprotobuf_cflags :=
libprotobuf_cppflags := -fuse-cxa-atexit
libprotobuf_c_includes :=$(libprotobuf_path)/../.. $(libprotobuf_path)/../../../Android $(libprotobuf_path)/.. $(libprotobuf_path)/protobuf
# Note: For now, this implementation depends on the system libstdc++
# We may want to avoid that in the future, i.e. in order to
# properly support exceptions and RTTI.
libstlport_static_libs := libstdc++
ifneq ($(PROTOBUF_REBUILD),true)
include $(CLEAR_VARS)
LOCAL_MODULE := protobuf_static
LOCAL_SRC_FILES := obj/local/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).a
LOCAL_STATIC_LIBRARIES := $(libprotobuf_static_libs)
LOCAL_EXPORT_C_INCLUDES := $(libprotobuf_c_includes)
include $(PREBUILT_STATIC_LIBRARY)
else
include $(CLEAR_VARS)
LOCAL_MODULE := protobuf_static
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := $(libprotobuf_src_files)
LOCAL_CFLAGS := $(libprotobuf_cflags)
LOCAL_CPPFLAGS := $(libprotobuf_cppflags)
LOCAL_C_INCLUDES := $(libprotobuf_c_includes)
LOCAL_STATIC_LIBRARIES := $(libprotobuf_static_libs)
LOCAL_EXPORT_C_INCLUDES := $(libprotobuf_c_includes)
include $(BUILD_STATIC_LIBRARY)
endif
相关文章推荐
- android与PC,C#与Java 利用protobuf 进行无障碍通讯【Socket】 推荐
- Android与PC,C#与Java 利用protobuf 进行无障碍通讯【Socket】
- [原]Unity手游之路<一>Protobuf利器介绍
- Android protobuf 简易操作流程
- 高性能RPC over MINA&google protobuf 代码&实例 (一)
- Android上GTalk以及Push机制的XMPP数据选择使用protobuf格式而非XML格式
- erlang&protobuf
- 高性能RPC over MINA&google protobuf 代码&实例 (二)
- 高性能RPC over MINA&google protobuf 代码&实例 (一)
- protobuf使用NDK编译Android的静态库(工作记录)
- [转]Android上GTalk以及Push机制的XMPP数据选择使用protobuf格式而非XML格式
- android与PC,C#与Java 利用protobuf 进行无障碍通讯【Socket】
- Google protobuf在android下面运用
- [原]Unity手游之路<一>Protobuf利器介绍
- Android与PC,C#与Java 利用protobuf 进行无障碍通讯【Socket】
- android与PC,C#与Java 利用protobuf 进行无障碍通讯【Socket】
- protobuf 测试 & ant build.xml
- android与PC,C#与Java 利用protobuf 进行无障碍通讯【Socket】
- protobuf 消息升级 && 动态proto
- lua&protobuf使用