forked from pocoproject/poco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path99300-AndroidPlatformNotes.page
More file actions
276 lines (233 loc) · 7.63 KB
/
99300-AndroidPlatformNotes.page
File metadata and controls
276 lines (233 loc) · 7.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
POCO C++ Libraries Android Platform Notes
AAAIntroduction
!!!Introduction
Starting with release 1.4.2 the POCO C++ Libraries can be used on
Android, using the NDK r6. The gmake-based build system (also used
for Mac OS X, Linux, etc.) is used to build the libraries.
A standalone "customized" toolchain for Android (see below) is required.
!!!Requirements
!!Standalone Toolchain
Please refer to the Android NDK Dev Guide document "Standalone Toolchain", section 3,
(<*docs/STANDALONE-TOOLCHAIN.html*>) for instructions how to create a customized toolchain.
Typically, you'll run a command like:
$NDK/build/tools/make-standalone-toolchain.sh --platform=android-8 --install-dir=$HOME/my-android-toolchain
----
Then, add the directory containing the toolchain executables to your <[$PATH]>:
export PATH=$PATH:$HOME/my-android-toolchain/bin
----
!!Compiling the POCO C++ Libraries
When compiling the POCO C++ Libraries for a Android target, as well as
when including POCO C++ Libraries headers in a project for a Android
target, the preprocessor macro <[POCO_ANDROID]> must be defined. This is
because the Android NDK GCC compiler does not provide a predefined macro that
allows for reliable detection of an Android target.
!!!Restrictions
For the most part, the Linux and Android ports of the POCO C++ Libraries are very similar.
However, there are a few restrictions due to the Binoic C library used by Android.
!!Poco::NamedEvent and Poco::NamedMutex
These classes are not supported on Android. While Poco::NamedEvent and
Poco::NamedMutex objects can be created, any attempt to call a method
of these classes will result in a Poco::NotImplementedException being thrown.
!!Poco::SharedMemory
Shared memory is not supported on Android.
!!Poco::FPEnvironment
The Poco::FPEnvironment class is not available on Android and
cannot be used.
!!Poco::RWLock
On Android, Poco::RWLock is an ordinary mutex.
!!!Build Notes
!!Using POCO's GNU Make-based Build System
The <*Android*> build configuration (located in <*$POCO_BASE/build/config/Android*>)
is used to cross-build for Android from a Linux or Mac OS X host.
To build the POCO C++ Libraries (static) on a Linux or Mac OS X host:
./configure --config=Android --no-samples --no-tests
./make -s -j4
----
The default configuration builds for the <*armeabi*> platform ABI. To build for
<*armeabi-v7a*>, set the <[ANDROID_ABI]> make variable to <[armeabi-v7a]>:
./make -s -j4 ANDROID_ABI=armeabi-v7a
----
The build configuration also supports setting the <[ANDROID_ABI]> to <[x86]>,
but the NDK r6 standalone toolchain for x86 generated by <*make-standalone-toolchain.sh*>
lacks the C++ STL headers, so this does not work.
Depending on your specific requirements (e.g., no ARM architecture, etc.), it may be necessary
to modify the Android build configuration, or create a new one based on it.
See the [[99150-GMakeBuildNotes.html GNU Make Build System]] document for more information.
!!Using Android's Build System
Alternatively to POCO's build system, Android's build system can be used to build the
POCO C++ Libraries. A sample makefile for the Foundation library is shown below.
#
# Android.mk
#
# POCO Foundation
#
include $(CLEAR_VARS)
LOCAL_MODULE := PocoFoundation
LOCAL_PATH := $(call my-dir)/src
LOCAL_CFLAGS := -DPOCO_ANDROID -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY
LOCAL_CPPFLAGS := -frtti -fexceptions
LOCAL_C_INCLUDES := $(call my-dir)/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 \
MD2Engine.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_STATIC_LIBRARY)
----