Skip to content

Commit

Permalink
finish android cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
zilongshanren committed Aug 31, 2014
1 parent 2ce67b0 commit e736080
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Box2D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ add_library(Box2D STATIC ${box2d_source_files})


if(ANDROID)
message(STATUS "android doesn't need arCHIVE_OUTPUT_DIRECTORY")
message(STATUS "android doesn't need ARCHIVE_OUTPUT_DIRECTORY")
else()
set_target_properties(Box2D
PROPERTIES
Expand Down
21 changes: 15 additions & 6 deletions Box2D/build_android.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#!/bin/sh

export PATH=$PATH:$HOME/Github/android-toolchain/bin
# export ANDROID_NDK_TOOLCHAIN_ROOT=$HOME/Github/android-toolchain
export ANDROID_STANDALONE_TOOLCHAIN=$HOME/Github/android-toolchain
# export ANDROID_NDK=$HOME/AndroidDev/android-ndk-r9d/
export ANDROID_NDK=$HOME/AndroidDev/android-ndk-r9d/
ANDROID_API_LEVEL=19

# generate the android toolchain of arm
sh $ANDROID_NDK/build/tools/make-standalone-toolchain.sh --platform=android-$ANDROID_API_LEVEL --install-dir=./android-toolchain --system=darwin-x86_64 --ndk-dir=/Users/guanghui/AndroidDev/android-ndk-r9d/ --toolchain=arm-linux-androideabi-4.8

# generate thte android toolchain of x86
sh $ANDROID_NDK/build/tools/make-standalone-toolchain.sh --platform=android-$ANDROID_API_LEVEL --install-dir=./android-toolchain-x86 --system=darwin-x86_64 --ndk-dir=/Users/guanghui/AndroidDev/android-ndk-r9d/ --toolchain=x86-4.8

export PATH=$PATH:./android-toolchain/bin
export ANDROID_STANDALONE_TOOLCHAIN=./android-toolchain


rm -rf build.android/
Expand All @@ -29,12 +36,14 @@ mkdir build.android/
cd build.android/

#build for x86
export PATH=$PATH:$HOME/Github/android-toolchain-x86/bin
export ANDROID_STANDALONE_TOOLCHAIN=$HOME/Github/android-toolchain-x86
export PATH=$PATH:./android-toolchain-x86/bin
export PATH=$PATH:$ANDROID_NDK/build/tools/
export ANDROID_STANDALONE_TOOLCHAIN=./android-toolchain-x86
cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_ABI="x86" -DANDROID=1 ..

make


cd ..
# ndk-depends libs/x86/libChipmunk.a
rm -rf build.android/
2 changes: 1 addition & 1 deletion Box2D/build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mkdir -p prebuilt/32/
cp lib/libBox2D.a prebuilt/32/
rm -rf lib

cmake -DLINUX32=0 .
cmake -DLINUX64=1 .

make

Expand Down

0 comments on commit e736080

Please sign in to comment.