Android NDK は Cygwin に依存しなくなったため、Windows コマンド プロンプト内から NDK を使用して Boost をビルドできます ( cmd
)。
Boost.Build
NDKを検索するには、boost\tools\build\v2\user-config.jam
ファイルを編集して次のテキストを追加します。
import os ;
androidNDKRoot = C:/android-ndk-r8e ; # put the relevant path
using gcc : android :
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-g++ :
<compileflags>--sysroot=$(androidNDKRoot)/platforms/android-9/arch-arm
<compileflags>-mthumb
<compileflags>-Os
<compileflags>-fno-strict-aliasing
<compileflags>-O2
<compileflags>-DNDEBUG
<compileflags>-g
<compileflags>-lstdc++
<compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.7/include
<compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi/include
<compileflags>-D__GLIBC__
<compileflags>-D_GLIBCXX__PTHREADS
<compileflags>-D__arm__
<compileflags>-D_REENTRANT
<archiver>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-ar
<ranlib>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-ranlib
;
確かに、代わりにc:/android-ndk-r8e
NDK の正しい場所を PC に配置する必要があります。
また、 の代わりに、より最近のプラットフォーム API を選択できますandroid-9
。
また、NDK は複数のツールチェーンを提供しており、上記の設定は gcc-4.7 を指していることにも注意してください。他のツール チェーンを使用してブーストを構築する場合はarm-linux-androideabi-4.7
、関連するパスに変更してください。
構成を user-config.jam に入れたら、Boost が存在するディレクトリを開きcmd
、を呼び出します。次に、次のように呼び出します (例):cd
bootstrap
b2
b2 --without-python --without-serialization threading=multi link=static runtime-link=static toolset=gcc-android target-os=linux threadapi=pthread --stagedir=android stage
更新: 2015 年 11 月の時点で、古い NDK ツールチェーンは新しい Boost バージョンに問題があり、コンパイラのクラッシュを引き起こしているようです。そのため、最新のコンパイラの使用を検討してください。これを行うには、上記のスクリプトのすべての 4.7 を 4.9 に変更します。また、最新の Android API でコンパイルする価値があります (例: android-9 -> android-16 など)。