• <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>

            戰(zhàn)魂小筑

            討論群:309800774 知乎關(guān)注:http://zhihu.com/people/sunicdavy 開(kāi)源項(xiàng)目:https://github.com/davyxu

               :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              257 隨筆 :: 0 文章 :: 506 評(píng)論 :: 0 Trackbacks

            先說(shuō)下我的工程目錄

            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, 內(nèi)容如下

            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)

            此時(shí)編譯會(huì)報(bào)config.h找不到的錯(cuò)誤, 這個(gè)文件在vsproject目錄有, 但只是VC編譯使用,  這篇文章說(shuō)需要手動(dòng)創(chuàng)建, 但實(shí)際上, Linux下可以通過(guò)config系統(tǒng)自動(dòng)生成的, 但是Android平臺(tái)下,不使用cygwin時(shí), 就需要自己手動(dòng)創(chuàng)建config.h, 內(nèi)容如下

            /*
                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

            剩下的事情就簡(jiǎn)單了, 在你的工程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 戰(zhàn)魂小筑 閱讀(5443) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): C++/ 編程語(yǔ)言移動(dòng)開(kāi)發(fā)
            久久久久se色偷偷亚洲精品av| 亚洲国产精品久久久天堂| 久久婷婷五月综合97色 | 久久久久久精品成人免费图片 | 欧美一区二区精品久久| 亚洲国产成人久久综合碰| 久久93精品国产91久久综合| 青青草原综合久久大伊人精品| 久久久精品2019免费观看| 色综合久久无码中文字幕| 日韩人妻无码一区二区三区久久| 伊人久久大香线蕉av一区| 香蕉久久av一区二区三区| 久久久久亚洲AV无码网站| 久久久噜噜噜久久熟女AA片| 久久精品国产亚洲AV电影| 久久国产精品成人免费 | 久久久久久久国产免费看| 久久国产精品一区| 香蕉久久AⅤ一区二区三区| 一本色道久久综合狠狠躁篇 | 亚洲国产一成人久久精品| 久久永久免费人妻精品下载| 久久国产高潮流白浆免费观看| 国内精品久久人妻互换| 精品久久久久久久久久中文字幕 | 亚洲国产一成人久久精品| 久久av无码专区亚洲av桃花岛| 99精品国产在热久久| 国产高潮国产高潮久久久91| 中文精品99久久国产 | 国产亚洲美女精品久久久| 亚洲精品无码久久不卡| 久久中文骚妇内射| 成人午夜精品久久久久久久小说 | 色天使久久综合网天天| 99久久人妻无码精品系列| 久久99精品久久久久久不卡| 久久久久免费精品国产| 久久精品成人免费看| 亚洲va久久久久|