1. 程式人生 > >Windows 和 android 平臺Boost編譯方法

Windows 和 android 平臺Boost編譯方法

import os ;  
   
if [ os.name ] = CYGWIN || [ os.name ] = NT {  
androidPlatform = windows-x86_64 ;  
}  
else if [ os.name ] = LINUX {  
androidPlatform = linux-x86_64 ;  
}  
else if [ os.name ] = MACOSX {  
androidPlatform = darwin-x86 ;  
}  
   
modules.poke : NO_BZIP2 : 1 ;  
#ANDROID_NDK = ../.. ;  
ANDROID_NDK = E:/Android/android-ndk-r11c ;  
using gcc : android4.9 : $(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.9/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-g++ :  
<archiver>$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.9/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ar  
<ranlib>$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.9/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ranlib  
<compileflags>--sysroot=$(ANDROID_NDK)/platforms/android-21/arch-arm  
<compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/include  
<compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include  
#<compileflags>-DBOOST_NO_STD_WSTRING 
<compileflags>-DBOOST_FILESYSTEM_VERSION=3
<compileflags>-lgnustl_shared  
<compileflags>-mthumb
<compileflags>-Os  
<compileflags>-fno-strict-aliasing
<compileflags>-O2
<compileflags>-DNDEBUG
<compileflags>-g  
<compileflags>-lstdc++
<compileflags>-std=gnu++11
<compileflags>-D__GLIBC__
<compileflags>-D_GLIBCXX__PTHREADS
<compileflags>-D__arm__
<compileflags>-D_REENTRANT
;
注意調整 ANDROID_NDK 的路徑,這裡使用android-ndk-r11c ,所以用的是android4.9