所有的poco版本,都可以在下面这个链接里找到
http://sourceforge.net/projects/poco/files/sources/
然后编译1.4.2的,我试验了一下,是可以的,参考:
poco的doc,但是这个doc,直到poco1.5.0,都没有更新,编译1.4.2是可以的
1. http://www.appinf.com/docs/poco/99300-AndroidPlatformNotes.html
2. http://blog.csdn.net/iflychenyang/article/details/8528609
这里面有一个很重要,就是修改:
进入poco目录,修改./Foundation/Makefile文件,将Makefile文件中的FPEnvironment去掉,否则无法编译
大概用这俩参考就可以搞定了。
我用的方法如下:
1. download poco1.4.2 in http://sourceforge.net/projects/poco/files/sources/
I have downloaded the poco-1.4.2-all.tar.gz packege, then mv it to Ubuntu 11.10.
2. untarthe packeg.
tar -zxvf poco-1.4.2-all.tar.gz
3 . run a command like:
$NDK/build/tools/make-standalone-toolchain.sh--platform=android-8 --install-dir=$HOME/my-android-toolchain
这里的 $NDK 就是装NDK的地方,我的环境变量env里, NDK=/home/jh/work/android/android-ndk-r8/,
如果echo$NDK 为空,那需要加上自己安装NDK的目录。用export$NDK=/home/jh/work/android/android-ndk-r8/那种加一下就行。
4. add the directory containing the toolchainexecutables to your $PATH:
exportPATH=$PATH:$HOME/my-android-toolchain/bin
5. modifythe ./Foundation/Makefile , delete the word FPEnvironment.
6. Then, add thedirectory containing the toolchain executables to your $PATH:
exportPATH=$PATH:$HOME/my-android-toolchain/bin
7. (这个可以跳过)
./configure --config=Android--no-samples --no-tests
./make -s -j4
8. 我是用ndk编译,所以第7步跳过,这时候建立一个jni文件夹在./Foundation/下
mkdir jni
9. 进入jni文件夹,添加 Android.mk, Application.mk 文件。
Android.mk 文件:
# Android.mk
# POCO Foundation
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := PocoFoundation
LOCAL_CFLAGS := -DPOCO_ANDROID -DPOCO_NO_FPENVIRONMENT-DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY
LOCAL_CPPFLAGS := -frtti -fexceptions
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_SRC_FILES := \
AbstractObserver.cpp \
ActiveDispatcher.cpp \
adler32.c \
ArchiveStrategy.cpp \
Ascii.cpp \
ASCIIEncoding.cpp \
AsyncChannel.cpp \
AtomicCounter.cpp \
Base64Decoder.cpp \
Base64Encoder.cpp \
BinaryReader.cpp \
BinaryWriter.cpp \
Bugcheck.cpp \
ByteOrder.cpp \
Channel.cpp \
Checksum.cpp \
compress.c \
Condition.cpp \
Configurable.cpp \
ConsoleChannel.cpp \
CountingStream.cpp \
crc32.c \
DateTime.cpp \
DateTimeFormat.cpp \
DateTimeFormatter.cpp \
DateTimeParser.cpp \
Debugger.cpp \
deflate.c \
DeflatingStream.cpp \
DigestEngine.cpp \
DigestStream.cpp \
DirectoryIterator.cpp \
DynamicAny.cpp \
DynamicAnyHolder.cpp \
Environment.cpp \
ErrorHandler.cpp \
Event.cpp \
EventArgs.cpp \
Exception.cpp \
File.cpp \
FileChannel.cpp \
FileStream.cpp \
FileStreamFactory.cpp \
Format.cpp \
Formatter.cpp \
FormattingChannel.cpp \
FPEnvironment.cpp \
Glob.cpp \
gzio.c \
Hash.cpp \
HashStatistic.cpp \
HexBinaryDecoder.cpp \
HexBinaryEncoder.cpp \
infback.c \
inffast.c \
inflate.c \
InflatingStream.cpp \
inftrees.c \
Latin1Encoding.cpp \
Latin9Encoding.cpp \
LineEndingConverter.cpp \
LocalDateTime.cpp \
LogFile.cpp \
Logger.cpp \
LoggingFactory.cpp \
LoggingRegistry.cpp \
LogStream.cpp \
Manifest.cpp \
MD4Engine.cpp \
MD5Engine.cpp \
MemoryPool.cpp \
MemoryStream.cpp \
Message.cpp \
Mutex.cpp \
NestedDiagnosticContext.cpp \
Notification.cpp \
NotificationCenter.cpp \
NotificationQueue.cpp \
NullChannel.cpp \
NullStream.cpp \
NumberFormatter.cpp \
NumberParser.cpp \
Path.cpp \
PatternFormatter.cpp \
pcre_chartables.c \
pcre_compile.c \
pcre_exec.c \
pcre_fullinfo.c \
pcre_globals.c \
pcre_maketables.c \
pcre_newline.c \
pcre_ord2utf8.c \
pcre_study.c \
pcre_tables.c \
pcre_try_flipped.c \
pcre_ucd.c \
pcre_valid_utf8.c \
pcre_xclass.c \
Pipe.cpp \
PipeImpl.cpp \
PipeStream.cpp \
PriorityNotificationQueue.cpp \
Process.cpp \
PurgeStrategy.cpp \
Random.cpp \
RandomStream.cpp \
RefCountedObject.cpp \
RegularExpression.cpp \
RotateStrategy.cpp \
Runnable.cpp \
RWLock.cpp \
Semaphore.cpp \
SHA1Engine.cpp \
SharedLibrary.cpp \
SharedMemory.cpp \
SignalHandler.cpp \
SimpleFileChannel.cpp \
SplitterChannel.cpp \
Stopwatch.cpp \
StreamChannel.cpp \
StreamConverter.cpp \
StreamCopier.cpp \
StreamTokenizer.cpp \
String.cpp \
StringTokenizer.cpp \
SynchronizedObject.cpp \
SyslogChannel.cpp \
Task.cpp \
TaskManager.cpp \
TaskNotification.cpp \
TeeStream.cpp \
TemporaryFile.cpp \
TextBufferIterator.cpp \
TextConverter.cpp \
TextEncoding.cpp \
TextIterator.cpp \
Thread.cpp \
ThreadLocal.cpp \
ThreadPool.cpp \
ThreadTarget.cpp \
TimedNotificationQueue.cpp \
Timer.cpp \
Timespan.cpp \
Timestamp.cpp \
Timezone.cpp \
Token.cpp \
trees.c \
UnicodeConverter.cpp \
Unicode.cpp \
URI.cpp \
URIStreamFactory.cpp \
URIStreamOpener.cpp \
UTF8Encoding.cpp \
UTF8String.cpp \
UTF16Encoding.cpp \
UUID.cpp \
UUIDGenerator.cpp \
Void.cpp \
Windows1252Encoding.cpp \
zutil.c
include $(BUILD_SHARED_LIBRARY)
==========================================================================================================
Application.mk 文件:
APP_PLATFORM:=android-9
APP_OPTIM := release
#APP_PLATFORM := android-7
APP_STL := gnustl_static
#APP_ABI := armeabi-v7a
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DANDROID
APP_ABI := armeabi
APP_PLATFORM := android-5
10. 把Foundation/src的cpp,c 文件,拷贝到jni目录下。
cp ../src/*.cpp ./ && cp ../src/*.c ./
11. 在jni下建立一个include 目录。
12. 把 Foundation/include下的所有文件,包括Poco目录,都拷贝到jni/include下。
13. 退到Foundation目录下,执行编译:
ndk-build
注意:官方的doc上,在Androkd.mk中,有一个MD2Engine.cpp,但是实际编译时会报错,需要删掉这一行。我用grep MD2Engine -rnw *看过整个目录,是没有某个.h或者cpp之类的文件使用这个的,所以可以删除。(估计他们写错了~~)