Trying to compile bullet for android
-
- Posts: 7
- Joined: Mon Feb 15, 2010 9:29 am
Trying to compile bullet for android
I installed android NDK 1.6 with openGL ES support. Is it possible to compile bullet physics libraries using the openGL ES library for android? As far as I can tell, there is no GLUT support on android, so the demos won't compile.
I am new to all this android stuff...so if anyone has a clue on how to proceed with the cmake utility in the bullet root directory...specifically for android, let me know. I did try cmake . -G "Unix Makefiles" (using Cygwin), then replaced the C and CXX compilers with the android NDK equivalents. The first failure has to do with a build option for the linker when compiling testCCompiler.c:
unrecognized option "--out-implib".
No clue where this is coming from.
I am new to all this android stuff...so if anyone has a clue on how to proceed with the cmake utility in the bullet root directory...specifically for android, let me know. I did try cmake . -G "Unix Makefiles" (using Cygwin), then replaced the C and CXX compilers with the android NDK equivalents. The first failure has to do with a build option for the linker when compiling testCCompiler.c:
unrecognized option "--out-implib".
No clue where this is coming from.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Trying to compile bullet for android
I recommend using the CMake cmake-gui tool, in advanced mode.
The --out-implib is added through one of the platform cmake files,
likely C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\Platform\Windows-gcc.cmake
(replace drive letter, program file path and version x with your version)
You could try to edit those to get rid of the --out-implib.
You should also read the cross-compilation documentation in the CMake
wiki: http://www.cmake.org/Wiki/CMake_Cross_Compiling
You may also want to subscribe to the CMake mailing list, where other
people using CMake for cross-compilation may be able to help you:
http://www.cmake.org/mailman/listinfo/cmake (Alexander Neundorf, for
instance, is quite knowledgeable on this matter)
As a last resort, you could try autotools/autoconf support of Bullet.
Can you let us know if and how you get it working?
Thanks a lot,
Erwin
The --out-implib is added through one of the platform cmake files,
likely C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\Platform\Windows-gcc.cmake
(replace drive letter, program file path and version x with your version)
You could try to edit those to get rid of the --out-implib.
You should also read the cross-compilation documentation in the CMake
wiki: http://www.cmake.org/Wiki/CMake_Cross_Compiling
You may also want to subscribe to the CMake mailing list, where other
people using CMake for cross-compilation may be able to help you:
http://www.cmake.org/mailman/listinfo/cmake (Alexander Neundorf, for
instance, is quite knowledgeable on this matter)
As a last resort, you could try autotools/autoconf support of Bullet.
Can you let us know if and how you get it working?
Thanks a lot,
Erwin
-
- Posts: 7
- Joined: Mon Feb 15, 2010 9:29 am
Re: Trying to compile bullet for android
Thanks for the tips...I usually work on this in the late evening. I will let you know how it goes.
-
- Posts: 7
- Joined: Mon Feb 15, 2010 9:29 am
Re: Trying to compile bullet for android
I am stuck at the following point trying to run cmake in the bullet 2.75 directory for Android:
From CMakeError.log:
Determining if the C compiler works failed with the following output:
Change Dir: /cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make.exe "cmTryCompileExec/fast"
make[1]: Entering directory `/cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
make[2]: Entering directory `/cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp'
/usr/bin/cmake.exe -E cmake_progress_report /cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o
/cygdrive/c/projects/android-ndk-1.6_r1/build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-gcc.exe -nostdlib -o CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c /cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTryCompileExec.exe
/usr/bin/cmake.exe -E cmake_link_script CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
/cygdrive/c/projects/android-ndk-1.6_r1/build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-gcc.exe -nostdlib -Wl,-rpath-link=/cygdrive/c/projects/android-ndk-1.6_r1/build/platforms/android-4/arch-arm/usr/lib -L/cygdrive/c/projects/android-ndk-1.6_r1/build/platforms/android-4/arch-arm/usr/lib/ CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -o cmTryCompileExec.exe -Wl,libcmTryCompileExec.dll.a
/cygdrive/c/projects/android-ndk-1.6_r1/build/prebuilt/windows/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/../../../../arm-eabi/bin/ld: libcmTryCompileExec.dll.a: No such file: No such file or directory
collect2: ld returned 1 exit status
make[2]: Leaving directory `/cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp'
make[1]: Leaving directory `/cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp'
make[2]: *** [cmTryCompileExec.exe] Error 1
make[1]: *** [cmTryCompileExec/fast] Error 2
I must have something set up incorrectly, but the error indicates a missing dll. I searched the hard drive to no avail....and I have no idea where to get this file. There is a directory at the path C:\projects\bullet-2.75\CMakeFiles\CMakeTmp\CMakeFiles called cmTryCompileExec.dir. It seems that the dll and source should be here, but it isn't.
I am even wondering if I really have to get this to work in order to compile the project...
From CMakeError.log:
Determining if the C compiler works failed with the following output:
Change Dir: /cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make.exe "cmTryCompileExec/fast"
make[1]: Entering directory `/cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
make[2]: Entering directory `/cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp'
/usr/bin/cmake.exe -E cmake_progress_report /cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o
/cygdrive/c/projects/android-ndk-1.6_r1/build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-gcc.exe -nostdlib -o CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c /cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTryCompileExec.exe
/usr/bin/cmake.exe -E cmake_link_script CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
/cygdrive/c/projects/android-ndk-1.6_r1/build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-gcc.exe -nostdlib -Wl,-rpath-link=/cygdrive/c/projects/android-ndk-1.6_r1/build/platforms/android-4/arch-arm/usr/lib -L/cygdrive/c/projects/android-ndk-1.6_r1/build/platforms/android-4/arch-arm/usr/lib/ CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -o cmTryCompileExec.exe -Wl,libcmTryCompileExec.dll.a
/cygdrive/c/projects/android-ndk-1.6_r1/build/prebuilt/windows/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/../../../../arm-eabi/bin/ld: libcmTryCompileExec.dll.a: No such file: No such file or directory
collect2: ld returned 1 exit status
make[2]: Leaving directory `/cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp'
make[1]: Leaving directory `/cygdrive/c/projects/bullet-2.75/CMakeFiles/CMakeTmp'
make[2]: *** [cmTryCompileExec.exe] Error 1
make[1]: *** [cmTryCompileExec/fast] Error 2
I must have something set up incorrectly, but the error indicates a missing dll. I searched the hard drive to no avail....and I have no idea where to get this file. There is a directory at the path C:\projects\bullet-2.75\CMakeFiles\CMakeTmp\CMakeFiles called cmTryCompileExec.dir. It seems that the dll and source should be here, but it isn't.
I am even wondering if I really have to get this to work in order to compile the project...
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Trying to compile bullet for android
You don't need the cmake or any special build system to build the Bullet files.
The most easy is to include all *.cpp files recursively from the Bullet/src folder to your own project, and add the Bullet/src folder in your include path. That's all, very simple.
Thanks,
Erwin
The most easy is to include all *.cpp files recursively from the Bullet/src folder to your own project, and add the Bullet/src folder in your include path. That's all, very simple.
Thanks,
Erwin
-
- Posts: 7
- Joined: Mon Feb 15, 2010 9:29 am
Re: Trying to compile bullet for android
I got it compiled using custom makefiles and android toolchain...
I set it up in eclipse using CDT and eclipse...basically followed Doug Schaefer's example:
http://cdtdoug.blogspot.com/2009/09/usi ... ative.html
He also did an example with Box2d:
http://github.com/dschaefer/android-box2d
Here is the makefile located at the root of the bullet install (I called all android.mk):
all:
(cd ./src; make -f android.mk)
clean:
(cd ./src; make -f android.mk clean)
Here is makefile located in src folder (also android.mk):
all:
(cd ./BulletCollision; make -f android.mk)
(cd ./BulletDynamics; make -f android.mk)
# (cd ./BulletMultiThreaded; make -f android.mk)
(cd ./BulletSoftBody; make -f android.mk)
(cd ./LinearMath; make -f android.mk)
clean:
(cd ./BulletCollision; make -f android.mk clean)
(cd ./BulletDynamics; make -f android.mk clean)
# (cd ./BulletMultiThreaded; make -f android.mk clean)
(cd ./BulletSoftBody; make -f android.mk clean)
(cd ./LinearMath; make -f android.mk clean)
Here is an example for building the BulletCollision library (also called android.mk):
CFLAGS = -O2 -DTARGET_FLOAT32_IS_FIXED -IInclude -Iandroid
TARGETS = android
LIB = libBulletCollision.a
SOURCES = \
./BroadphaseCollision/btAxisSweep3.cpp \
./BroadphaseCollision/btBroadphaseProxy.cpp \
./BroadphaseCollision/btCollisionAlgorithm.cpp \
./BroadphaseCollision/btDbvt.cpp \
./BroadphaseCollision/btDbvtBroadphase.cpp \
./BroadphaseCollision/btDispatcher.cpp \
./BroadphaseCollision/btMultiSapBroadphase.cpp \
./BroadphaseCollision/btOverlappingPairCache.cpp \
./BroadphaseCollision/btQuantizedBvh.cpp \
./BroadphaseCollision/btSimpleBroadphase.cpp \
./CollisionDispatch/btActivatingCollisionAlgorithm.cpp \
./CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp \
./CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp \
./CollisionDispatch/btBoxBoxDetector.cpp \
./CollisionDispatch/btCollisionDispatcher.cpp \
./CollisionDispatch/btCollisionObject.cpp \
./CollisionDispatch/btCollisionWorld.cpp \
./CollisionDispatch/btCompoundCollisionAlgorithm.cpp \
./CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp \
./CollisionDispatch/btConvexConvexAlgorithm.cpp \
./CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp \
./CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp \
./CollisionDispatch/btDefaultCollisionConfiguration.cpp \
./CollisionDispatch/btEmptyCollisionAlgorithm.cpp \
./CollisionDispatch/btGhostObject.cpp \
./CollisionDispatch/btManifoldResult.cpp \
./CollisionDispatch/btSimulationIslandManager.cpp \
./CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp \
./CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp \
./CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp \
./CollisionDispatch/btUnionFind.cpp \
./CollisionDispatch/SphereTriangleDetector.cpp \
./CollisionShapes/btBoxShape.cpp \
./CollisionShapes/btBox2dShape.cpp \
./CollisionShapes/btBvhTriangleMeshShape.cpp \
./CollisionShapes/btCapsuleShape.cpp \
./CollisionShapes/btCollisionShape.cpp \
./CollisionShapes/btCompoundShape.cpp \
./CollisionShapes/btConcaveShape.cpp \
./CollisionShapes/btConeShape.cpp \
./CollisionShapes/btConvexHullShape.cpp \
./CollisionShapes/btConvexInternalShape.cpp \
./CollisionShapes/btConvexPointCloudShape.cpp \
./CollisionShapes/btConvexShape.cpp \
./CollisionShapes/btConvex2dShape.cpp \
./CollisionShapes/btConvexTriangleMeshShape.cpp \
./CollisionShapes/btCylinderShape.cpp \
./CollisionShapes/btEmptyShape.cpp \
./CollisionShapes/btHeightfieldTerrainShape.cpp \
./CollisionShapes/btMinkowskiSumShape.cpp \
./CollisionShapes/btMultimaterialTriangleMeshShape.cpp \
./CollisionShapes/btMultiSphereShape.cpp \
./CollisionShapes/btOptimizedBvh.cpp \
./CollisionShapes/btPolyhedralConvexShape.cpp \
./CollisionShapes/btScaledBvhTriangleMeshShape.cpp \
./CollisionShapes/btShapeHull.cpp \
./CollisionShapes/btSphereShape.cpp \
./CollisionShapes/btStaticPlaneShape.cpp \
./CollisionShapes/btStridingMeshInterface.cpp \
./CollisionShapes/btTetrahedronShape.cpp \
./CollisionShapes/btTriangleBuffer.cpp \
./CollisionShapes/btTriangleCallback.cpp \
./CollisionShapes/btTriangleIndexVertexArray.cpp \
./CollisionShapes/btTriangleIndexVertexMaterialArray.cpp \
./CollisionShapes/btTriangleMesh.cpp \
./CollisionShapes/btTriangleMeshShape.cpp \
./CollisionShapes/btUniformScalingShape.cpp \
./Gimpact/btContactProcessing.cpp \
./Gimpact/btGenericPoolAllocator.cpp \
./Gimpact/btGImpactBvh.cpp \
./Gimpact/btGImpactCollisionAlgorithm.cpp \
./Gimpact/btGImpactQuantizedBvh.cpp \
./Gimpact/btGImpactShape.cpp \
./Gimpact/btTriangleShapeEx.cpp \
./Gimpact/gim_box_set.cpp \
./Gimpact/gim_contact.cpp \
./Gimpact/gim_memory.cpp \
./Gimpact/gim_tri_collision.cpp \
./NarrowPhaseCollision/btContinuousConvexCollision.cpp \
./NarrowPhaseCollision/btConvexCast.cpp \
./NarrowPhaseCollision/btGjkConvexCast.cpp \
./NarrowPhaseCollision/btGjkEpa2.cpp \
./NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp \
./NarrowPhaseCollision/btGjkPairDetector.cpp \
./NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp \
./NarrowPhaseCollision/btPersistentManifold.cpp \
./NarrowPhaseCollision/btRaycastCallback.cpp \
./NarrowPhaseCollision/btSubSimplexConvexCast.cpp \
./NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
all: $(TARGETS)
define PLATFORM_rules
$(1)_SOURCES = $$(SOURCES)
$(1)_OBJS = $$($(1)_SOURCES:%.cpp=./obj/$(1)/%.o)
$(1)_LIB = ../../lib/$(1)/$$(LIB)
$(1): $$($(1)_LIB)
$$($(1)_LIB): $$($(1)_OBJS)
@mkdir -p $$(dir $$@)
$$(TOOL_PREFIX)ar rc $$@ $$^
obj/$(1)/%.o: %.cpp
mkdir -p $$(dir $$@)
$$(TOOL_PREFIX)g++ $$(CFLAGS) -DDAS_PLATFORM_$(1) -MD -o $$@ -c $$<
-include $$($(1)_OBJS:%.o=%.d)
endef
$(foreach platform,$(TARGETS),$(eval $(call PLATFORM_rules,$(platform))))
ifeq ($(shell uname),Linux)
ANDROID_NDK_BASE = $(HOME)/projects/android-ndk-1.6_r1
ANDROID_PLAT=linux-x86
else # windows
ANDROID_NDK_BASE = /cygdrive/c/projects/android-ndk-1.6_r1
ANDROID_PLAT=windows
endif
ANDROID_TOOL_PREFIX = $(ANDROID_NDK_BASE)/build/prebuilt/$(ANDROID_PLAT)/arm-eabi-4.2.1/bin/arm-eabi-
ANDROID_CFLAGS = -march=armv5te -mtune=xscale -msoft-float -fpic -mthumb-interwork \
-ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \
-fno-exceptions -fno-rtti \
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -O2 -DNDEBUG -g \
-I$(ANDROID_NDK_BASE)/build/platforms/android-3/arch-arm/usr/include \
-I../ -I./BroadphaseCollision -I./CollisionDispatch -I./CollisionShapes -I./Gimpact -I./NarrowPhaseCollision
android: TOOL_PREFIX = $(ANDROID_TOOL_PREFIX)
android: CFLAGS += $(ANDROID_CFLAGS)
clean:
rm -fr obj lib
You will need to edit the paths in the makefiles to fit your install of cygwin, NDK and toolchains...
I hope this helps.
I set it up in eclipse using CDT and eclipse...basically followed Doug Schaefer's example:
http://cdtdoug.blogspot.com/2009/09/usi ... ative.html
He also did an example with Box2d:
http://github.com/dschaefer/android-box2d
Here is the makefile located at the root of the bullet install (I called all android.mk):
all:
(cd ./src; make -f android.mk)
clean:
(cd ./src; make -f android.mk clean)
Here is makefile located in src folder (also android.mk):
all:
(cd ./BulletCollision; make -f android.mk)
(cd ./BulletDynamics; make -f android.mk)
# (cd ./BulletMultiThreaded; make -f android.mk)
(cd ./BulletSoftBody; make -f android.mk)
(cd ./LinearMath; make -f android.mk)
clean:
(cd ./BulletCollision; make -f android.mk clean)
(cd ./BulletDynamics; make -f android.mk clean)
# (cd ./BulletMultiThreaded; make -f android.mk clean)
(cd ./BulletSoftBody; make -f android.mk clean)
(cd ./LinearMath; make -f android.mk clean)
Here is an example for building the BulletCollision library (also called android.mk):
CFLAGS = -O2 -DTARGET_FLOAT32_IS_FIXED -IInclude -Iandroid
TARGETS = android
LIB = libBulletCollision.a
SOURCES = \
./BroadphaseCollision/btAxisSweep3.cpp \
./BroadphaseCollision/btBroadphaseProxy.cpp \
./BroadphaseCollision/btCollisionAlgorithm.cpp \
./BroadphaseCollision/btDbvt.cpp \
./BroadphaseCollision/btDbvtBroadphase.cpp \
./BroadphaseCollision/btDispatcher.cpp \
./BroadphaseCollision/btMultiSapBroadphase.cpp \
./BroadphaseCollision/btOverlappingPairCache.cpp \
./BroadphaseCollision/btQuantizedBvh.cpp \
./BroadphaseCollision/btSimpleBroadphase.cpp \
./CollisionDispatch/btActivatingCollisionAlgorithm.cpp \
./CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp \
./CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp \
./CollisionDispatch/btBoxBoxDetector.cpp \
./CollisionDispatch/btCollisionDispatcher.cpp \
./CollisionDispatch/btCollisionObject.cpp \
./CollisionDispatch/btCollisionWorld.cpp \
./CollisionDispatch/btCompoundCollisionAlgorithm.cpp \
./CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp \
./CollisionDispatch/btConvexConvexAlgorithm.cpp \
./CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp \
./CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp \
./CollisionDispatch/btDefaultCollisionConfiguration.cpp \
./CollisionDispatch/btEmptyCollisionAlgorithm.cpp \
./CollisionDispatch/btGhostObject.cpp \
./CollisionDispatch/btManifoldResult.cpp \
./CollisionDispatch/btSimulationIslandManager.cpp \
./CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp \
./CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp \
./CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp \
./CollisionDispatch/btUnionFind.cpp \
./CollisionDispatch/SphereTriangleDetector.cpp \
./CollisionShapes/btBoxShape.cpp \
./CollisionShapes/btBox2dShape.cpp \
./CollisionShapes/btBvhTriangleMeshShape.cpp \
./CollisionShapes/btCapsuleShape.cpp \
./CollisionShapes/btCollisionShape.cpp \
./CollisionShapes/btCompoundShape.cpp \
./CollisionShapes/btConcaveShape.cpp \
./CollisionShapes/btConeShape.cpp \
./CollisionShapes/btConvexHullShape.cpp \
./CollisionShapes/btConvexInternalShape.cpp \
./CollisionShapes/btConvexPointCloudShape.cpp \
./CollisionShapes/btConvexShape.cpp \
./CollisionShapes/btConvex2dShape.cpp \
./CollisionShapes/btConvexTriangleMeshShape.cpp \
./CollisionShapes/btCylinderShape.cpp \
./CollisionShapes/btEmptyShape.cpp \
./CollisionShapes/btHeightfieldTerrainShape.cpp \
./CollisionShapes/btMinkowskiSumShape.cpp \
./CollisionShapes/btMultimaterialTriangleMeshShape.cpp \
./CollisionShapes/btMultiSphereShape.cpp \
./CollisionShapes/btOptimizedBvh.cpp \
./CollisionShapes/btPolyhedralConvexShape.cpp \
./CollisionShapes/btScaledBvhTriangleMeshShape.cpp \
./CollisionShapes/btShapeHull.cpp \
./CollisionShapes/btSphereShape.cpp \
./CollisionShapes/btStaticPlaneShape.cpp \
./CollisionShapes/btStridingMeshInterface.cpp \
./CollisionShapes/btTetrahedronShape.cpp \
./CollisionShapes/btTriangleBuffer.cpp \
./CollisionShapes/btTriangleCallback.cpp \
./CollisionShapes/btTriangleIndexVertexArray.cpp \
./CollisionShapes/btTriangleIndexVertexMaterialArray.cpp \
./CollisionShapes/btTriangleMesh.cpp \
./CollisionShapes/btTriangleMeshShape.cpp \
./CollisionShapes/btUniformScalingShape.cpp \
./Gimpact/btContactProcessing.cpp \
./Gimpact/btGenericPoolAllocator.cpp \
./Gimpact/btGImpactBvh.cpp \
./Gimpact/btGImpactCollisionAlgorithm.cpp \
./Gimpact/btGImpactQuantizedBvh.cpp \
./Gimpact/btGImpactShape.cpp \
./Gimpact/btTriangleShapeEx.cpp \
./Gimpact/gim_box_set.cpp \
./Gimpact/gim_contact.cpp \
./Gimpact/gim_memory.cpp \
./Gimpact/gim_tri_collision.cpp \
./NarrowPhaseCollision/btContinuousConvexCollision.cpp \
./NarrowPhaseCollision/btConvexCast.cpp \
./NarrowPhaseCollision/btGjkConvexCast.cpp \
./NarrowPhaseCollision/btGjkEpa2.cpp \
./NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp \
./NarrowPhaseCollision/btGjkPairDetector.cpp \
./NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp \
./NarrowPhaseCollision/btPersistentManifold.cpp \
./NarrowPhaseCollision/btRaycastCallback.cpp \
./NarrowPhaseCollision/btSubSimplexConvexCast.cpp \
./NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
all: $(TARGETS)
define PLATFORM_rules
$(1)_SOURCES = $$(SOURCES)
$(1)_OBJS = $$($(1)_SOURCES:%.cpp=./obj/$(1)/%.o)
$(1)_LIB = ../../lib/$(1)/$$(LIB)
$(1): $$($(1)_LIB)
$$($(1)_LIB): $$($(1)_OBJS)
@mkdir -p $$(dir $$@)
$$(TOOL_PREFIX)ar rc $$@ $$^
obj/$(1)/%.o: %.cpp
mkdir -p $$(dir $$@)
$$(TOOL_PREFIX)g++ $$(CFLAGS) -DDAS_PLATFORM_$(1) -MD -o $$@ -c $$<
-include $$($(1)_OBJS:%.o=%.d)
endef
$(foreach platform,$(TARGETS),$(eval $(call PLATFORM_rules,$(platform))))
ifeq ($(shell uname),Linux)
ANDROID_NDK_BASE = $(HOME)/projects/android-ndk-1.6_r1
ANDROID_PLAT=linux-x86
else # windows
ANDROID_NDK_BASE = /cygdrive/c/projects/android-ndk-1.6_r1
ANDROID_PLAT=windows
endif
ANDROID_TOOL_PREFIX = $(ANDROID_NDK_BASE)/build/prebuilt/$(ANDROID_PLAT)/arm-eabi-4.2.1/bin/arm-eabi-
ANDROID_CFLAGS = -march=armv5te -mtune=xscale -msoft-float -fpic -mthumb-interwork \
-ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \
-fno-exceptions -fno-rtti \
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -O2 -DNDEBUG -g \
-I$(ANDROID_NDK_BASE)/build/platforms/android-3/arch-arm/usr/include \
-I../ -I./BroadphaseCollision -I./CollisionDispatch -I./CollisionShapes -I./Gimpact -I./NarrowPhaseCollision
android: TOOL_PREFIX = $(ANDROID_TOOL_PREFIX)
android: CFLAGS += $(ANDROID_CFLAGS)
clean:
rm -fr obj lib
You will need to edit the paths in the makefiles to fit your install of cygwin, NDK and toolchains...
I hope this helps.
-
- Posts: 1
- Joined: Tue Jul 06, 2010 2:22 am
Re: Trying to compile bullet for android
Did anyone get this working? I'm getting an error message that reads:
"make: *** No rule to make target `all'." (line 0)
I created three Android.mk files...one in the project root, one in "/jni/bullet", and one in "/jni/bullet/src". (Note that I my "jni" folder is essentially the same as Doug Schaefer's "native" folder.) The contents for these files were copied/pasted from the post before mine, updating the NDK path in the file.
Android.mk file in project root:
Android.mk in /jni/bullet:
Android.mk in /jni/bullet/src:
I also tried renaming the root Android.mk to Makefile, and that resulted in a different error message that seems to be more on the right track since it's an actual error pertaining to the makefile's contents, as opposed to the prior one sounding like it can't find the makefile:
"*** commands commence before the first target. Stop." (line 119)
This is line 119:
"make: *** No rule to make target `all'." (line 0)
I created three Android.mk files...one in the project root, one in "/jni/bullet", and one in "/jni/bullet/src". (Note that I my "jni" folder is essentially the same as Doug Schaefer's "native" folder.) The contents for these files were copied/pasted from the post before mine, updating the NDK path in the file.
Android.mk file in project root:
Code: Select all
CFLAGS = -O2 -DTARGET_FLOAT32_IS_FIXED -IInclude -Iandroid
TARGETS = android
LIB = libBulletCollision.a
SOURCES = \
./BroadphaseCollision/btAxisSweep3.cpp \
./BroadphaseCollision/btBroadphaseProxy.cpp \
./BroadphaseCollision/btCollisionAlgorithm.cpp \
./BroadphaseCollision/btDbvt.cpp \
./BroadphaseCollision/btDbvtBroadphase.cpp \
./BroadphaseCollision/btDispatcher.cpp \
./BroadphaseCollision/btMultiSapBroadphase.cpp \
./BroadphaseCollision/btOverlappingPairCache.cpp \
./BroadphaseCollision/btQuantizedBvh.cpp \
./BroadphaseCollision/btSimpleBroadphase.cpp \
./CollisionDispatch/btActivatingCollisionAlgorithm.cpp \
./CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp \
./CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp \
./CollisionDispatch/btBoxBoxDetector.cpp \
./CollisionDispatch/btCollisionDispatcher.cpp \
./CollisionDispatch/btCollisionObject.cpp \
./CollisionDispatch/btCollisionWorld.cpp \
./CollisionDispatch/btCompoundCollisionAlgorithm.cpp \
./CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp \
./CollisionDispatch/btConvexConvexAlgorithm.cpp \
./CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp \
./CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp \
./CollisionDispatch/btDefaultCollisionConfiguration.cpp \
./CollisionDispatch/btEmptyCollisionAlgorithm.cpp \
./CollisionDispatch/btGhostObject.cpp \
./CollisionDispatch/btManifoldResult.cpp \
./CollisionDispatch/btSimulationIslandManager.cpp \
./CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp \
./CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp \
./CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp \
./CollisionDispatch/btUnionFind.cpp \
./CollisionDispatch/SphereTriangleDetector.cpp \
./CollisionShapes/btBoxShape.cpp \
./CollisionShapes/btBox2dShape.cpp \
./CollisionShapes/btBvhTriangleMeshShape.cpp \
./CollisionShapes/btCapsuleShape.cpp \
./CollisionShapes/btCollisionShape.cpp \
./CollisionShapes/btCompoundShape.cpp \
./CollisionShapes/btConcaveShape.cpp \
./CollisionShapes/btConeShape.cpp \
./CollisionShapes/btConvexHullShape.cpp \
./CollisionShapes/btConvexInternalShape.cpp \
./CollisionShapes/btConvexPointCloudShape.cpp \
./CollisionShapes/btConvexShape.cpp \
./CollisionShapes/btConvex2dShape.cpp \
./CollisionShapes/btConvexTriangleMeshShape.cpp \
./CollisionShapes/btCylinderShape.cpp \
./CollisionShapes/btEmptyShape.cpp \
./CollisionShapes/btHeightfieldTerrainShape.cpp \
./CollisionShapes/btMinkowskiSumShape.cpp \
./CollisionShapes/btMultimaterialTriangleMeshShape.cpp \
./CollisionShapes/btMultiSphereShape.cpp \
./CollisionShapes/btOptimizedBvh.cpp \
./CollisionShapes/btPolyhedralConvexShape.cpp \
./CollisionShapes/btScaledBvhTriangleMeshShape.cpp \
./CollisionShapes/btShapeHull.cpp \
./CollisionShapes/btSphereShape.cpp \
./CollisionShapes/btStaticPlaneShape.cpp \
./CollisionShapes/btStridingMeshInterface.cpp \
./CollisionShapes/btTetrahedronShape.cpp \
./CollisionShapes/btTriangleBuffer.cpp \
./CollisionShapes/btTriangleCallback.cpp \
./CollisionShapes/btTriangleIndexVertexArray.cpp \
./CollisionShapes/btTriangleIndexVertexMaterialArray.cpp \
./CollisionShapes/btTriangleMesh.cpp \
./CollisionShapes/btTriangleMeshShape.cpp \
./CollisionShapes/btUniformScalingShape.cpp \
./Gimpact/btContactProcessing.cpp \
./Gimpact/btGenericPoolAllocator.cpp \
./Gimpact/btGImpactBvh.cpp \
./Gimpact/btGImpactCollisionAlgorithm.cpp \
./Gimpact/btGImpactQuantizedBvh.cpp \
./Gimpact/btGImpactShape.cpp \
./Gimpact/btTriangleShapeEx.cpp \
./Gimpact/gim_box_set.cpp \
./Gimpact/gim_contact.cpp \
./Gimpact/gim_memory.cpp \
./Gimpact/gim_tri_collision.cpp \
./NarrowPhaseCollision/btContinuousConvexCollision.cpp \
./NarrowPhaseCollision/btConvexCast.cpp \
./NarrowPhaseCollision/btGjkConvexCast.cpp \
./NarrowPhaseCollision/btGjkEpa2.cpp \
./NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp \
./NarrowPhaseCollision/btGjkPairDetector.cpp \
./NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp \
./NarrowPhaseCollision/btPersistentManifold.cpp \
./NarrowPhaseCollision/btRaycastCallback.cpp \
./NarrowPhaseCollision/btSubSimplexConvexCast.cpp \
./NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
all:
$(TARGETS)
define PLATFORM_rules
$(1)_SOURCES = $$(SOURCES)
$(1)_OBJS = $$($(1)_SOURCES:%.cpp=./obj/$(1)/%.o)
$(1)_LIB = ../../lib/$(1)/$$(LIB)
$(1): $$($(1)_LIB)
$$($(1)_LIB): $$($(1)_OBJS)
@mkdir -p $$(dir $$@)
$$(TOOL_PREFIX)ar rc $$@ $$^
obj/$(1)/%.o: %.cpp
mkdir -p $$(dir $$@)
$$(TOOL_PREFIX)g++ $$(CFLAGS) -DDAS_PLATFORM_$(1) -MD -o $$@ -c $$<
-include $$($(1)_OBJS:%.o=%.d)
endef
$(foreach platform,$(TARGETS),$(eval $(call PLATFORM_rules,$(platform))))
ifeq ($(shell uname),Linux)
ANDROID_NDK_BASE = $(HOME)/lib/android-ndk-r4
ANDROID_PLAT=linux-x86
else # windows
ANDROID_NDK_BASE = /cygdrive/c/projects/android-ndk-r4
ANDROID_PLAT=windows
endif
ANDROID_TOOL_PREFIX = $(ANDROID_NDK_BASE)/build/prebuilt/$(ANDROID_PLAT)/arm-eabi-4.2.1/bin/arm-eabi-
ANDROID_CFLAGS = -march=armv5te -mtune=xscale -msoft-float -fpic -mthumb-interwork \
-ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \
-fno-exceptions -fno-rtti \
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -O2 -DNDEBUG -g \
-I$(ANDROID_NDK_BASE)/build/platforms/android-3/arch-arm/usr/include \
-I../ -I./BroadphaseCollision -I./CollisionDispatch -I./CollisionShapes -I./Gimpact -I./NarrowPhaseCollision
android:
TOOL_PREFIX = $(ANDROID_TOOL_PREFIX)
android:
CFLAGS += $(ANDROID_CFLAGS)
clean:
rm -fr obj/* libs/*
Code: Select all
all:
(cd ./bullet; make -f Android.mk)
clean:
(cd ./bullet; make -f Android.mk clean)
Code: Select all
all:
(cd ./BulletCollision; make -f Android.mk)
(cd ./BulletDynamics; make -f Android.mk)
# (cd ./BulletMultiThreaded; make -f Android.mk)
(cd ./BulletSoftBody; make -f Android.mk)
(cd ./LinearMath; make -f Android.mk)
clean:
(cd ./BulletCollision; make -f Android.mk clean)
(cd ./BulletDynamics; make -f Android.mk clean)
# (cd ./BulletMultiThreaded; make -f Android.mk clean)
(cd ./BulletSoftBody; make -f Android.mk clean)
(cd ./LinearMath; make -f Android.mk clean)
"*** commands commence before the first target. Stop." (line 119)
This is line 119:
Code: Select all
$(foreach platform,$(TARGETS),$(eval $(call PLATFORM_rules,$(platform))))
-
- Posts: 82
- Joined: Sun Apr 04, 2010 10:08 pm
Re: Trying to compile bullet for android
Android usually runs on ARM and does ARM has FPU ? May be some phones has FPU co-processor.
-
- Posts: 7
- Joined: Mon Feb 15, 2010 9:29 am
Re: Trying to compile bullet for android
mhuggins wrote:Did anyone get this working? I'm getting an error message that reads:
"make: *** No rule to make target `all'." (line 0)
I created three Android.mk files...one in the project root, one in "/jni/bullet", and one in "/jni/bullet/src". (Note that I my "jni" folder is essentially the same as Doug Schaefer's "native" folder.) The contents for these files were copied/pasted from the post before mine, updating the NDK path in the file.
Android.mk file in project root:Android.mk in /jni/bullet:Code: Select all
CFLAGS = -O2 -DTARGET_FLOAT32_IS_FIXED -IInclude -Iandroid TARGETS = android LIB = libBulletCollision.a SOURCES = \ ./BroadphaseCollision/btAxisSweep3.cpp \ ./BroadphaseCollision/btBroadphaseProxy.cpp \ ./BroadphaseCollision/btCollisionAlgorithm.cpp \ ./BroadphaseCollision/btDbvt.cpp \ ./BroadphaseCollision/btDbvtBroadphase.cpp \ ./BroadphaseCollision/btDispatcher.cpp \ ./BroadphaseCollision/btMultiSapBroadphase.cpp \ ./BroadphaseCollision/btOverlappingPairCache.cpp \ ./BroadphaseCollision/btQuantizedBvh.cpp \ ./BroadphaseCollision/btSimpleBroadphase.cpp \ ./CollisionDispatch/btActivatingCollisionAlgorithm.cpp \ ./CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp \ ./CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp \ ./CollisionDispatch/btBoxBoxDetector.cpp \ ./CollisionDispatch/btCollisionDispatcher.cpp \ ./CollisionDispatch/btCollisionObject.cpp \ ./CollisionDispatch/btCollisionWorld.cpp \ ./CollisionDispatch/btCompoundCollisionAlgorithm.cpp \ ./CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp \ ./CollisionDispatch/btConvexConvexAlgorithm.cpp \ ./CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp \ ./CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp \ ./CollisionDispatch/btDefaultCollisionConfiguration.cpp \ ./CollisionDispatch/btEmptyCollisionAlgorithm.cpp \ ./CollisionDispatch/btGhostObject.cpp \ ./CollisionDispatch/btManifoldResult.cpp \ ./CollisionDispatch/btSimulationIslandManager.cpp \ ./CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp \ ./CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp \ ./CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp \ ./CollisionDispatch/btUnionFind.cpp \ ./CollisionDispatch/SphereTriangleDetector.cpp \ ./CollisionShapes/btBoxShape.cpp \ ./CollisionShapes/btBox2dShape.cpp \ ./CollisionShapes/btBvhTriangleMeshShape.cpp \ ./CollisionShapes/btCapsuleShape.cpp \ ./CollisionShapes/btCollisionShape.cpp \ ./CollisionShapes/btCompoundShape.cpp \ ./CollisionShapes/btConcaveShape.cpp \ ./CollisionShapes/btConeShape.cpp \ ./CollisionShapes/btConvexHullShape.cpp \ ./CollisionShapes/btConvexInternalShape.cpp \ ./CollisionShapes/btConvexPointCloudShape.cpp \ ./CollisionShapes/btConvexShape.cpp \ ./CollisionShapes/btConvex2dShape.cpp \ ./CollisionShapes/btConvexTriangleMeshShape.cpp \ ./CollisionShapes/btCylinderShape.cpp \ ./CollisionShapes/btEmptyShape.cpp \ ./CollisionShapes/btHeightfieldTerrainShape.cpp \ ./CollisionShapes/btMinkowskiSumShape.cpp \ ./CollisionShapes/btMultimaterialTriangleMeshShape.cpp \ ./CollisionShapes/btMultiSphereShape.cpp \ ./CollisionShapes/btOptimizedBvh.cpp \ ./CollisionShapes/btPolyhedralConvexShape.cpp \ ./CollisionShapes/btScaledBvhTriangleMeshShape.cpp \ ./CollisionShapes/btShapeHull.cpp \ ./CollisionShapes/btSphereShape.cpp \ ./CollisionShapes/btStaticPlaneShape.cpp \ ./CollisionShapes/btStridingMeshInterface.cpp \ ./CollisionShapes/btTetrahedronShape.cpp \ ./CollisionShapes/btTriangleBuffer.cpp \ ./CollisionShapes/btTriangleCallback.cpp \ ./CollisionShapes/btTriangleIndexVertexArray.cpp \ ./CollisionShapes/btTriangleIndexVertexMaterialArray.cpp \ ./CollisionShapes/btTriangleMesh.cpp \ ./CollisionShapes/btTriangleMeshShape.cpp \ ./CollisionShapes/btUniformScalingShape.cpp \ ./Gimpact/btContactProcessing.cpp \ ./Gimpact/btGenericPoolAllocator.cpp \ ./Gimpact/btGImpactBvh.cpp \ ./Gimpact/btGImpactCollisionAlgorithm.cpp \ ./Gimpact/btGImpactQuantizedBvh.cpp \ ./Gimpact/btGImpactShape.cpp \ ./Gimpact/btTriangleShapeEx.cpp \ ./Gimpact/gim_box_set.cpp \ ./Gimpact/gim_contact.cpp \ ./Gimpact/gim_memory.cpp \ ./Gimpact/gim_tri_collision.cpp \ ./NarrowPhaseCollision/btContinuousConvexCollision.cpp \ ./NarrowPhaseCollision/btConvexCast.cpp \ ./NarrowPhaseCollision/btGjkConvexCast.cpp \ ./NarrowPhaseCollision/btGjkEpa2.cpp \ ./NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp \ ./NarrowPhaseCollision/btGjkPairDetector.cpp \ ./NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp \ ./NarrowPhaseCollision/btPersistentManifold.cpp \ ./NarrowPhaseCollision/btRaycastCallback.cpp \ ./NarrowPhaseCollision/btSubSimplexConvexCast.cpp \ ./NarrowPhaseCollision/btVoronoiSimplexSolver.cpp all: $(TARGETS) define PLATFORM_rules $(1)_SOURCES = $$(SOURCES) $(1)_OBJS = $$($(1)_SOURCES:%.cpp=./obj/$(1)/%.o) $(1)_LIB = ../../lib/$(1)/$$(LIB) $(1): $$($(1)_LIB) $$($(1)_LIB): $$($(1)_OBJS) @mkdir -p $$(dir $$@) $$(TOOL_PREFIX)ar rc $$@ $$^ obj/$(1)/%.o: %.cpp mkdir -p $$(dir $$@) $$(TOOL_PREFIX)g++ $$(CFLAGS) -DDAS_PLATFORM_$(1) -MD -o $$@ -c $$< -include $$($(1)_OBJS:%.o=%.d) endef $(foreach platform,$(TARGETS),$(eval $(call PLATFORM_rules,$(platform)))) ifeq ($(shell uname),Linux) ANDROID_NDK_BASE = $(HOME)/lib/android-ndk-r4 ANDROID_PLAT=linux-x86 else # windows ANDROID_NDK_BASE = /cygdrive/c/projects/android-ndk-r4 ANDROID_PLAT=windows endif ANDROID_TOOL_PREFIX = $(ANDROID_NDK_BASE)/build/prebuilt/$(ANDROID_PLAT)/arm-eabi-4.2.1/bin/arm-eabi- ANDROID_CFLAGS = -march=armv5te -mtune=xscale -msoft-float -fpic -mthumb-interwork \ -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \ -fno-exceptions -fno-rtti \ -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -O2 -DNDEBUG -g \ -I$(ANDROID_NDK_BASE)/build/platforms/android-3/arch-arm/usr/include \ -I../ -I./BroadphaseCollision -I./CollisionDispatch -I./CollisionShapes -I./Gimpact -I./NarrowPhaseCollision android: TOOL_PREFIX = $(ANDROID_TOOL_PREFIX) android: CFLAGS += $(ANDROID_CFLAGS) clean: rm -fr obj/* libs/*
Android.mk in /jni/bullet/src:Code: Select all
all: (cd ./bullet; make -f Android.mk) clean: (cd ./bullet; make -f Android.mk clean)
I also tried renaming the root Android.mk to Makefile, and that resulted in a different error message that seems to be more on the right track since it's an actual error pertaining to the makefile's contents, as opposed to the prior one sounding like it can't find the makefile:Code: Select all
all: (cd ./BulletCollision; make -f Android.mk) (cd ./BulletDynamics; make -f Android.mk) # (cd ./BulletMultiThreaded; make -f Android.mk) (cd ./BulletSoftBody; make -f Android.mk) (cd ./LinearMath; make -f Android.mk) clean: (cd ./BulletCollision; make -f Android.mk clean) (cd ./BulletDynamics; make -f Android.mk clean) # (cd ./BulletMultiThreaded; make -f Android.mk clean) (cd ./BulletSoftBody; make -f Android.mk clean) (cd ./LinearMath; make -f Android.mk clean)
"*** commands commence before the first target. Stop." (line 119)
This is line 119:
Code: Select all
$(foreach platform,$(TARGETS),$(eval $(call PLATFORM_rules,$(platform))))
Make sure you configure eclipse CDT to use the "make -f Android.mk" command as opposed to just "make". It will look for "Makefile" otherwise.
Choose C++ project properties, C++ Build, uncheck "Use default build command", then enter the command above in the edit box.
-
- Posts: 7
- Joined: Mon Feb 15, 2010 9:29 am
Re: Trying to compile bullet for android
one other thing mhuggins...the bulletcollision makefile belongs in the "bullet-X.XX\src\bulletcollision" directory in order to work by simply copying and pasting (while changing the paths to the NDK, etc.).
-
- Posts: 7
- Joined: Sat Jul 10, 2010 8:34 pm
Re: Trying to compile bullet for android
Your Makefile seems overcomplicated, the building process has been simplified a lot in the Android NDK r4, you don't have to have to mess around with separate folders and multiple makefiles anymore, you just have to create one simple makefile in "YourProject/jni/..." and put your native source files in here, then from this folder call "./ndk-build" (the script is in the NDK)
As an example, here's mine :
then to actually use bullet through this, you may add your own files with JNI functions in here, and build the code like this :
Optionally, you can have an "Application.mk" file in your jni folder if you want to build for multiple arch at the same time, for example mine contains :
When you've done you'll automatically have the built library(ies) placed in the right folder and you can load then in your Java code and use the native functions
As an example, here's mine :
Code: Select all
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := nativelib
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/ \
$(LOCAL_PATH)/BulletCollision/BroadphaseCollision \
$(LOCAL_PATH)/BulletCollision/CollisionDispatch \
$(LOCAL_PATH)/BulletCollision/CollisionShapes \
$(LOCAL_PATH)/BulletCollision/NarrowPhaseCollision \
$(LOCAL_PATH)/BulletDynamics/ConstraintSolver \
$(LOCAL_PATH)/BulletDynamics/Dynamics \
$(LOCAL_PATH)/BulletDynamics/Vehicle \
$(LOCAL_PATH)/LinearMath \
$(LOCAL_PATH)/../libzip/ \
$(LOCAL_PATH)/../libpng/ \
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libzip libpng
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -O3 -DANDROID_NDK
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -ldl -llog -lGLESv1_CM -lz
LOCAL_SRC_FILES := \
LinearMath/btAlignedAllocator.cpp \
LinearMath/btGeometryUtil.cpp \
LinearMath/btQuickprof.cpp \
LinearMath/btSerializer.cpp \
BulletCollision/BroadphaseCollision/btAxisSweep3.cpp \
BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp \
BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp \
BulletCollision/BroadphaseCollision/btDispatcher.cpp \
BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp \
BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp \
BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp \
BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp \
BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp \
BulletCollision/BroadphaseCollision/btDbvt.cpp \
BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp \
BulletCollision/CollisionDispatch/btCollisionObject.cpp \
BulletCollision/CollisionDispatch/btCollisionWorld.cpp \
BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp \
BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp \
BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btManifoldResult.cpp \
BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp \
BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btUnionFind.cpp \
BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp \
BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp \
BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp \
BulletCollision/CollisionShapes/btBoxShape.cpp \
BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp \
BulletCollision/CollisionShapes/btCapsuleShape.cpp \
BulletCollision/CollisionShapes/btCollisionShape.cpp \
BulletCollision/CollisionShapes/btCompoundShape.cpp \
BulletCollision/CollisionShapes/btConcaveShape.cpp \
BulletCollision/CollisionShapes/btConeShape.cpp \
BulletCollision/CollisionShapes/btConvexHullShape.cpp \
BulletCollision/CollisionShapes/btConvexInternalShape.cpp \
BulletCollision/CollisionShapes/btConvexShape.cpp \
BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp \
BulletCollision/CollisionShapes/btCylinderShape.cpp \
BulletCollision/CollisionShapes/btEmptyShape.cpp \
BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp \
BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp \
BulletCollision/CollisionShapes/btMultiSphereShape.cpp \
BulletCollision/CollisionShapes/btOptimizedBvh.cpp \
BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp \
BulletCollision/CollisionShapes/btSphereShape.cpp \
BulletCollision/CollisionShapes/btStaticPlaneShape.cpp \
BulletCollision/CollisionShapes/btStridingMeshInterface.cpp \
BulletCollision/CollisionShapes/btTetrahedronShape.cpp \
BulletCollision/CollisionShapes/btTriangleBuffer.cpp \
BulletCollision/CollisionShapes/btTriangleCallback.cpp \
BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp \
BulletCollision/CollisionShapes/btTriangleMesh.cpp \
BulletCollision/CollisionShapes/btTriangleMeshShape.cpp \
BulletCollision/CollisionShapes/btUniformScalingShape.cpp \
BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp \
BulletCollision/NarrowPhaseCollision/btConvexCast.cpp \
BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp \
BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp \
BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp \
BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp \
BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp \
BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp \
BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp \
BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp \
BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp \
BulletDynamics/Vehicle/btRaycastVehicle.cpp \
BulletDynamics/Vehicle/btWheelInfo.cpp \
BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp \
BulletDynamics/ConstraintSolver/btContactConstraint.cpp \
BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp \
BulletDynamics/ConstraintSolver/btHingeConstraint.cpp \
BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp \
BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp \
BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp \
BulletDynamics/ConstraintSolver/btTypedConstraint.cpp \
BulletDynamics/Dynamics/btContinuousDynamicsWorld.cpp \
BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp \
BulletDynamics/Dynamics/btRigidBody.cpp \
BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp \
include $(BUILD_SHARED_LIBRARY)
Code: Select all
cd /YourProject/
/ANDROID-NDK-PATH-HERE/ndk-build
Code: Select all
APP_ABI := armeabi armeabi-v7a
-
- Posts: 7
- Joined: Mon Feb 15, 2010 9:29 am
Re: Trying to compile bullet for android
Alkane,
Your method is fine if you want to use the android build system. I started this before the new NDK...and it allows me to get away from the android build system while using eclipse and CDT. I can edit all my source code at once this way.
For those who aren't familiar with makefile syntax, Alkane's method is probably better for you.
Your method is fine if you want to use the android build system. I started this before the new NDK...and it allows me to get away from the android build system while using eclipse and CDT. I can edit all my source code at once this way.
For those who aren't familiar with makefile syntax, Alkane's method is probably better for you.