Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost C++ and Android 3

I tried to google and SO search. So far I was able to find only conflicting information. If it is too hard to marry Boost and Android, maybe there are replacements? I am especially interested in smart_ptr, threads, function, lexical_cast, string_algo and containers. Any input is appreciated. Thank you.

like image 201
pic11 Avatar asked Oct 10 '11 09:10

pic11


1 Answers

Have a look at this project: https://github.com/MysticTreeGames/Boost-for-Android

Boost for android is a set of tools to compile the main part of the Boost C++ Libraries for the Android platform.

To compile Boost for Android you may use the customized NDK r4b provided by Dmitry Moskalchuk aka CrystaX. Or you may download official NDK r5c.

Since it was written NDK r6 have been released by Google (and customized by CrystaX). Thus I suggest you to build "Boost for Android" against the latest NDK r6 from CrystaX, as described on its site:


./build-android.sh crystax/ndk/root

This command will download and build boost against the Crystax NDK and output the final header and libs and in the build folder.

Now that you got boost compiled you must add it to your Android.mk file. First copy the the include and lib folder over to your jni folder. I copied it just into: /jni/boost/.

Add the following to your Android.mk:

LOCAL_CFLAGS += -I$(LOCAL_PATH)/boost/include/ 
LOCAL_LDLIBS += -L$(LOCAL_PATH)/external/boost/lib/ -lboost_system -lboost_...

LOCAL_CPPFLAGS += -fexceptions
LOCAL_CPPFLAGS += -frtti
like image 133
Idolon Avatar answered Sep 30 '22 00:09

Idolon