热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

所有原始文件都不能在android.mk上使用。-all-proto-files-underdoesn'tworkonandroid.mk

Searchingonseveralprojects,Ifoundthislineontheirandroid.mk$(callall-proto-files-under,$

Searching on several projects, I found this line on their android.mk $(call all-proto-files-under, $(src_proto)), and I tried to use this like that:

在几个项目中,我在他们的android上找到了这条线。mk $(调用所有原始文件,$(src_proto)),我试图这样使用:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := my_test
src_proto := $(LOCAL_PATH)/proto

LOCAL_CPP_EXTENSION := .cxx .cpp .cc
LOCAL_CPPFLAGS += -std=c++11

LOCAL_SRC_FILES := main.cc \
                   $(call all-proto-files-under, $(src_proto))

# print the source files
$(warning $(LOCAL_SRC_FILES))

# print only main.cc
$(warning $(LOCAL_SRC_FILES))

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include \
                    $(LOCAL_PATH)/proto

# for logging
LOCAL_LDLIBS    += -llog

# for native asset manager
LOCAL_LDLIBS    += -landroid

include $(BUILD_SHARED_LIBRARY)

But it doesn't work, the warning prints nothing, and the second warning prints only main.cc, the line $(call all-proto-files-under, $(src_proto)) does nothing. I would like to know how can I use protobuf with android ndk.

但是它不起作用,警告没有打印出来,第二个警告只打印main。cc, line $(调用all- profiles -under, $(src_proto))什么都不做。我想知道我如何使用android ndk来使用protobuf。

1 个解决方案

#1


1  

I don't know how to solve it with the all-proto-files-under function specifically, but if you want to add all source files in a directory you can do that in the following way:

我不知道如何用所有的原始文件来解决它,但是如果你想在一个目录中添加所有源文件,你可以这样做:

PROTOBUF_FILES := $(wildcard $(LOCAL_PATH)/proto/*.cc)
LOCAL_SRC_FILES += $(PROTOBUF_FILES:$(LOCAL_PATH)/%=%)

I suppose you could simplify that into a oneliner if you wanted to. It's also possible to add all source files in all subdirectories under a given directory if you need that:

我想如果你愿意的话可以把它简化成一个oneliner。如果您需要,还可以在给定目录下的所有子目录中添加所有源文件:

PROTOBUF_FILES := $(wildcard $(LOCAL_PATH)/proto/**/*.cc)

When I built protobuf myself, I just took the corresponding Android.mk file from the AOSP git and removed all the stuff I didn't need.

当我自己构建原型的时候,我只是使用了相应的Android。mkfile从AOSP git中删除所有我不需要的东西。


推荐阅读
author-avatar
捕鱼达人2702938971
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有