• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            戰魂小筑

            討論群:309800774 知乎關注:http://zhihu.com/people/sunicdavy 開源項目:https://github.com/davyxu

               :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              257 隨筆 :: 0 文章 :: 506 評論 :: 0 Trackbacks

            先說下我的工程目錄

            ProjectName\

            src\

              core\

              share\

              proj.android\

                jni\

                …

            sdk\

              protobuf-2.4.1\

                src\

                …

            從Google code下載protobuf-2.4.1源碼包, 解壓, 在protobuf-2.4.1目錄下添加Android.mk, 內容如下

            LOCAL_PATH := $(call my-dir)
             
            include $(CLEAR_VARS)
             
            LOCAL_MODULE := protobuf-2.4.1
             
            LOCAL_SRC_FILES := \
            src/google/protobuf/io/coded_stream.cc                \
            src/google/protobuf/io/printer.cc                     \
            src/google/protobuf/io/gzip_stream.cc                 \
            src/google/protobuf/io/tokenizer.cc                   \
            src/google/protobuf/io/zero_copy_stream.cc            \
            src/google/protobuf/io/zero_copy_stream_impl.cc       \
            src/google/protobuf/io/zero_copy_stream_impl_lite.cc  \
            src/google/protobuf/stubs/common.cc                   \
            src/google/protobuf/stubs/once.cc                     \
            src/google/protobuf/stubs/structurally_valid.cc       \
            src/google/protobuf/stubs/strutil.cc                  \
            src/google/protobuf/stubs/substitute.cc               \
            src/google/protobuf/compiler/importer.cc              \
            src/google/protobuf/compiler/parser.cc                \
            src/google/protobuf/descriptor.cc                     \
            src/google/protobuf/descriptor.pb.cc                  \
            src/google/protobuf/descriptor_database.cc            \
            src/google/protobuf/dynamic_message.cc                \
            src/google/protobuf/extension_set.cc                  \
            src/google/protobuf/extension_set_heavy.cc            \
            src/google/protobuf/generated_message_reflection.cc   \
            src/google/protobuf/generated_message_util.cc         \
            src/google/protobuf/message.cc                        \
            src/google/protobuf/message_lite.cc                   \
            src/google/protobuf/reflection_ops.cc                 \
            src/google/protobuf/repeated_field.cc                 \
            src/google/protobuf/service.cc                        \
            src/google/protobuf/text_format.cc                    \
            src/google/protobuf/unknown_field_set.cc              \
            src/google/protobuf/wire_format.cc                    \
            src/google/protobuf/wire_format_lite.cc               \
             
             
            LOCAL_C_INCLUDES := $(LOCAL_PATH) \
                                $(LOCAL_PATH)/src
                               
             
            include $(BUILD_STATIC_LIBRARY)

            此時編譯會報config.h找不到的錯誤, 這個文件在vsproject目錄有, 但只是VC編譯使用,  這篇文章說需要手動創建, 但實際上, Linux下可以通過config系統自動生成的, 但是Android平臺下,不使用cygwin時, 就需要自己手動創建config.h, 內容如下

            /*
                This make file is only for android ONLY, modified by Davy Xu June 17, 2013
                Cause android platform can't use linux config system when cygwin envirement is not available
            */
             
            /* the location of <hash_set> */
            #define HASH_SET_H <ext/hash_set>
            #define HASH_MAP_H <ext/hash_map>
            #define HASH_NAMESPACE __gnu_cxx
             
            /* define if the compiler has hash_map */
            //#define HAVE_HASH_MAP 1
             
            /* define if the compiler has hash_set */
            //#define HAVE_HASH_SET 1
             
            #define HAVE_PTHREAD

            剩下的事情就簡單了, 在你的工程Android.mk里添加protobuf的引用

            例如:

            LOCAL_WHOLE_STATIC_LIBRARIES += protobuf-2.4.1

            $(call import-module,protobuf-2.4.1)

            還要在NDK_MODULE_PATH中增加搜索路徑D:\Develop\ProjectName\sdk\

            注意, 這里protobuf-2.4.1名稱必須與sdk下的文件夾名, LOCAL_MODULE中的名稱保持一致, 否則搜索不到

            posted on 2013-06-17 11:40 戰魂小筑 閱讀(5458) 評論(0)  編輯 收藏 引用 所屬分類: C++/ 編程語言移動開發
            久久精品亚洲精品国产欧美| 国产精品久久婷婷六月丁香| 成人精品一区二区久久久| 国内精品免费久久影院| 久久久久久精品免费免费自慰| 欧美亚洲色综久久精品国产 | 亚洲国产精品综合久久网络| 久久午夜羞羞影院免费观看| 久久久久亚洲AV无码去区首| 国产精品久久久久久吹潮| 久久天天躁狠狠躁夜夜2020一 | 国产精品久久久久久福利69堂| 精品久久人人爽天天玩人人妻 | 久久永久免费人妻精品下载| 久久笫一福利免费导航| 精品久久人人妻人人做精品| 久久国产精品久久精品国产| 日韩精品久久久肉伦网站| 中文字幕精品久久久久人妻| 久久国产香蕉一区精品| 欧美精品一区二区精品久久| 久久久精品人妻一区二区三区蜜桃 | 国产欧美久久久精品影院| 久久99精品免费一区二区| 久久99热国产这有精品| 狠狠色丁香久久婷婷综| 国产精品毛片久久久久久久 | 色综合久久久久网| 中文字幕一区二区三区久久网站| 国产情侣久久久久aⅴ免费| 精品无码久久久久久尤物| 国产精品美女久久久m| 久久偷看各类wc女厕嘘嘘| 久久久久久久久无码精品亚洲日韩| 亚洲精品高清国产一线久久| 亚洲AV无码久久精品狠狠爱浪潮 | a级毛片无码兔费真人久久| 久久久99精品一区二区| 亚洲AV伊人久久青青草原| 久久99久国产麻精品66| 久久国产色AV免费看|