Last active
April 25, 2017 00:14
-
-
Save geniys/bb48e6a8ce6e596acd3dabf9e671af65 to your computer and use it in GitHub Desktop.
Revisions
-
geniys revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ $NDK/build/tools/make_standalone_toolchain.py \ --arch arm --api 21 --install-dir /tmp/my-android-toolchain ``` > You can get detail information from https://developer.android.com/ndk/guides/standalone_toolchain.html # Build boost 1. Download boost library and extract anywhere -
geniys revised this gist
Apr 25, 2017 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -62,4 +62,8 @@ android { # Environment * Ubuntu 16.04 * NDK r14b * Boost 1.64.0 # Reference * https://developer.android.com/ndk/guides/cpp-support.html * https://developer.android.com/ndk/guides/standalone_toolchain.html -
geniys revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ $NDK/build/tools/make_standalone_toolchain.py \ # Build boost 1. Download boost library and extract anywhere 2. run ./bootstrap.sh (not cross-compile) 3. run ./b2 --prefix=/tmp/my-boot-library toolset=clang target-os=android install (cross-compile) > If you do not want symbolic link, modify `rule tag` funtion at `boostcpp.jam` file -
geniys revised this gist
Apr 25, 2017 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,4 +58,8 @@ android { // } // } } ``` # Environment * Ubuntu 16.04 * NDK r14b * Boost 1.64.0 -
geniys renamed this gist
Apr 25, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
geniys created this gist
Apr 25, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,61 @@ # Make a standalone toolchain 1. Download NDK and extract anywhere 2. get toolchain ``` $NDK/build/tools/make_standalone_toolchain.py \ --arch arm --api 21 --install-dir /tmp/my-android-toolchain ``` > You can get detail information from [https://developer.android.com/ndk/guides/standalone_toolchain.html](https://developer.android.com/ndk/guides/standalone_toolchain.html) # Build boost 1. Download boost library and extract anywhere 2. run ./bootstrap.sh (not cross-compile) 3. run ./b2 --prefix=/tmp/my-boot-library toolset=clang target-os=android install > If you do not want symbolic link, modify `rule tag` funtion at `boostcpp.jam` file # Add to Android project ## CMakeLists.txt ``` include_directories( /tmp/my-boot-library/include/ ) add_library(boost STATIC IMPORTED) set_target_properties(boost PROPERTIES IMPORTED_LOCATION /tmp/my-boot-library/lib/libboost_system.a) # add_library(boost SHARED IMPORTED) # set_target_properties(boost PROPERTIES IMPORTED_LOCATION /tmp/my-boot-library/lib/libboost_system.so) target_link_libraries( # Specifies the target library. native-lib # Links the target library to the log library # included in the NDK. ${log-lib} boost) ``` ## Build.gradle(Module:app) ``` android { ... defaultConfig { ... externalNativeBuild { cmake { cppFlags "-std=c++11 -frtti -fexceptions" abiFilters 'armeabi' arguments '-DANDROID_STL=c++_static' } } } // shared library case // sourceSets { // main { // jniLibs.srcDirs = ['/tmp/my-boot-library/lib/'] // } // } } ```